CN115345136A - Slide processing method and device, electronic equipment and storage medium - Google Patents

Slide processing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115345136A
CN115345136A CN202210927881.6A CN202210927881A CN115345136A CN 115345136 A CN115345136 A CN 115345136A CN 202210927881 A CN202210927881 A CN 202210927881A CN 115345136 A CN115345136 A CN 115345136A
Authority
CN
China
Prior art keywords
shape
shapes
target
graphic
list
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210927881.6A
Other languages
Chinese (zh)
Inventor
赖伟
叶鹏飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kingsoft Office Software Inc
Zhuhai Kingsoft Office Software Co Ltd
Wuhan Kingsoft Office Software Co Ltd
Original Assignee
Beijing Kingsoft Office Software Inc
Zhuhai Kingsoft Office Software Co Ltd
Wuhan Kingsoft Office Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Kingsoft Office Software Inc, Zhuhai Kingsoft Office Software Co Ltd, Wuhan Kingsoft Office Software Co Ltd filed Critical Beijing Kingsoft Office Software Inc
Priority to CN202210927881.6A priority Critical patent/CN115345136A/en
Publication of CN115345136A publication Critical patent/CN115345136A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/60Editing figures and text; Combining figures or text
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/24Character recognition characterised by the processing or recognition method
    • G06V30/242Division of the character sequences into groups prior to recognition; Selection of dictionaries
    • G06V30/244Division of the character sequences into groups prior to recognition; Selection of dictionaries using graphical properties, e.g. alphabet type or font
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/40Document-oriented image-based pattern recognition
    • G06V30/42Document-oriented image-based pattern recognition based on the type of document

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Artificial Intelligence (AREA)
  • Multimedia (AREA)
  • Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • General Engineering & Computer Science (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The embodiment of the invention provides a slide processing method, a slide processing device, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring a slide to be processed; determining a shape to be recognized in the slide to be processed, and acquiring the attribute of the shape to be recognized; identifying the graphic items illustrated in the slide to be processed according to the shape to be identified and the attribute; and converting the graphic items according to a preset graphic item data specification to obtain target graphic items of the target graphic. Therefore, the graphic items of the graphic in the slide are identified according to the shape to be identified and the attributes thereof in the slide, and are converted according to the corresponding graphic item data specifications to obtain the target graphic item, the target graphic item conforms to the graphic data specifications of the presentation manufacturer, and the presentation manufacturer can edit the graphic in the slide by using the online graphic function of the presentation manufacturer, thereby avoiding manual editing and simplifying the operation.

Description

Slide processing method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of automated office technologies, and in particular, to a method and an apparatus for processing a slide, an electronic device, and a storage medium.
Background
A presentation includes a plurality of pages, each page being a slide, for presenting static content (e.g., text, pictures) and dynamic content (e.g., video, audio). With the widespread use of presentations, there is a need for a producer to edit the icons in the slides when making the presentations because the icons in the slides do not conform to the intended effect.
In the related art, for the presentation in the hands of the creator, whether the presentation is created by the creator or downloaded from an online shopping mall, most presentations do not conform to the graphic data specification (for example, WPS graphic data specification) of the manufacturer of the presentation, so that the creator manually edits the graphic in the slide, which is quite cumbersome.
Disclosure of Invention
In order to solve the technical problem that the editing of the pictorial representation in the slide is manually edited by the producer and the operation is rather complicated because most of the presentation is not in accordance with the pictorial representation data specification (such as WPS pictorial representation data specification) of the presentation manufacturer, regardless of the presentation produced by the producer or downloaded from the online shopping mall, the embodiment of the invention provides a slide processing method, a slide processing device, an electronic device and a storage medium. The specific technical scheme is as follows:
in a first aspect of the embodiments of the present invention, there is provided a method for processing a slide, where the method includes:
acquiring a slide to be processed;
determining a shape to be recognized in the slide to be processed, and acquiring the attribute of the shape to be recognized;
identifying the graphic items illustrated in the slide to be processed according to the shape to be identified and the attribute;
and converting the graphic items according to a preset graphic item data specification to obtain target graphic items of the target graphic.
In an optional embodiment, the determining the shape to be recognized in the slide to be processed includes:
acquiring a shape array of the slide to be processed;
traversing the shapes in the shape array, and judging whether the shapes are visible or not;
adding the shape to a list of shapes to be recognized if the shape is visible;
determining the shape in the list of shapes to be recognized as the shape to be recognized in the slide to be processed.
In an optional embodiment, the identifying, according to the shape to be identified and the attribute, a pictorial item depicted in the slide to be processed includes:
determining graphic keyword groups and graphic component groups according to the shapes and the attributes in the shape list to be recognized;
and aggregating each graphic component group and the graphic keyword group to obtain the graphic items shown in the slide to be processed.
In an alternative embodiment, the attribute includes a shape type;
determining a graphic keyword group and each graphic component group according to the shape and the attribute in the shape list to be recognized, wherein the method comprises the following steps:
traversing the shapes in the shape list to be recognized, and judging whether the shape type of the shapes represents that the shapes are text shapes;
adding the shape to a list of text shapes if the shape type of the shape characterizes the shape as a text shape;
extracting a target shape from the shapes of the text shape list, and storing the target shape to a diagram keyword group;
determining other shapes in the shape list to be recognized, wherein the other shapes comprise the shapes in the shape list to be recognized except the target shape;
and grouping the rest shapes according to the shape types of the rest shapes to obtain each diagram component group.
In an optional embodiment, the attribute further includes text, and the information of the text includes at least one of: content, length, font size;
the extracting a target shape from the shapes of the text shape list, and storing the target shape to a diagram keyword group, includes:
traversing the shapes in the text shape list, and determining the shapes as reference shapes;
retrieving a first remaining shape that is the same as or similar to the information of the text of the reference shape;
wherein the first remaining shape comprises the shape in the list of text shapes other than the reference shape;
in a case where the first remaining shape is retrieved, the traversal is stopped, and the reference shape and the first remaining shape are stored as target shapes to the illustration key group.
In an optional embodiment, the extracting a target shape from the shapes in the text shape list and storing the target shape in a graphic keyword group further includes:
under the condition that the graphic keyword group is not empty, traversing second other shapes in the text shape list, and judging whether the second other shapes and the target shapes in the graphic keyword group are in layout balance;
wherein the second remaining shape comprises the shape in the text shape list other than the reference shape and the first remaining shape;
storing the second remaining shape as a target shape to the illustration keyword group when the second remaining shape and the target shape are layout balanced.
In an alternative embodiment, the attributes further include a location; the determining whether the second remaining shape is layout balanced with the target shape in the graph keyword group includes:
determining a center of gravity of the position of the second remaining shape and the position of the target shape in the pictorial keyword group;
determining a first circumscribed rectangle formed by the second remaining shape and the target shape in the graphic keyword group, and judging whether the gravity center is positioned on the geometric center, the horizontal center or the vertical center of the first circumscribed rectangle;
determining that the second remaining shape is layout balanced with the target shape in the illustration keyword group if the center of gravity is located on a geometric center, a horizontal center, or a vertical center of the first circumscribed rectangle.
In an optional implementation, the extracting a target shape from the shapes in the text shape list and storing the target shape in a diagram keyword group further includes:
in the case that the illustration keyword group is empty, traversing the shape in the text shape list, and determining the shape as a reference shape;
retrieving a first remaining shape that is balanced with the reference shape layout, wherein the first remaining shape comprises the shape in the text shape list other than the reference shape;
in a case where the first remaining shape is retrieved, the traversal is stopped, and the reference shape and the first remaining shape are stored as target shapes to the illustration key group.
In an alternative embodiment, the attributes further include a location; the retrieving a first remaining shape that balances with the reference shape layout comprises:
determining a center of gravity of the location of the first remaining shape and the location of the reference shape;
determining a second circumscribed rectangle formed by the first remaining shape and the reference shape, and judging whether the gravity center is positioned on the geometric center, the horizontal center or the vertical center of the second circumscribed rectangle;
determining that the first remaining shape is in layout balance with the reference shape with the center of gravity located on a geometric center, a horizontal center, or a vertical center of the second circumscribed rectangle.
In an alternative embodiment, said grouping said remaining shapes according to said shape types of said remaining shapes to obtain respective groups of illustrated components includes:
traversing the other shapes in the shape list to be recognized, and judging whether the shape types of the other shapes represent the other shapes to be graph shapes;
storing the rest shapes into a graph shape list under the condition that the shape types of the rest shapes represent that the rest shapes are graph shapes;
traversing the other shapes in the graph shape list, and judging whether the areas of the other shapes in the graph shape list are smaller than a preset first area threshold value or not;
retrieving the target rest shapes in the graph shape list, the first Euclidean distances between which and the rest shapes are smaller than a preset distance threshold value, under the condition that the areas of the rest shapes in the graph shape list are smaller than the preset first area threshold value;
merging the other shapes in the graph shape list with the other shapes of the target in the graph shape list to obtain a new shape;
determining a third rest shape in the shape list to be recognized, and adding the third rest shape and the new shape to an ungrouped shape list as ungrouped shapes;
wherein the third remaining shapes include the shapes in the list of shapes to be recognized excluding the target shape, the remaining shapes participating in merging, and the target remaining shape;
grouping the ungrouped shapes according to the shape types of the ungrouped shapes in the ungrouped shape list to obtain each illustrated component group.
In an alternative embodiment, the attributes further include a circumscribed rectangle;
said grouping said ungrouped shapes according to said shape type of said ungrouped shapes in said ungrouped shapes list to obtain respective groups of illustrated components, comprising:
traversing the ungrouped shapes in the ungrouped shape list, and retrieving whether other ungrouped shapes which are the same as the shape types of the ungrouped shapes and are the same as or similar to the circumscribed rectangles of the ungrouped shapes exist in the ungrouped shape list;
creating a group of diagram parts corresponding to the shape type in the ungrouped shape list if there are other ungrouped shapes that are the same as the shape type of the ungrouped shape and that are the same as or similar to a circumscribed rectangle of the ungrouped shape;
storing the ungrouped shapes in the ungrouped shape list and the other ungrouped shapes in the ungrouped shape list to the illustrated group of components.
In an optional embodiment, the aggregating each of the illustration component groups and the illustration keyword group to obtain the illustration item illustrated in the slide to be processed includes:
aggregating the graphic component groups and the graphic keyword groups one by one to obtain graphic item groups, and determining the shapes included in the graphic item groups as graphic items shown in a slide to be processed, wherein the number of the graphic item groups is the same as that of the target shapes in the graphic keyword groups;
wherein each of the illustration item groups includes a different shape, each of the illustration item groups includes a shape that is one of the target shapes in the illustration keyword group and one of the remaining shapes in each of the illustration component groups, and a sum of second euclidean distances between the shapes in each of the illustration item groups is smallest.
In an optional embodiment, the aggregating each of the illustration component groups and the illustration keyword group to obtain the illustration item illustrated in the slide to be processed includes:
determining a second Euclidean distance between the target shape and any of the rest shapes in each of the graphic component groups aiming at any of the target shapes in the graphic keyword groups;
and selecting the rest shapes in each graphic component group with the minimum second Euclidean distance from the target shape, and aggregating the rest shapes with the target shape to obtain graphic items shown in the slide to be processed.
In an optional embodiment, the aggregating each of the illustration component groups and the illustration keyword group to obtain the illustration item illustrated in the slide to be processed includes:
determining a third circumscribed rectangle formed by the target shape and any other shape in each diagram component group aiming at any target shape in the diagram keyword group;
and selecting the rest shapes in each graphic component group with the smallest third circumscribed rectangle formed by the selected shapes and the target shape, and aggregating the rest shapes with the target shape to obtain graphic items shown in the slide to be processed.
In an optional embodiment, the converting the pictorial item according to a preset pictorial item data specification to obtain a target pictorial item of a target diagram includes:
identifying textual and non-textual shapes in the pictorial item; the text shape comprises a title, a body and a section number, and the non-text shape comprises a pictorial item decoration;
and converting the text shape and the non-text shape according to a preset diagram item data specification to obtain a target diagram item of the target diagram.
In an optional embodiment, the converting the text shape and the non-text shape according to a preset illustration item data specification to obtain a target illustration item of the target illustration includes:
converting the section number according to a preset section number data standard to obtain a target section number of a target graphic; and/or the presence of a gas in the gas,
converting the title according to a preset title data specification to obtain a target title of a target graphic; and/or the presence of a gas in the gas,
converting the text according to a preset text data standard to obtain a target text of a target graphic; and/or the presence of a gas in the gas,
and converting the graphic item decoration according to a preset graphic item decoration data specification to obtain a target graphic item decoration of the target graphic.
In an optional embodiment, the method further comprises:
determining the shape contained in the diagram item, and searching a difference shape of the shape in the list of the shapes to be recognized, which is different from the shape contained in the diagram item;
identifying a pictorial decoration of the pictorial representation based on the differential shape;
and converting the graphic decoration according to a preset graphic decoration data specification to obtain the target graphic decoration of the target graphic.
In an alternative embodiment, said identifying the pictorial decoration of said diagram from said differential shape comprises:
judging whether the difference shape is a text shape or not under the condition that the difference shape is intersected with the circumscribed rectangle of the graph and the intersected area is larger than a preset second area threshold value;
in a case where the difference shape is a non-text shape, identifying the difference shape as a diagram decoration of the diagram.
In an alternative embodiment, said identifying the pictorial decoration of said diagram from said differential shape comprises:
determining that the difference shape is a linear shape when the height or width of the difference shape is less than a preset line width threshold value;
in a case where the linear shape intersects the circumscribed rectangle of the diagram, recognizing the difference shape as a diagram decoration of the diagram.
In a second aspect of the embodiments of the present invention, there is also provided a slide processing apparatus, including:
the slide acquiring module is used for acquiring slides to be processed;
the shape to be recognized determining module is used for determining the shape to be recognized in the slide to be processed;
the attribute acquisition module is used for acquiring the attribute of the shape to be identified;
the figure item identification module is used for identifying figure items shown in the slide to be processed according to the shape to be identified and the attribute;
and the graphic item conversion module is used for converting the graphic items according to a preset graphic item data specification to obtain target graphic items of the target graphic.
In an optional embodiment, the shape determining module to be recognized is specifically configured to:
acquiring a shape array of the slide to be processed;
traversing the shapes in the shape array, and judging whether the shapes are visible or not;
adding the shape to a list of shapes to be recognized if the shape is visible;
determining the shape in the list of shapes to be recognized as the shape to be recognized in the slide to be processed.
In an optional embodiment, the pictorial item identification module specifically includes:
the grouping determination submodule is used for determining graphic keyword groups and graphic component groups according to the shapes and the attributes in the shape list to be recognized;
and the grouping and aggregating submodule is used for aggregating the graphic component groups and the graphic keyword group to obtain the graphic items shown in the slide to be processed.
In an alternative embodiment, the attribute includes a shape type; the grouping determination sub-module specifically includes:
the shape judging unit is used for traversing the shapes in the shape list to be recognized and judging whether the shape type of the shapes represents that the shapes are text shapes;
a shape adding unit, configured to add the shape to a text shape list if the shape type of the shape characterizes the shape as a text shape;
a shape extraction unit configured to extract a target shape from the shapes of the text shape list, and store the target shape to a diagram keyword group;
a remaining shape determining unit, configured to determine remaining shapes in the to-be-recognized shape list, where the remaining shapes include the shapes in the to-be-recognized shape list other than the target shape;
and the other shape grouping unit is used for grouping the other shapes according to the shape types of the other shapes to obtain each figure component group.
In an optional embodiment, the attribute further includes text, and the information of the text includes at least one of: content, length, font size;
the shape extraction unit includes:
a shape traversal first subunit, configured to traverse the shapes in the text shape list, and determine that the shapes are reference shapes;
a shape retrieval first subunit for retrieving a first remaining shape that is the same as or similar to the information of the text of the reference shape;
wherein the first remaining shape comprises the shape in the list of text shapes other than the reference shape;
a shape storage first subunit, configured to, in a case where the first remaining shape is retrieved, stop traversal, and store the reference shape and the first remaining shape as target shapes in the illustration keyword group.
In an optional embodiment, the shape extraction unit further comprises:
a shape traversal second subunit, configured to, when the illustration keyword group is not empty, traverse a second remaining shape in the text shape list, and determine whether the second remaining shape is balanced in layout with the target shape in the illustration keyword group;
wherein the second remaining shape comprises the shape in the text shape list other than the reference shape and the first remaining shape;
a shape storage second subunit operable to store the second remaining shape as a target shape to the illustration keyword group in a case where the second remaining shape is balanced with the target shape layout.
In an alternative embodiment, the attributes further include a location; the shape traversal second subunit is specifically configured to:
determining a center of gravity of the position of the second remaining shape and the position of the target shape in the illustration keyword group;
determining a first circumscribed rectangle formed by the second remaining shape and the target shape in the graph keyword group, and judging whether the gravity center is located on the geometric center, the horizontal center or the vertical center of the first circumscribed rectangle;
determining that the second remaining shape is layout balanced with the target shape in the illustration keyword group if the center of gravity is located on a geometric center, a horizontal center, or a vertical center of the first circumscribed rectangle.
In an alternative embodiment, the shape extraction unit includes:
a shape traversal third subunit, configured to, in a case where the illustration keyword group is empty, traverse the shape in the text shape list, and determine that the shape is a reference shape;
a shape retrieval second subunit for retrieving a first remaining shape balanced with the reference shape layout, wherein the first remaining shape includes the shapes in the text shape list other than the reference shape;
and a third shape storage subunit, configured to, in a case where the first remaining shape is retrieved, stop traversal, and store the reference shape and the first remaining shape as target shapes in the illustration keyword group.
In an alternative embodiment, the attributes further include a location; the shape retrieval second subunit is specifically configured to:
determining a center of gravity of the location of the first remaining shape and the location of the reference shape;
determining a second external rectangle formed by the first rest shape and the reference shape, and judging whether the gravity center is positioned on the geometric center, the horizontal center or the vertical center of the second external rectangle;
determining that the first remaining shape is in layout balance with the reference shape with the center of gravity located on a geometric center, a horizontal center, or a vertical center of the second circumscribed rectangle.
In an alternative embodiment, the remaining shape grouping units include:
a graph shape judging subunit, configured to traverse the other shapes in the to-be-identified shape list, and judge whether the shape types of the other shapes represent the other shapes as graph shapes;
a graph shape storage subunit, configured to store the remaining shapes into a graph shape list when the shape type of the remaining shapes represents that the remaining shapes are graph shapes;
the area judgment subunit is configured to traverse the other shapes in the graph shape list, and judge whether the areas of the other shapes in the graph shape list are smaller than a preset first area threshold;
a shape retrieval subunit, configured to, in a case that the area of the remaining shapes in the graph shape list is smaller than the preset first area threshold, retrieve a target remaining shape in the graph shape list whose first euclidean distance from the remaining shapes is smaller than a preset distance threshold;
a shape merging subunit, configured to merge the other shapes in the graph shape list with the other target shapes in the graph shape list to obtain a new shape;
an ungrouped shape determining subunit, configured to determine a third remaining shape in the to-be-recognized shape list, and add the third remaining shape and the new shape to the ungrouped shape list as ungrouped shapes;
wherein the third remaining shapes include the shapes in the list of shapes to be recognized except the target shape, the remaining shapes participating in merging, and the target remaining shapes;
and the shape grouping subunit is used for grouping the ungrouped shapes according to the shape types of the ungrouped shapes in the ungrouped shape list to obtain each diagram component group.
In an alternative embodiment, the attributes further include a circumscribed rectangle; the shape grouping subunit is specifically configured to:
traversing the ungrouped shapes in the ungrouped shape list, and retrieving whether other ungrouped shapes which are the same as the shape types of the ungrouped shapes and are the same as or similar to the circumscribed rectangles of the ungrouped shapes exist in the ungrouped shape list;
creating a group of diagram parts corresponding to the shape type in a case where there is another ungrouped shape that is the same as the shape type of the ungrouped shape and is the same as or similar to a circumscribed rectangle of the ungrouped shape in the ungrouped shape list;
storing the ungrouped shapes in the ungrouped shape list and the other ungrouped shapes in the ungrouped shape list to the illustrated group of components.
In an optional embodiment, the packet aggregation sub-module is specifically configured to:
aggregating the graphic component groups and the graphic keyword groups one by one to obtain graphic item groups, and determining the shapes included in the graphic item groups as graphic items illustrated in a slide to be processed, wherein the number of the graphic item groups is the same as that of the target shapes in the graphic keyword groups;
wherein each of the illustration item groups includes a different shape, each of the illustration item groups includes a shape that is one of the target shapes in the illustration keyword group and one of the remaining shapes in each of the illustration component groups, and a sum of second euclidean distances between the shapes in each of the illustration item groups is smallest.
In an optional embodiment, the packet aggregation sub-module is specifically configured to:
determining a second Euclidean distance between the target shape and any other shape in each graph component group aiming at any target shape in the graph keyword group;
and selecting the rest shapes in each graphic component group with the minimum second Euclidean distance from the target shape, and aggregating the rest shapes with the target shape to obtain graphic items shown in the slide to be processed.
In an optional embodiment, the packet aggregation sub-module is specifically configured to:
determining a third circumscribed rectangle formed by the target shape and any other shape in each diagram component group aiming at any target shape in the diagram keyword group;
and selecting the rest shapes in each graphic component group with the smallest third circumscribed rectangle formed by the selected shapes and the target shape, and aggregating the rest shapes with the target shape to obtain graphic items shown in the slide to be processed.
In an optional implementation manner, the pictorial item conversion module specifically includes:
a pictorial item recognition sub-module for recognizing textual shapes and non-textual shapes in the pictorial item; the text shape comprises a title, a body and a section number, and the non-text shape comprises a pictorial item decoration;
and the pictorial item conversion submodule is used for converting the text shape and the non-text shape according to a preset pictorial item data specification to obtain a target pictorial item of the target pictorial.
In an optional embodiment, the pictorial item conversion sub-module is specifically configured to: converting the section number according to a preset section number data specification to obtain a target section number of a target graphic; and/or the presence of a gas in the gas,
converting the title according to a preset title data specification to obtain a target title of a target graphic representation; and/or the presence of a gas in the atmosphere,
converting the text according to a preset text data standard to obtain a target text of a target graphic; and/or the presence of a gas in the atmosphere,
and converting the graphic item decoration according to a preset graphic item decoration data specification to obtain a target graphic item decoration of the target graphic.
In an optional embodiment, the apparatus further comprises:
the difference shape determining module is used for determining the shape contained in the diagram item, and searching for a difference shape with a difference between the shape in the list of the shapes to be recognized and the shape contained in the diagram item;
the decoration identification module is used for identifying the diagram decoration of the diagram according to the difference shape;
and the decoration conversion module is used for converting the graphic decoration according to a preset graphic decoration data specification to obtain the target graphic decoration of the target graphic.
In an optional embodiment, the decoration identification module is specifically configured to:
judging whether the difference shape is a text shape or not under the condition that the difference shape is intersected with the circumscribed rectangle of the graph and the intersected area is larger than a preset second area threshold value;
in a case where the difference shape is a non-text shape, identifying the difference shape as a diagram decoration of the diagram.
In an alternative embodiment, the decoration identification module is specifically configured to:
determining that the difference shape is a linear shape when the height or width of the difference shape is smaller than a preset line width threshold value;
and in the case that the linear shape and the circumscribed rectangle of the diagram intersect, identifying the difference shape as the diagram decoration of the diagram.
In a third aspect of the embodiments of the present invention, there is further provided an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
a memory for storing a computer program;
a processor configured to implement the slide processing method according to any one of the first aspect described above when executing a program stored in a memory.
In a fourth aspect of the embodiments of the present invention, there is also provided a storage medium having instructions stored therein, which when run on a computer, cause the computer to perform the slide processing method according to any one of the first aspects.
In a fifth aspect of the embodiments of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform any of the slide processing methods described above.
According to the technical scheme provided by the embodiment of the invention, the slide to be processed is obtained, the shape to be recognized in the slide to be processed is determined, the attribute of the shape to be recognized is obtained, the graphic item of the graphic in the slide to be processed is recognized according to the shape to be recognized and the attribute, and the graphic item is converted according to the preset graphic item data specification to obtain the target graphic item of the target graphic. Therefore, the graphic items of the graphic in the slide are identified according to the shape to be identified and the attributes thereof in the slide, and are converted according to the corresponding graphic item data specifications to obtain the target graphic item, the target graphic item conforms to the graphic data specifications of a demonstration manuscript manufacturer, and the demonstration manuscript producer can edit the graphic in the slide by using the online graphic function of the demonstration manuscript manufacturer, so that the manual editing is avoided, and the operation is simplified.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
Fig. 1 is a schematic flow chart illustrating an implementation of a slide processing method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of pictorial items illustrated in a slide show in an embodiment of the present invention;
fig. 3 is a schematic flowchart illustrating another slide processing method according to an embodiment of the present invention;
fig. 4 is a schematic flowchart of an implementation of a target shape extraction method according to an embodiment of the present invention;
fig. 5 is a schematic flow chart illustrating another implementation of the target shape extraction method in the embodiment of the present invention;
FIG. 6 is a schematic diagram of a slide shown in an embodiment of the present invention;
FIG. 7 is a schematic illustration of the center of gravity of three text shapes in a slide show at the horizontal center of their bounding rectangle in an embodiment of the present invention;
fig. 8 is a schematic flow chart illustrating an implementation of a layout balance determination method according to an embodiment of the present invention;
fig. 9 is a schematic flow chart of an implementation of a grouping method shown in the embodiment of the present invention;
FIG. 10 is a schematic view of a shape merge shown in an embodiment of the present invention;
fig. 11 is a schematic flowchart illustrating another implementation of the grouping method in the embodiment of the present invention;
FIG. 12 is a schematic flow chart of an embodiment of a packet polymerization method according to the present invention;
FIG. 13 is a schematic illustration of a packet polymerization shown in an embodiment of the present invention;
fig. 14 is a schematic flowchart illustrating another implementation of a packet aggregation method according to an embodiment of the present invention;
FIG. 15 is a flow chart illustrating an implementation of a pictorial item conversion method, as shown in an embodiment of the present invention;
fig. 16 is a flowchart illustrating another slide processing method according to another embodiment of the present invention;
FIG. 17 is a flow chart illustrating an implementation of a decoration identification method according to an embodiment of the present invention;
FIG. 18 is a schematic view of the decoration illustrated in one of the illustrations shown in an embodiment of the present invention;
FIG. 19 is a flow chart illustrating another implementation of a decoration identification method according to an embodiment of the present invention;
FIG. 20 is a schematic view of the decoration illustrated in another illustration shown in an embodiment of the present invention;
fig. 21 is a schematic structural diagram of a slide processing apparatus shown in an embodiment of the present invention;
fig. 22 is a schematic structural diagram of an electronic device shown in the embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, are within the scope of the present invention.
First, the abbreviations and key terms involved in the embodiments of the present invention are explained:
the PPT diagram refers to a text graphic schematic, namely, logic and auxiliary communication are expressed through intuitively understandable graphs. The diagram in PPT illustrates one of the main differences between designers PPT and Word.
The PPT diagram item refers to a group formed by shape polymerization in the PPT diagram, and one diagram is formed by at least two diagram items.
The WPS online graphic function refers to a graphic function provided by PPT software of the WPS, and has four functions of changing the number of items, changing the color, demonstrating animation and changing the style. Due to the one-button operation, the graphic editing efficiency is greatly improved, and meanwhile, online resources are continuously updated, so that the visual effect is diversified.
The WPS graphic data specification is a graphic data structure definition of a PPT product of a WPS, is only effective in the PPT product of the WPS and is not compatible with a non-WPS PPT product at present. The WPS online illustration function can only be used on PPT documents that meet the WPS illustration data specification.
The PPT shapes refer to basic elements forming PPT demonstration, and are mainly divided into the following categories according to functions:
text shapes refer to elements of the slide where a user can enter text. The viewer may obtain the author's expression directly from the text content. It is used in the figures as a title, description, figure item number, etc.
Picture shapes, which refer to picture elements in a slide, are typically used as a background or to guide the schematic information in conjunction with text. Which in the illustration is generally a one-piece decoration.
The figure shape refers to a figure formed by combining line segments, rectangles, circles and the like in the slide into a geometric figure. Used as icons of different sizes in the slides. Which in the illustration is generally an item decoration.
The shape attribute refers to basic information of a shape in the PPT, and the attribute used in the embodiment of the present invention includes: shape type, text, position, size, circumscribed rectangle, whether visible or not. The above attributes can be obtained through a secondary development interface of the WPS Office VBA or the Microsoft Office VBA.
As shown in fig. 1, an implementation flow diagram of a slide processing method provided in an embodiment of the present invention is applied to an electronic device, and the method may specifically include the following steps:
s101, obtaining a slide to be processed.
In the embodiment of the present invention, in the case that the slide does not satisfy the illustration data specification of the presentation manufacturer, the slide may be determined to be a slide to be processed, so that the slide to be processed may be obtained so as to satisfy the illustration data specification of the presentation manufacturer through subsequent processing.
It should be noted that the slide to be processed may be any slide in the presentation, and the type of the diagram in the slide includes, but is not limited to, a tile (used by the user to express a document outline, a directory, etc.), a flow (used by the user to express an action, a logical sequence), and a time axis (used by the user to express a time-series structure), which is not limited by the embodiment of the present invention.
S102, determining the shape to be recognized in the slide to be processed, and acquiring the attribute of the shape to be recognized.
In the embodiment of the present invention, for the slide to be processed, a plurality of shapes may be included therein, so that the shape to be recognized in the slide to be processed may be determined, where the shape to be recognized may be a plurality of shapes, and the attribute of the shape to be recognized is obtained accordingly.
For example, slide 1 is to be processed, which includes shape 1, shape 2, shape 3, \8230, etc., and the shape to be recognized in slide 1 is determined and the attribute of the shape to be recognized is obtained accordingly.
S103, identifying the graphic item shown in the slide to be processed according to the shape to be identified and the attribute.
In the embodiment of the present invention, for the shape to be recognized in the slide and the attribute of the shape to be recognized, the pictorial items depicted in the slide to be processed may be recognized according to the shape to be recognized and the attribute, where the pictorial items may be multiple.
For example, the shape to be recognized in the slide: shape 1, shape 2, shape 3, \8230, etc., and identifies a pictorial item illustrated in a slide to be processed, as shown in fig. 2, based on the above-described shape to be identified and its attribute.
S104, converting the graphic item according to a preset graphic item data specification to obtain a target graphic item of the target graphic.
In the embodiment of the invention, for the pictorial item illustrated in the slide, the pictorial item can be converted according to the preset pictorial item data specification, so that the target pictorial item of the target illustration can be obtained, and the target pictorial item can meet the pictorial item data specification.
For example, for a pictorial item illustrated in the slide shown in fig. 2, the pictorial item illustrated in the slide shown in fig. 2 can be transformed with reference to the WPS-related pictorial item data specification to obtain a target pictorial item for the target illustration so that the target pictorial item can satisfy the WPS-related pictorial item data specification.
Through the above description of the technical solution provided by the embodiment of the present invention, a slide to be processed is obtained, a shape to be recognized in the slide to be processed is determined, attributes of the shape to be recognized are obtained, a pictorial item shown in the slide to be processed is recognized according to the shape to be recognized and the attributes, and the pictorial item is converted according to a preset pictorial item data specification, so as to obtain a target pictorial item of a target diagram.
Therefore, the graphic items of the graphic in the slide are identified according to the shape to be identified and the attributes thereof in the slide, and are converted according to the corresponding graphic item data specifications to obtain the target graphic item, the target graphic item conforms to the graphic data specifications of a demonstration manuscript manufacturer, and the demonstration manuscript producer can edit the graphic in the slide by using the online graphic function of the demonstration manuscript manufacturer, so that the manual editing is avoided, and the operation is simplified.
Furthermore, in the embodiment of the present invention, in the step S102, the shape to be recognized in the slide to be processed is determined, specifically, the shape in the shape array may be traversed, whether the shape is visible or not is determined, if the shape is visible, the shape is added to the shape list to be recognized, and the shape in the shape list to be recognized is determined to be the shape to be recognized in the slide to be processed. The specific implementation flow here is described in the following fig. 3.
In step S103, the graphic items shown in the slide to be processed are identified according to the shape and the attribute to be identified, specifically, the graphic item shown in the slide to be processed may be obtained by determining a graphic keyword group and each graphic component group according to the shape and the attribute in the shape list to be identified, and aggregating each graphic component group and the graphic keyword group. The specific implementation flow here is described in the following fig. 3.
As shown in fig. 3, an implementation flow diagram of another slide processing method provided in an embodiment of the present invention is applied to an electronic device, and the method may specifically include the following steps:
s301, acquiring a slide to be processed.
In the embodiment of the present invention, this step is similar to the step S101, and the details of the embodiment of the present invention are not repeated herein.
S302, acquiring the shape array of the slide to be processed.
S303, traversing the shapes in the shape array, and judging whether the shapes are visible or not.
S304, adding the shape to a list of shapes to be recognized under the condition that the shape is visible.
S305, determining the shape in the shape list to be recognized as the shape to be recognized in the slide to be processed, and acquiring the attribute of the shape to be recognized.
In the embodiment of the invention, for PPT products, a VBA interface can be used for accessing all elements on the slide. Therefore, the shape array of the slide to be processed can be obtained through the VBA interface, and the shape array includes all elements on the slide to be processed, that is, the shape array can be regarded as a set of all shapes on the slide to be processed.
For a shape array, a shape in the shape array may be traversed to determine whether the shape is visible. In which, for a slide to be processed, when a user designs the slide to be processed, some shapes are set to be hidden or displayed, and are visible if displayed, so that it is possible to judge whether the shapes are visible or not by the attribute (whether displayed) of the shapes here.
In the case where the shape is visible, the shape is added to the list of shapes to be recognized. After traversing the shapes in the shape array, the visible shapes in the shape array can be added to the shape list to be recognized, and at this time, the shapes in the shape list to be recognized can be determined to be the shapes to be recognized in the slide to be processed, so that the attributes of the shapes to be recognized are obtained, namely the attributes of the shapes in the shape list to be recognized are obtained.
It should be noted that, the obtaining of the shape attribute to be recognized, that is, the obtaining of the shape attribute in the shape list to be recognized, may also be performed after the shape is determined to be visible, that is, if the shape is visible, the attribute of the shape may be obtained, and the shape is added to the shape list to be recognized, so that after the shape in the shape array is traversed, the visible shape in the shape array may be added to the shape list to be recognized, and the obtaining of the attribute of the corresponding visible shape is also completed.
For example, slide 1, i.e., the slide to be processed, obtains the shape array of slide 1, which includes all shapes on slide 1: the method comprises the steps of traversing a shape 1 in a shape array, judging whether the shape 1 is visible, if the shape 1 is visible, acquiring the attribute of the shape 1, adding the shape 1 to a shape list to be recognized, traversing a shape 2 in the shape array, judging whether the shape 2 is visible, if the shape 2 is visible, acquiring the attribute of the shape 2, adding the shape 2 to the shape list to be recognized, and repeating the steps until the shape in the shape array is traversed, wherein the visible shape in the shape array can be added to the shape list to be recognized, and therefore the shape in the shape list to be recognized can be determined to be the shape to be recognized in the slide 1.
S306, traversing the shape in the shape list to be recognized, and judging whether the shape type of the shape represents that the shape is a text shape.
S307, if the shape type of the shape represents that the shape is a text shape, adding the shape to a text shape list.
S308, extracting a target shape from the shapes in the text shape list, and storing the target shape to a graphic keyword group.
In the embodiment of the invention, for the shape to be recognized in the slide to be processed, namely, the shape in the shape list to be recognized may be multiple, and the attribute of the shape may include a shape type, and the shape type may represent that the shape is a text shape, a picture shape, or a graphic shape.
And traversing the shape in the shape list to be recognized, judging whether the shape type of the shape represents that the shape is a text shape, and adding the shape to the text shape list under the condition that the shape type of the shape represents that the shape is the text shape. After the shapes in the shape list to be recognized are traversed in this way, the shapes belonging to the text shapes in the shape list to be recognized can be added to the text shape list. For the text shape list, a target shape, i.e., a target text shape in which a pictorial keyword is represented, may be extracted from the shapes of the text shape list, whereby the target shape may be added to the pictorial keyword group.
It should be noted that the shape type here can be generally understood as a section number, a title, and a body, where the section number, the title, and the body are elements in a diagram item, and if the shape type of the shape is any one of the section number, the title, and the body, the shape can be characterized as a text shape, so that it can be ensured that the extracted target shape (i.e., the target text shape) can represent a diagram keyword.
For example, the shape in the list of shapes to be recognized: the method comprises the steps of traversing a shape 1 in a shape list to be recognized, judging whether the shape type of the shape 1 represents that the shape 1 is a text shape, adding the shape 1 to the text shape list under the condition that the shape type representation shape 1 of the shape 1 is the text shape, traversing a shape 2 in the shape list to be recognized, judging whether the shape type of the shape 2 represents that the shape 2 is the text shape, adding the shape 2 to the text shape list under the condition that the shape type representation shape 2 of the shape 2 is the text shape, circulating in this way, and adding a shape belonging to the text shape in the shape list to be recognized to the text shape list after traversing the shape in the shape list to be recognized. A target shape representing the illustration keyword (i.e., a target text shape) is extracted from the shapes of the text shape list, and the target shape is added to the illustration keyword group.
As shown in fig. 4, an implementation flow diagram of a target shape extraction method provided in an embodiment of the present invention is shown, where the method may be applied to an electronic device, and specifically may include the following steps:
s401, traversing the shapes in the text shape list, and determining that the shapes are reference shapes.
S402, retrieving a first remaining shape that is the same as or similar to the information of the text of the reference shape.
Wherein the first remaining shape comprises the shape in the list of text shapes other than the reference shape;
s403, when the first remaining shape is retrieved, stopping traversal, and storing the reference shape and the first remaining shape as target shapes in the graph keyword group.
In the embodiment of the present invention, shapes in the text shape list are all text shapes, and it is necessary to extract a target shape from the shapes in the text shape list and store the target shape in the graphic keyword group. In addition, as for the attribute of the shape, text can be further included, and the information of the text includes at least one of the following: content, length, font size.
Based on this, the shapes in the text shape list may be traversed, the shape may be determined to be the reference shape, and then a first remaining shape that is the same as or similar to the information of the text of the reference shape may be retrieved, where the first remaining shape includes shapes in the text shape list other than the reference shape, and in a case where the first remaining shape is retrieved, the traversal is stopped, and the reference shape and the first remaining shape are stored as the target shape to the illustration keyword group.
After traversing the shapes in the text shape list, the shapes with the same or similar information in the text shape list can be added to the illustration keyword group, that is, a group of text shapes with the same or similar information in the text shape list is stored in the illustration keyword group, and the group of text shapes with the same or similar information in the text represents a group of keywords in the illustration and correspondingly represents the number of illustration items in the illustration.
It should be noted that, the same information of the text may be understood that the text content, the text length, the text font, and the text font size are completely the same, and the information of the text is similar, and may be understood that the text content, the text length, the text font, and the text font size are similar, for example, the number (the number is, for example, arabic numerals 1, 2, 3, or chinese numerals one, two, and three, or alphabetical numerals a, B, and C, or english numerals one, two, and three, etc.) may be regarded as the text content, the text length, the text font, and the text font size are similar.
For example, traversing shape 1 in the text shape list, determining shape 1 as a reference shape, then retrieving a first remaining shape in the text shape list that is the same as or similar to the information of the text of the reference shape, if not, continuing to traverse shape 2 in the text shape list, determining shape 2 as a reference shape, then retrieving a first remaining shape in the text shape list that is the same as or similar to the information of the text of the reference shape, and so on until traversing shape N in the text shape list, determining shape N as a reference shape, retrieving a first remaining shape in the text shape list that is the same as or similar to the information of the text of the reference shape, stopping the traversal, storing the reference shape and the first remaining shape as target shapes into the set of illustration keywords, or traversing to a last shape in the text shape list, determining the last shape as a reference shape, and still not retrieving a first remaining shape in the text shape list that is the same as or similar to the information of the text of the reference shape, stopping the traversal, and explaining that there is no information of the same as or similar to the text of the reference shape.
In addition, after traversing the shapes in the text shape list, the shapes with the same or similar information of the texts in the text shape list may be added to the illustration keyword group, which means that the illustration keyword group is not empty, at this time, the illustration keyword group may be supplemented continuously, that is, when the illustration keyword group is not empty, traversing a second remaining shape in the text shape list, and determining whether the second remaining shape and the target shape in the illustration keyword group are in layout balance, where the second remaining shape includes shapes other than the reference shape and the first remaining shape in the text shape list, and when the second remaining shape and the target shape in the illustration keyword group are in layout balance, storing the second remaining shape as the target shape in the illustration keyword group.
The attribute may further include a position, and based on this, it may be determined whether the second remaining shape is layout-balanced with the target shape in the illustration keyword group, that is, a center of gravity formed by the position of the second remaining shape and the position of the target shape in the illustration keyword group is determined, a first circumscribed rectangle formed by the second remaining shape and the target shape in the illustration keyword group is determined, whether the center of gravity is located at a geometric center, a horizontal center, or a vertical center of the first circumscribed rectangle is determined, and in a case where the center of gravity is located at the geometric center, the horizontal center, or the vertical center of the first circumscribed rectangle, it is determined that the second remaining shape is layout-balanced with the target shape in the illustration keyword group. Here, in the case where the barycenter constituted by the position of the second remaining shape and the position of the target shape in the illustration keyword group is located on the geometric center, the horizontal center, or the vertical center of the first circumscribed rectangle, meaning that the barycenter satisfies any of the above-described cases, it is possible to determine that the second remaining shape is in layout balance with the target shape in the illustration keyword group.
For example, the centroid formed by the position of the second remaining shape and the position of the object shape in the illustration keyword group is determined, the first circumscribed rectangle formed by them (i.e., the second remaining shape and the object shape in the illustration keyword group) is determined, it is determined whether the centroid is located on the geometric center of the first circumscribed rectangle, and in the case where the centroid is located on the geometric center of the first circumscribed rectangle, it is determined that the second remaining shape is in layout balance with the object shape in the illustration keyword group.
Alternatively, the centroid formed by the position of the second remaining shape and the position of the target shape in the illustration keyword group is determined, a first circumscribed rectangle formed by them (i.e., the second remaining shape and the target shape in the illustration keyword group) is determined, it is determined whether the centroid is located at the horizontal center of the first circumscribed rectangle, and in the case where the centroid is located at the horizontal center of the first circumscribed rectangle, it is determined that the second remaining shape is in layout balance with the target shape in the illustration keyword group.
Alternatively, the barycenter formed by the position of the second remaining shape and the position of the target shape in the illustration keyword group is determined, the first circumscribed rectangle formed by them (i.e., the second remaining shape and the target shape in the illustration keyword group) is determined, it is judged whether the barycenter is located on the vertical center of the first circumscribed rectangle, and in the case where the barycenter is located on the vertical center of the first circumscribed rectangle, it is determined that the second remaining shape is in layout balance with the target shape in the illustration keyword group.
It should be noted that, using the above-mentioned rules, the drawings in which the text content, the text length, the text font, and the text font size are the same or similar, such as the slide shown in fig. 2, in which the text content, the text length, the text font, and the text font size are the same or similar, can be processed. However, for graphics with different or similar text contents, text lengths, text fonts and text font sizes, additional rules are required for processing, which means that after traversing the shapes in the text shape list, no shapes with the same or similar text information are retrieved, and the graphics keyword group is empty.
Specifically, as shown in fig. 5, an implementation flow diagram of another target shape extraction method provided in the embodiment of the present invention is shown, where the method may be applied to an electronic device, and specifically may include the following steps:
s501, under the condition that the graphic keyword group is empty, traversing the shape in the text shape list, and determining that the shape is a reference shape.
S502, retrieving a first remaining shape balanced with the reference shape layout, wherein the first remaining shape comprises the shapes in the text shape list except the reference shape.
S503, when the first remaining shape is retrieved, stopping the traversal, and storing the reference shape and the first remaining shape as the target shape in the graph keyword group.
In the embodiment of the present invention, when the illustration keyword group is empty, it indicates that the same or similar shape of the text information is not retrieved after traversing the shapes in the text shape list, which means that the text content, the text length, the text font, and the text font size of the illustration in the slide are different or similar, and at this time, it is necessary to retrieve the shape with balanced illustration layout in the slide and store the shape as the target shape in the illustration keyword group.
Based on this, in the case where the illustration keyword group is empty, the shape in the text shape list is traversed, the shape is determined to be the reference shape, a first remaining shape balanced with the layout of the reference shape is retrieved, wherein the first remaining shape includes shapes other than the reference shape in the text shape list, in the case where the first remaining shape is retrieved, the traversal is stopped, and the reference shape and the first remaining shape are stored as the target shape to the illustration keyword group.
For example, as shown in the slide shown in fig. 6, there are text shape 1 "directory", text shape 2 "emergency prevention and control group", text shape 3 "prevention and control work after the first day of study", and text shape 4 "daily prevention and control work after the study", so after traversing the shapes (all text shapes) in the text shape list, there is no shape with the same or similar information as the text, and the illustration keyword group is empty, in this case, text shape 1 in the text shape list is traversed, text shape 1 is determined as a reference shape, the first remaining shapes (i.e., remaining text shapes) balanced with the layout of the reference shape are retrieved, and if not retrieved, text shape 2 in the text shape list is traversed, text shape 2 is determined as a reference shape, the first remaining shapes (i.e., remaining text shapes) balanced with the layout of the reference shape are retrieved, text shape 3, text shape 4 is retrieved, and text shape 2, text shape 3, and text shape 4 are stored as target shapes in the illustration keyword group.
It should be noted that, by using the above rules, the graphic representation that the text content, the text length, the text font size are different or similar, but the text shape is overall layout balanced, so that a group of text shapes that are overall layout balanced can be stored in the graphic keyword group, and this group of text shapes that are overall layout balanced represents a group of keywords in the graphic representation, and correspondingly represents the number of graphic items in the graphic representation.
For layout balance, it is understood that the geometric center points of the shapes constitute the center of gravity on the geometric center, horizontal center, or vertical center of their circumscribed rectangle. The centroid formed by the geometric center points of the plurality of shapes is understood to be the centroid formed by the geometric center points of the plurality of shapes, and the sum of vectors formed from the centroid to the geometric center points of the respective shapes is zero. As shown in fig. 7, the text contents of illustration keywords in the text shapes of the three illustration items of the slide show are different, but the centers of gravity of the three text shapes are at the horizontal centers of their circumscribed rectangles, that is, the visual horizontal centers, so that the three text shapes can be stored into the illustration keyword group.
Based on this, as shown in fig. 8, an implementation flow diagram of a layout balance determination method provided in an embodiment of the present invention is shown, where the method is applied to an electronic device, and specifically includes the following steps:
s801, determining a center of gravity formed by the position of the first remaining shape and the position of the reference shape.
S802, determining a second external rectangle formed by the first rest shape and the reference shape, and judging whether the gravity center is positioned on the geometric center, the horizontal center or the vertical center of the second external rectangle.
S803, determining that the first remaining shape is layout balanced with the reference shape in a case where the center of gravity is located on a geometric center, a horizontal center, or a vertical center of the second circumscribed rectangle.
In the embodiment of the present invention, for the attribute, a position is also included, where the position refers to a geometric center point of the shape.
Thus, a center of gravity formed by the position of the first remaining shape and the position of the reference shape is determined, a second circumscribed rectangle formed by the first remaining shape and the reference shape is determined, it is judged whether the center of gravity is located on the geometric center, the horizontal center, or the vertical center of the second circumscribed rectangle, and in the case where the center of gravity is located on the geometric center, the horizontal center, or the vertical center of the second circumscribed rectangle, it is determined that the first remaining shape is in layout balance with the reference shape.
S309, determining the rest shapes in the shape list to be recognized, wherein the rest shapes comprise the shapes except the target shape in the shape list to be recognized.
In the embodiment of the invention, the rest shapes in the shape list to be recognized are determined, and the rest shapes comprise the shapes except the target shape in the shape list to be recognized. It means that, after the above-described processing, a part of the shapes is included in the illustrated keyword group, and at this time, the remaining shapes in the list to be recognized except for the shapes in the illustrated keyword group can be determined.
S310, grouping the rest shapes according to the shape types of the rest shapes to obtain each diagram component group.
In the embodiment of the present invention, the remaining shapes in the shape list to be recognized may be grouped according to the shape types of the remaining shapes in the shape list to be recognized, so as to obtain each diagram component group. In the grouping process, the attributes (namely the sizes) of the other shapes can be used for dividing the other shapes with the same type (text shape, picture shape and graph shape) and the same or similar size into a group, so that various diagram component groups can be obtained, and the shapes of the other shapes in different diagram component groups are different in type.
In addition, for the graphic item of the graphic, the graphic item decoration is included, namely the graphic shape is the graphic item decoration, and the graphic item decoration is a small icon which is formed by combining geometric figures and is visualized by the user for the graphic item. Due to the diversity of the shapes of the user design graphs, part of the users use the combination mode, and part of the users do not use the combination mode. Therefore, before the grouping step is executed, the graph shapes with smaller areas and smaller Euclidean distances among the shapes are combined, so that the subsequent grouping processing is accelerated, and a plurality of redundant shapes are prevented from being grouped.
Specifically, as shown in fig. 9, an implementation flow diagram of a grouping method provided in the embodiment of the present invention is shown, where the method specifically includes the following steps:
s901, traversing the other shapes in the shape list to be recognized, and judging whether the shape types of the other shapes represent that the other shapes are graph shapes.
S902, storing the other shapes into a graph shape list under the condition that the shape types of the other shapes represent that the other shapes are graph shapes.
In the embodiment of the invention, the other shapes in the shape list to be recognized are traversed, whether the shape types of the other shapes represent the other shapes to be the graph shapes is judged, and the other shapes are stored in the graph shape list under the condition that the shape types of the other shapes represent the other shapes to be the graph shapes.
After traversing the other shapes in the shape list to be recognized, the other shapes belonging to the graphic shape may be stored in the graphic shape list, which means that all the other shapes in the graphic shape list are the graphic shapes.
S903, traversing the other shapes in the graph shape list, and judging whether the areas of the other shapes in the graph shape list are smaller than a preset first area threshold value.
S904, retrieving the target remaining shapes in the graph shape list whose first euclidean distance to the remaining shapes is smaller than a preset distance threshold in the graph shape list, when the area of the remaining shapes in the graph shape list is smaller than the preset first area threshold.
S905, merging the rest shapes in the graph shape list and the rest shapes of the targets in the graph shape list to obtain a new shape.
In the embodiment of the present invention, the remaining shapes (all are graph shapes) in the graph shape list are traversed, whether the areas of the remaining shapes in the graph shape list are smaller than a preset first area threshold is determined, when the areas of the remaining shapes in the graph shape list are smaller than the preset first area threshold, a target remaining shape (that is, other remaining shapes whose first euclidean distance from the target remaining shape is smaller than the preset distance threshold) whose first euclidean distance from the target remaining shape to the remaining shape is smaller than the preset distance threshold is retrieved from the graph shape list, and the remaining shapes in the graph shape list and the target remaining shapes in the graph shape list are merged to obtain a new shape, as shown in fig. 10.
After traversing the other shapes in the graph shape list, the other shapes belonging to the same graph item decoration can be combined, so that the new shape obtained is the graph item decoration. For example, as shown in fig. 10, circles, horizontal lines, and arrows belonging to the same pictorial item decoration are combined to obtain a new shape, and the new shape is the pictorial item decoration.
For example, traversing the other shapes (both are the graph shapes) in the graph shape list, determining whether the areas of the other shapes in the graph shape list are smaller than S, searching the target other shapes in the graph shape list, of which the first euclidean distance to the other shapes is smaller than a preset distance threshold value, in the graph shape list, under the condition that the areas of the other shapes in the graph shape list are smaller than S, that is, all the other shapes of which the first euclidean distance to the other shapes is smaller than the preset distance threshold value are the target other shapes, and merging the other shapes in the graph shape list with the target other shapes in the graph shape list to obtain a new shape.
S906, determining a third rest shape in the shape list to be recognized, and adding the third rest shape and the new shape to an ungrouped shape list as ungrouped shapes.
In the embodiment of the invention, a third rest shape in the shape list to be recognized is determined, wherein the third rest shape comprises shapes except the target shape, the rest shapes participating in the combination of the new shape and the target rest shape in the shape list to be recognized, and the third rest shape and the new shape are added to the ungrouped shape list as ungrouped shapes.
S907, grouping the ungrouped shapes according to the shape types of the ungrouped shapes in the ungrouped shape list to obtain each figure component group.
In the embodiment of the present invention, for the ungrouped shapes in the ungrouped shape list, the ungrouped shapes may be grouped according to the shape type of the text grouping shape, so as to obtain each illustrated component group. In the grouping process, the non-grouped shapes of the same type and the same or similar size can be divided into one group by means of the sizes of the non-grouped shapes, so that various diagram component groups can be obtained, and the shapes of the non-grouped shapes in different diagram component groups are different in type.
As shown in fig. 11, which is a schematic view of an implementation flow of another grouping method provided in the embodiment of the present invention, the method may specifically include the following steps:
s1101, traversing the ungrouped shapes in the ungrouped shape list, and retrieving whether there are other ungrouped shapes in the ungrouped shape list that are the same as the shape type of the ungrouped shapes and are the same as or similar to the circumscribed rectangle of the ungrouped shapes.
S1102, if there is another non-grouped shape in the non-grouped shape list, which is the same as the shape type of the non-grouped shape and is the same as or similar to a circumscribed rectangle of the non-grouped shape, creating a group of illustrated parts corresponding to the shape type.
S1103, storing the ungrouped shapes in the ungrouped shape list and the other ungrouped shapes in the ungrouped shape list to the group of illustrated components.
In the embodiment of the present invention, the ungrouped shape in the ungrouped shape list is traversed, and it is searched for whether or not there is another ungrouped shape in the ungrouped shape list that is the same shape type as the ungrouped shape and is (the same as or) similar to the circumscribed rectangle of the ungrouped shape, and if there is another ungrouped shape in the ungrouped shape list that is the same shape type as the ungrouped shape and is (the same as or) similar to the circumscribed rectangle of the ungrouped shape, a group of illustrated parts corresponding to the shape type is created, and the ungrouped shape in the ungrouped shape list and another ungrouped shape in the ungrouped shape list are stored in the group of illustrated parts, and if there is no other ungrouped shape in the ungrouped shape list that is the same shape type as the ungrouped shape and is (the same as or) similar to the circumscribed rectangle of the ungrouped shape, no processing is performed.
In the embodiment of the present invention, the ungrouped shapes in the ungrouped shape list are traversed, and the ungrouped shape list is searched for whether or not other ungrouped shapes having the same shape type as the ungrouped shapes and having a size (same as or similar to) the ungrouped shapes exist, and if other ungrouped shapes having the same shape type as the ungrouped shapes and having a size (same as or similar to) the ungrouped shapes exist in the ungrouped shape list, the illustrated component group corresponding to the shape type is created, the ungrouped shapes in the ungrouped shape list and other ungrouped shapes in the ungrouped shape list are stored in the illustrated component group, and if other ungrouped shapes having the same shape type as the ungrouped shapes and having a size (same as or similar to) the ungrouped shapes do not exist in the ungrouped shape list, the processing is not performed.
S311, aggregating the graphic component groups and the graphic keyword groups to obtain graphic items shown in the slide to be processed.
In the embodiment of the invention, for each illustration component group and each illustration keyword group, the illustration component groups and the illustration keyword groups can be aggregated, which means that the illustration component groups are combined into the illustration keyword groups, so that the illustration items illustrated in the slide to be processed can be obtained.
The method comprises the steps of aggregating all the graphic component groups with graphic keyword groups one by one to obtain all the graphic item groups, determining the shapes included in all the graphic item groups as graphic items shown in a slide to be processed, wherein the number of the graphic item groups is the same as that of target shapes in the graphic keyword groups. Here, aggregating each of the pictorial component groups with the pictorial keyword group one by one means aggregating each of the pictorial component group batches with the pictorial keyword group to obtain each of the pictorial item groups. It should be noted that the shapes included in the respective illustration item groups are different, the shape included in each illustration item group is one target shape in the illustration keyword group and one remaining shape in each illustration component group, and the sum of the second euclidean distances between the shapes in each illustration item group is minimum, for example, there are 3 illustration item groups, the second euclidean distance 1 between the shapes in the illustration item group 1, the second euclidean distance 2 between the shapes in the illustration item group 2, and the second euclidean distance 3 between the shapes in the illustration item group 3, and the sum of the 3 second euclidean distances is minimum.
For example, assuming that there are illustrated component group 1 and illustrated component group 2, the illustrated component group 1 and illustrated keyword group are aggregated, where the aggregation rule is that the obtained aggregation results include different shapes, each aggregation result includes a shape that is one target shape in the illustrated keyword group and one remaining shape in the illustrated component group 1, and the sum of the second euclidean distances between the shapes in each aggregation result is the smallest (for example, there are 3 aggregation results, the second euclidean distance 1 between the shapes in the aggregation result 1, the second euclidean distance 2 between the shapes in the aggregation result 2, the second euclidean distance 3 between the shapes in the aggregation result 3, and the sum of the 3 second euclidean distances is the smallest), and then the illustrated component group 2 and illustrated keyword group are aggregated, where the aggregation rule is that the obtained aggregation results include different shapes, each aggregation result includes a shape that is one target shape in the illustrated keyword group and one shape in the illustrated component group 2, and the remaining shape in each aggregation result includes the smallest aggregated shape, and each aggregation result includes the smallest aggregated shape in the illustrated keyword group, and the final target shape of the two illustrated keyword groups includes the same target shape, and the final target shape of the aggregate results includes the smallest aggregate shape of the illustrated keyword group, and the final shape of the final target shape of the illustrated component group includes the same target shape in the illustrated keyword group, and the final shape of the final target group may include the same target shape of the final shape of the illustrated component group, and the final shape of the final graph.
In addition, as shown in fig. 12, an implementation flow diagram of a packet polymerization method provided in the embodiment of the present invention may specifically include the following steps:
s1201, aiming at any target shape in the graph key word group, determining a second Euclidean distance between the target shape and any rest shape in each graph component group.
S1202, selecting the rest shapes in the graphic component groups with the minimum second Euclidean distance from the target shape, and aggregating the rest shapes with the target shape to obtain graphic items shown in the slide to be processed.
In the embodiment of the invention, aiming at any target shape in the graphic keyword group, a second Euclidean distance between the target shape and any other shape in each graphic component group is determined, the other shape in each graphic component group with the smallest second Euclidean distance with the target shape is selected and aggregated with the target shape, and a graphic item shown in a slide to be processed is obtained.
For example, as shown in fig. 13, circles, horizontal lines, and arrows belonging to the same illustration item decoration are combined to obtain a new shape, which is the illustration item decoration, and then the grouped illustration component group 1 includes three graphic shapes, the illustration component group 2 includes 3 text shapes, the illustration keyword group includes each object shape (i.e., "01", "02", and "03"), for any object shape in the illustration keyword group, a second euclidean distance between the object shape and any graphic shape in the illustration component group 1 is determined, a second euclidean distance between the object shape and any text shape in the illustration component group 2 is determined, a graphic shape in the illustration component group 1 having the smallest second euclidean distance with the object shape is selected, a text shape in the illustration component group 2 having the smallest second euclidean distance with the object shape is selected, and the text shape is aggregated with the object shape, so that the three illustration items can be obtained.
In addition, as shown in fig. 14, an implementation flow diagram of another packet aggregation method provided in the embodiment of the present invention is specifically shown, where the method specifically includes the following steps:
s1401, for any one of the target shapes in the graphic keyword group, determine a third circumscribed rectangle formed by the target shape and any one of the remaining shapes in each of the graphic component groups.
S1402, selecting the rest shapes in each graphic component group with the minimum third external rectangle formed by the selected shapes and the target shape, and aggregating the rest shapes and the target shape to obtain graphic items shown in the slide to be processed.
In the embodiment of the invention, a third circumscribed rectangle formed by the target shape and any other shape in each graphic component group is determined according to any target shape in the graphic keyword group, the other shape in each graphic component group with the smallest third circumscribed rectangle formed by the target shape is selected and aggregated with the target shape, and the graphic item shown in the slide to be processed is obtained.
For example, the grouped illustration component group 1 includes three graphic shapes, the illustration component group 2 includes 3 text shapes, the illustration keyword group includes each target shape (i.e., "01", "02", or "03" in the text shape), for any target shape in the illustration keyword group, a third circumscribed rectangle formed by the target shape and any graphic shape in the illustration component group 1 is determined, a third circumscribed rectangle formed by the target shape and any text shape in the illustration component group 2 is determined, a graphic shape in the illustration component group 1 having the smallest third circumscribed rectangle formed by the target shape is selected, a text shape in the illustration component group 2 having the smallest third circumscribed rectangle formed by the target shape is selected, and the text shape is aggregated with the target shape, so that three illustration items can be obtained.
S312, according to the preset data specification of the graphic item, the graphic item is converted to obtain the target graphic item of the target graphic.
In the embodiment of the present invention, for the pictorial item illustrated in the slide, the pictorial item may be converted according to a preset pictorial item data specification, so that a target pictorial item of the target illustration may be obtained, and the target pictorial item may satisfy the pictorial item data specification.
The elements in the graphic item may include a title, a text, a section number, and a decoration, and corresponding conversion is required according to the data specification of each element, so that a target graphic meeting the graphic data specification can be obtained.
Specifically, as shown in fig. 15, an implementation flow diagram of a method for converting an illustration item provided in an embodiment of the present invention is applied to an electronic device, and the method may specifically include the following steps:
s1501, identifying a text shape and a non-text shape in the pictorial item; the text shape includes a title, a body, and a section number, and the non-text shape includes a pictorial item decoration.
In the embodiment of the invention, the pictorial item generally comprises four elements of a title, a text, a section number, decoration and the like. For the title, the brief sentence which indicates the content in the diagram, for the text, the main content in the diagram, for the section number, the hierarchical sequence of the items in the diagram, which is generally represented by Arabic numerals, chinese numerals, english or letters, for the decoration, various shapes in the diagram are combined to form various icons, which can also play the role of decoration and can also express the meanings related to the characters, so that the picture is not boring.
Based on this, the section number in the pictorial item can be firstly identified, then the title in the pictorial item can be identified, then the text in the pictorial item can be identified, and finally the decoration in the pictorial item can be identified, wherein the decoration is divided into pictorial item decoration and pictorial decoration, the pictorial decoration is optional, and the identification of the pictorial decoration is described later.
Identification rules for section numbers: 1. arabic numerals (0, 1, 2, 3, \8230;), 2 Chinese character numerals (one, two, three, \8230;), 3 letter serial numbers (A, B, C, \8230;), 4 Chinese numerals (one, two, three, \\8230;) are used.
Identification rules for titles: the number of characters is small (e.g. set to not more than 8 kanji) or the "title" character is included.
Identification rules for text: the text shape excluding the title and section number is determined as a body.
Identification rules for decorations: the non-text shape is left as the pictorial item decoration, and the recognition of the pictorial decoration is explained later.
Based on this, in the embodiment of the present invention, based on the above recognition rule and recognition sequence, the text shape and the non-text shape in the pictorial item can be recognized; the text shape comprises a title, a body and a section number, the non-text shape comprises a pictorial item decoration, namely the title, the body and the section number in the pictorial item are identified, and the remaining non-text shape in the pictorial item is determined to be the pictorial item decoration.
S1502, converting the text shape and the non-text shape according to a preset graphic item data specification to obtain a target graphic item of the target graphic.
In the embodiment of the invention, the text shape and the non-text shape in the pictorial item are converted according to the preset pictorial item data specification to obtain the target pictorial item of the target pictorial.
Specifically, in the embodiment of the present invention, for different elements in an illustration item, corresponding conversion is performed according to different data specifications, that is, according to a preset data specification of a section number, a section number is converted to obtain a target section number of a target illustration, and/or a title is converted according to a preset data specification of a title to obtain a target title of the target illustration, and/or a text is converted according to a preset data specification of a text to obtain a target text of the target illustration, and/or, according to a preset data specification of an illustration item decoration, an illustration item decoration is converted to obtain a target illustration item decoration of the target illustration.
As shown in fig. 16, a schematic implementation flow diagram of another slide processing method provided in an embodiment of the present invention is applied to an electronic device, and the method may specifically include the following steps:
s1601, a slide to be processed is obtained.
In the embodiment of the present invention, this step is similar to the step S101, and the details of the embodiment of the present invention are not repeated herein.
And S1602, determining the shape to be recognized in the slide to be processed, and acquiring the attribute of the shape to be recognized.
In the embodiment of the present invention, this step is similar to the step S102, and details of the embodiment of the present invention are not repeated herein.
S1603, identifying the graphic items shown in the slide to be processed according to the shape to be identified and the attribute.
In the embodiment of the present invention, this step is similar to the step S103, and the details of the embodiment of the present invention are not repeated herein.
And S1604, converting the pictorial item according to a preset pictorial item data specification to obtain a target pictorial item of the target pictorial.
In the embodiment of the present invention, this step is similar to the step S104, and the details of the embodiment of the present invention are not repeated herein.
S1605, determining the shape contained in the graphic item, and searching for the different shape of the shape in the list of the shape to be recognized, which is different from the shape contained in the graphic item.
In the embodiment of the present invention, in the process of identifying the illustrated item, the used shapes may not be all shapes in the list of shapes to be identified, which means that there may be unused shapes in the list of shapes to be identified, and these unused shapes may be the illustrated decoration.
Based on the shape contained in the diagram item, a difference shape with a difference between the shape in the shape list to be recognized and the shape contained in the diagram item is searched, wherein the difference shape is a shape which is not used in the process of recognizing the diagram item of the diagram.
S1606, identifying the graph decoration of the graph according to the different shape.
In the embodiment of the present invention, it is possible for the difference shape to be a pictorial decoration, and based on this, the pictorial decoration of the drawing can be identified from the difference shape.
As shown in fig. 17, an implementation flow diagram of a diagram decoration identification method provided in an embodiment of the present invention is applied to an electronic device, and the method may specifically include the following steps:
s1701, when the difference shape intersects with the circumscribed rectangle of the diagram and an intersection area is greater than a preset second area threshold, determining whether the difference shape is a text shape.
S1702, in a case where the difference shape is a non-text shape, recognizing the difference shape as a diagram decoration of the diagram.
In the embodiment of the present invention, for the difference shape, in the case that the difference shape intersects with the circumscribed rectangle of the diagram and the intersection area is larger than the preset second area threshold, it is determined whether the difference shape is a text shape, and in the case that the difference shape is a non-text shape, the difference shape is identified as the diagram decoration of the diagram, as shown in fig. 18.
As shown in fig. 19, an implementation flow diagram of another illustrative decoration identification method provided in an embodiment of the present invention is applied to an electronic device, and the method may specifically include the following steps:
s1901, when the height or width of the difference shape is smaller than a preset line width threshold, determining that the difference shape is a linear shape.
S1902, when the linear shape intersects the circumscribed rectangle of the graphic, identifying the differential shape as a graphic decoration of the graphic.
In the embodiment of the present invention, for the difference shape, in the case that the height or width of the difference shape is smaller than the preset line width threshold, the difference shape is determined to be a linear shape, and in the case that the linear shape intersects with the circumscribed rectangle of the diagram, the difference shape is identified as the diagram decoration of the diagram, as shown in fig. 20.
S1607, according to the preset graphic decoration data standard, the graphic decoration is converted to obtain the target graphic decoration of the target graphic.
In the embodiment of the present invention, for the graphic decoration, the graphic decoration may be converted according to a preset graphic decoration data specification to obtain a target graphic decoration of the target graphic.
Through the above description of the technical solution provided by the embodiment of the present invention, a slide to be processed is obtained, a shape to be recognized in the slide to be processed is determined, an attribute of the shape to be recognized is obtained, a diagram item shown in the slide to be processed is recognized according to the shape to be recognized and the attribute, the diagram item is converted according to a preset diagram item data specification to obtain a diagram item of a target diagram, a shape included in the diagram item is determined, a difference shape having a difference between the shape in a list of the shape to be recognized and the shape included in the diagram item is searched, a diagram decoration of the diagram is recognized according to the difference shape, and the diagram decoration is converted according to a preset diagram decoration data specification to obtain a target diagram decoration of the target diagram.
Therefore, the graphic items shown in the slide are recognized according to the shapes to be recognized and the attributes thereof in the slide, the graphic items are converted according to the corresponding graphic item data specifications to obtain the target graphic items, the decorations of the graphic items are recognized according to the different shapes of the differences between the shapes in the shape list to be recognized and the shapes contained in the graphic items, and the decorations are converted according to the corresponding graphic decoration data specifications to obtain the target graphic decorations.
Corresponding to the above method embodiment, an embodiment of the present invention further provides a slide processing apparatus, as shown in fig. 21, the apparatus may include: the slide obtaining module 2110, the shape determining module 2120 to be recognized, the property obtaining module 2130, the pictorial item recognizing module 2140, and the pictorial item converting module 2150.
A slide obtaining module 2110 for obtaining a slide to be processed;
a shape to be recognized determining module 2120, configured to determine a shape to be recognized in the slide to be processed;
the attribute acquisition module 2130 is used for acquiring the attributes of the shape to be identified;
a pictorial item identification module 2140, configured to identify a pictorial item illustrated in the slide to be processed according to the shape to be identified and the attribute;
and the diagram item conversion module 2150 is configured to convert the diagram item according to a preset diagram item data specification to obtain a target diagram item of the target diagram.
An embodiment of the present invention further provides an electronic device, as shown in fig. 22, including a processor 221, a communication interface 222, a memory 223, and a communication bus 224, where the processor 221, the communication interface 222, and the memory 223 complete mutual communication through the communication bus 224,
a memory 223 for storing computer programs;
the processor 221 is configured to implement the following steps when executing the program stored in the memory 223:
acquiring a slide to be processed; determining a shape to be recognized in the slide to be processed, and acquiring the attribute of the shape to be recognized; identifying the graphic items illustrated in the slide to be processed according to the shape to be identified and the attribute; and converting the graphic items according to a preset graphic item data specification to obtain target graphic items of the target graphic.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this is not intended to represent only one bus or type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM), and may also include a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, or discrete hardware components.
In yet another embodiment of the present invention, a storage medium is further provided, which has instructions stored therein, and when the storage medium runs on a computer, the instructions cause the computer to execute the slide processing method in any one of the above embodiments.
In yet another embodiment, a computer program product containing instructions is provided, which when run on a computer, causes the computer to perform the slide processing method described in any of the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to be performed in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored on a storage medium or transmitted from one storage medium to another, for example, from one website, computer, server, or data center to another website, computer, server, or data center via wire (e.g., coaxial cable, fiber optic, digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The storage medium may be any available medium that can be accessed by a computer or a data storage device including one or more available media integrated servers, data centers, and the like. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising a," "8230," "8230," or "comprising" does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on differences from other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (22)

1. A method for slide processing, the method comprising:
acquiring a slide to be processed;
determining a shape to be recognized in the slide to be processed, and acquiring the attribute of the shape to be recognized;
identifying a pictorial item illustrated in the slide to be processed according to the shape to be identified and the attribute;
and converting the graphic items according to a preset graphic item data specification to obtain target graphic items of the target graphic.
2. The method of claim 1, wherein the determining the shape to be recognized in the slide to be processed comprises:
acquiring a shape array of the slide to be processed;
traversing the shapes in the shape array, and judging whether the shapes are visible or not;
if the shape is visible, adding the shape to a list of shapes to be recognized;
determining the shape in the list of shapes to be recognized as the shape to be recognized in the slide to be processed.
3. The method according to claim 2, wherein said identifying the pictorial item illustrated in the slide to be processed according to the shape to be identified and the attribute comprises:
determining graphic keyword groups and graphic component groups according to the shapes and the attributes in the shape list to be recognized;
and aggregating the graphic component groups and the graphic keyword groups to obtain graphic items shown in the slide to be processed.
4. The method of claim 3, wherein the attribute comprises a shape type;
determining a graphic keyword group and each graphic component group according to the shape and the attribute in the shape list to be recognized, wherein the method comprises the following steps:
traversing the shape in the shape list to be recognized, and judging whether the shape type of the shape represents that the shape is a text shape;
adding the shape to a list of text shapes if the shape type of the shape characterizes the shape as a text shape;
extracting a target shape from the shapes of the text shape list, and storing the target shape to a graphic keyword group;
determining other shapes in the shape list to be recognized, wherein the other shapes comprise the shapes in the shape list to be recognized except the target shape;
and grouping the rest shapes according to the shape types of the rest shapes to obtain each diagram component group.
5. The method of claim 4, wherein the attribute further comprises text, and wherein the information of the text comprises at least one of: content, length, font size;
the extracting a target shape from the shapes of the text shape list, and storing the target shape to a diagram keyword group, includes:
traversing the shapes in the text shape list, and determining the shapes as reference shapes;
retrieving a first remaining shape that is the same as or similar to the information of the text of the reference shape; wherein the first remaining shape comprises the shape in the text shape list other than the reference shape;
in a case where the first remaining shape is retrieved, the traversal is stopped, and the reference shape and the first remaining shape are stored as target shapes to the illustration key group.
6. The method of claim 5, wherein extracting a target shape from the shapes of the text shape list, storing the target shape to a set of pictorial keywords, further comprises:
under the condition that the graphic keyword group is not empty, traversing second other shapes in the text shape list, and judging whether the second other shapes and the target shapes in the graphic keyword group are in layout balance; wherein the second remaining shape comprises the shape in the text shape list other than the reference shape and the first remaining shape;
storing the second remaining shape as a target shape to the illustration keyword group when the second remaining shape and the target shape are layout balanced.
7. The method of claim 6, wherein the attributes further include a location; the determining whether the second remaining shape is layout balanced with the target shape in the graph keyword group includes:
determining a center of gravity of the position of the second remaining shape and the position of the target shape in the pictorial keyword group;
determining a first circumscribed rectangle formed by the second remaining shape and the target shape in the graphic keyword group, and judging whether the gravity center is positioned on the geometric center, the horizontal center or the vertical center of the first circumscribed rectangle;
determining that the second remaining shape is in layout balance with the target shape in the illustration keyword group if the center of gravity is located on a geometric center, a horizontal center, or a vertical center of the first circumscribed rectangle.
8. The method of claim 5, wherein extracting a target shape from the shapes of the text shape list, storing the target shape to a set of pictorial keywords, further comprises:
in the case that the illustration keyword group is empty, traversing the shape in the text shape list, and determining the shape as a reference shape;
retrieving a first remaining shape that is balanced with the reference shape layout, wherein the first remaining shape comprises the shape in the text shape list other than the reference shape;
and stopping traversing when the first rest shape is retrieved, and storing the reference shape and the first rest shape as target shapes in the illustration keyword group.
9. The method of claim 8, wherein the attributes further comprise a location; the retrieving a first remaining shape that balances the reference shape layout, comprising:
determining a center of gravity of the location of the first remaining shape and the location of the reference shape;
determining a second circumscribed rectangle formed by the first remaining shape and the reference shape, and judging whether the gravity center is positioned on the geometric center, the horizontal center or the vertical center of the second circumscribed rectangle;
determining that the first remaining shape is in layout balance with the reference shape with the center of gravity located on a geometric center, a horizontal center, or a vertical center of the second circumscribed rectangle.
10. The method of claim 4, wherein said grouping said remaining shapes according to said shape types of said remaining shapes, resulting in respective sets of graphics components, comprises:
traversing the other shapes in the shape list to be recognized, and judging whether the shape types of the other shapes represent that the other shapes are graph shapes;
storing the rest shapes into a graph shape list under the condition that the shape types of the rest shapes represent that the rest shapes are graph shapes;
traversing the other shapes in the graph shape list, and judging whether the areas of the other shapes in the graph shape list are smaller than a preset first area threshold value or not;
retrieving the target rest shapes in the graph shape list, the first Euclidean distances between which and the rest shapes are smaller than a preset distance threshold value, under the condition that the areas of the rest shapes in the graph shape list are smaller than the preset first area threshold value;
merging the other shapes in the graph shape list with the other shapes of the target in the graph shape list to obtain a new shape;
determining a third rest shape in the shape list to be recognized, and adding the third rest shape and the new shape to an ungrouped shape list as ungrouped shapes; wherein the third remaining shapes include the shapes in the list of shapes to be recognized excluding the target shape, the remaining shapes participating in merging, and the target remaining shape;
grouping the ungrouped shapes according to the shape types of the ungrouped shapes in the ungrouped shape list to obtain each illustrated component group.
11. The method of claim 10, wherein the attributes further comprise a circumscribed rectangle;
said grouping said ungrouped shapes according to said shape type of said ungrouped shapes in said ungrouped shapes list to obtain respective illustrated component groups, comprising:
traversing the ungrouped shapes in the ungrouped shape list, retrieving whether other ungrouped shapes which are the same as the shape type of the ungrouped shapes and are the same as or similar to a circumscribed rectangle of the ungrouped shapes exist in the ungrouped shape list;
creating a group of diagram parts corresponding to the shape type in the ungrouped shape list if there are other ungrouped shapes that are the same as the shape type of the ungrouped shape and that are the same as or similar to a circumscribed rectangle of the ungrouped shape;
storing the ungrouped shapes in the ungrouped shape list and the other ungrouped shapes in the ungrouped shape list to the illustrated group of components.
12. The method according to claim 3, wherein said aggregating each of said set of pictorial components with said set of pictorial keywords to obtain pictorial items depicted in said slide to be processed comprises:
aggregating the graphic component groups and the graphic keyword groups one by one to obtain graphic item groups, and determining the shapes included in the graphic item groups as graphic items illustrated in a slide to be processed, wherein the number of the graphic item groups is the same as that of the target shapes in the graphic keyword groups;
wherein each of the illustration item groups includes a different shape, each of the illustration item groups includes a shape that is one of the target shapes in the illustration keyword group and one of the remaining shapes in each of the illustration component groups, and a sum of second euclidean distances between the shapes in each of the illustration item groups is smallest.
13. The method of claim 3, wherein said aggregating each of said set of illustration components and said set of illustration keywords to obtain illustration items illustrated in said slide to be processed comprises:
determining a second Euclidean distance between the target shape and any other shape in each graph component group aiming at any target shape in the graph keyword group;
and selecting the rest shapes in each graphic component group with the minimum second Euclidean distance from the target shape, and aggregating the rest shapes with the target shape to obtain graphic items shown in the slide to be processed.
14. The method of claim 3, wherein said aggregating each of said set of illustration components and said set of illustration keywords to obtain illustration items illustrated in said slide to be processed comprises:
determining a third circumscribed rectangle formed by the target shape and any other shape in each diagram component group aiming at any target shape in the diagram keyword group;
and selecting the rest shapes in each graphic component group with the minimum third external rectangle formed by the selected shapes and the target shape, and aggregating the rest shapes and the target shape to obtain graphic items shown in the slide to be processed.
15. The method according to claim 1, wherein said converting said pictorial item according to a preset pictorial item data specification to obtain a target pictorial item of a target pictorial, comprises:
identifying text shapes and non-text shapes in the pictorial item; the text shape comprises a title, a body and a section number, and the non-text shape comprises a pictorial item decoration;
and converting the text shape and the non-text shape according to a preset diagram item data specification to obtain a target diagram item of the target diagram.
16. The method of claim 15, wherein converting the text shape and the non-text shape according to a preset illustration data specification to obtain a target illustration of a target illustration comprises:
converting the section number according to a preset section number data standard to obtain a target section number of a target graphic; and/or the presence of a gas in the atmosphere,
converting the title according to a preset title data specification to obtain a target title of a target graphic representation; and/or the presence of a gas in the gas,
converting the text according to a preset text data standard to obtain a target text of a target graphic; and/or the presence of a gas in the gas,
and converting the graphic item decoration according to a preset graphic item decoration data specification to obtain a target graphic item decoration of the target graphic.
17. The method of claim 2, further comprising:
determining the shape contained in the diagram item, and searching a difference shape with a difference between the shape in the shape list to be recognized and the shape contained in the diagram item;
identifying a pictorial decoration of the pictorial representation based on the differential shape;
and converting the graphic decoration according to a preset graphic decoration data specification to obtain the target graphic decoration of the target graphic.
18. The method of claim 17, wherein said identifying a graphic decoration of said graphic representation based on said differential shape comprises:
judging whether the difference shape is a text shape or not under the condition that the difference shape is intersected with the circumscribed rectangle of the graph and the intersected area is larger than a preset second area threshold value;
in a case where the difference shape is a non-text shape, identifying the difference shape as a diagram decoration of the diagram.
19. The method of claim 17, wherein said identifying a pictorial decoration of said pictorial representation based on said differential shape comprises:
determining that the difference shape is a linear shape when the height or width of the difference shape is smaller than a preset line width threshold value;
and in the case that the linear shape and the circumscribed rectangle of the diagram intersect, identifying the difference shape as the diagram decoration of the diagram.
20. A slide processing apparatus, characterized in that the apparatus comprises:
the slide acquiring module is used for acquiring slides to be processed;
the shape to be recognized determining module is used for determining the shape to be recognized in the slide to be processed;
the attribute acquisition module is used for acquiring the attribute of the shape to be recognized;
the figure item identification module is used for identifying figure items shown in the slide to be processed according to the shape to be identified and the attribute;
and the graphic item conversion module is used for converting the graphic items according to a preset graphic item data specification to obtain target graphic items of the target graphic.
21. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any one of claims 1-19 when executing a program stored in a memory.
22. A storage medium on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-19.
CN202210927881.6A 2022-08-03 2022-08-03 Slide processing method and device, electronic equipment and storage medium Pending CN115345136A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210927881.6A CN115345136A (en) 2022-08-03 2022-08-03 Slide processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210927881.6A CN115345136A (en) 2022-08-03 2022-08-03 Slide processing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115345136A true CN115345136A (en) 2022-11-15

Family

ID=83949943

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210927881.6A Pending CN115345136A (en) 2022-08-03 2022-08-03 Slide processing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115345136A (en)

Similar Documents

Publication Publication Date Title
CN110362370B (en) Webpage language switching method and device and terminal equipment
US7840891B1 (en) Method and system for content extraction from forms
JP6817803B2 (en) How to send and receive messages, devices, and computer programs
CN108073555B (en) Method and system for generating virtual reality environment from electronic document
US9928646B2 (en) Rendering hierarchical visualizations of data sets
JP4343213B2 (en) Document processing apparatus and document processing method
JP3577819B2 (en) Information search apparatus and information search method
JP3614618B2 (en) Document search support method and apparatus, and document search service using the same
CN102054024B (en) Information processing apparatus, information extracting method, program, and information processing system
US20110125724A1 (en) Intelligent search system
US9483740B1 (en) Automated data classification
US9633110B2 (en) Enrichment of data using a semantic auto-discovery of reference and visual data
US11256687B2 (en) Surfacing relationships between datasets
WO2014005609A1 (en) Paragraph alignment detection and region-based section reconstruction
US11256383B2 (en) Graphically representing content relationships on a surface of graphical object
CN101561725B (en) Method and system of fast handwriting input
KR101607468B1 (en) Keyword tagging method and system for contents
US20220301285A1 (en) Processing picture-text data
WO2021242397A1 (en) Constructing a computer-implemented semantic document
JP7493937B2 (en) Method, program and system for identifying a sequence of headings in a document
Khanwalkar et al. Exploration of large image corpuses in virtual reality
CN114357187A (en) Method and device for searching regulation system, storage medium and computer equipment
CN115345136A (en) Slide processing method and device, electronic equipment and storage medium
JPH07121565A (en) Information presenting device
Arnold et al. Transforming Data Silos into Knowledge: Early Chinese Periodicals Online (ECPO)

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination