CN116682130A - Method, device and equipment for extracting icon information and readable storage medium - Google Patents

Method, device and equipment for extracting icon information and readable storage medium Download PDF

Info

Publication number
CN116682130A
CN116682130A CN202210161786.XA CN202210161786A CN116682130A CN 116682130 A CN116682130 A CN 116682130A CN 202210161786 A CN202210161786 A CN 202210161786A CN 116682130 A CN116682130 A CN 116682130A
Authority
CN
China
Prior art keywords
tab
icon
key field
information
tab key
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
CN202210161786.XA
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.)
Glodon Co Ltd
Original Assignee
Glodon 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 Glodon Co Ltd filed Critical Glodon Co Ltd
Priority to CN202210161786.XA priority Critical patent/CN116682130A/en
Publication of CN116682130A publication Critical patent/CN116682130A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/53Querying
    • G06F16/532Query formulation, e.g. graphical querying
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/56Information retrieval; Database structures therefor; File system structures therefor of still image data having vectorial format
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The application relates to the technical field of vector drawing identification and discloses a method, a device and equipment for extracting drawing information and a readable storage medium. Wherein the method comprises the following steps: acquiring a target vector drawing and determining a label area of the target vector drawing; extracting line primitives and text primitives in the icon area; reducing the label table based on the position relation between the line primitive and the text primitive; and extracting the icon information in the icon table. By implementing the method and the device, the construction accuracy of the icon form is ensured, the influence of the form background on the icon identification is avoided, the direct identification of the icon information in the icon form is realized, and the identification accuracy and the identification efficiency of the icon information are improved.

Description

Method, device and equipment for extracting icon information and readable storage medium
Technical Field
The application relates to the technical field of vector drawing identification, in particular to a method, a device and equipment for extracting drawing information and a readable storage medium.
Background
At present, a corresponding icon is usually designed on a vector drawing to carry out related description on the drawing, when the vector drawing needs to be correspondingly adjusted, the icon on the vector drawing needs to be correspondingly modified, but at present, the icon is usually extracted by an OCR technology based on target detection, but the OCR recognition performance of the vector drawing is reduced due to the influence of resolution ratio when the vector drawing is converted into a picture, and for the vector drawing like the description, the vector drawing is a table background, the OCR recognition is interfered, and the recognition accuracy of icon information is difficult to ensure.
Disclosure of Invention
In view of the above, the embodiments of the present application provide a method, an apparatus, a device, and a readable storage medium for extracting icon information, so as to solve the problem that the accuracy of identifying icon information is difficult to guarantee.
According to a first aspect, an embodiment of the present application provides a method for extracting icon information, including: acquiring a target vector drawing and determining a label area of the target vector drawing; extracting line primitives and text primitives in the icon area; reducing a label table based on the position relationship between the line primitive and the text primitive; and extracting the icon information in the icon table.
According to the extraction method of the icon information, which is provided by the embodiment of the application, the icon area in the target vector drawing is obtained, the icon elements and the text icon in the icon area are extracted, the icon table is reduced according to the position relation between the icon elements and the text icon, and the icon information in the icon table is further extracted. According to the method, the drawing element of the drawing area and the text drawing element are extracted to restore the drawing form, so that the construction accuracy of the drawing form is ensured, and the influence of the form background on drawing identification is avoided; the icon table is constructed based on the line elements corresponding to the icons and the text elements to determine the icon information corresponding to the icon table, so that the icon information in the icon table can be directly identified, and the identification accuracy and the identification efficiency of the icon information are improved.
With reference to the first aspect, in a first implementation manner of the first aspect, the extracting the tab information in the tab table includes: acquiring a tab key field and a tab key field value; and filtering the information of the icon table based on the key field of the icon and the matching relation between the key field values of the icon, and determining the icon information corresponding to the icon table.
With reference to the first implementation manner of the first aspect, in a second implementation manner of the first aspect, the filtering information of the tab table based on the tab key field and the tab key field value to determine tab information corresponding to the tab table includes: judging whether the tab key field and the tab key field value are in the same cell in the tab table or not; when the tab key field and the tab key field value are not in the same cell in the tab table, judging whether the tab key field exists in the tab table; when the tab key field exists in the tab table, determining a first candidate cell corresponding to the tab key field based on a preset tab knowledge base; determining a second candidate cell corresponding to the tab key field value based on the first candidate cell corresponding to the tab key field; filtering the second candidate cell based on the tab key field value to obtain a target cell, wherein the tab key field value of the target cell is used as the tab information; the preset icon knowledge base is constructed based on icon features in the vector drawing.
With reference to the second implementation manner of the first aspect, in a third implementation manner of the first aspect, the filtering information of the tab table based on the tab key field and the tab key field value, to determine tab information corresponding to the tab table, further includes: when the tab key field and the tab key field value are in the same cell in the tab table, judging whether the tab key field and the tab key field value are matched or not based on the tab setting knowledge base; and when the tab key field and the tab key field value are matched, determining the tab key field and the tab key field value as the tab information.
With reference to the second implementation manner of the first aspect, in a fourth implementation manner of the first aspect, the method further includes: when the tab key field does not exist in the tab table, judging whether the tab key field value in the tab table has a corresponding matching value in the preset tab knowledge base or not; and if the tab key field value in the tab table has a corresponding matching value in the preset tab knowledge base, taking the tab key field value as the tab information.
According to the method for extracting the icon information, which is provided by the embodiment of the application, the icon table is subjected to information filtering through the matching relation between the icon key fields and the icon key field values, so that the icon information contained in the icon table is determined, and the extracting accuracy of the icon information is ensured.
With reference to the first aspect, in a fifth implementation manner of the first aspect, the extracting line primitives and text primitives in the label area includes: extracting layer information of the target vector drawing and determining a target layer where the icon area is located; acquiring each primitive contained in the target layer; and determining the line primitives and text primitives which belong to the icons based on the position information and the type information of each primitive.
According to the method for extracting the icon information, provided by the embodiment of the application, the icon layer of the target vector drawing is extracted, the target icon layer where the icon area is located is determined, each icon contained in the target icon layer is obtained, and the icon and the text icon which belong to the icon are determined based on the position information and the type information of each icon, so that the relative icon and the text icon of the icon are determined based on the position information, the type information and the icon layer information of the icon, and the influence of drawing resolution and drawing background on the identification of the icon is avoided.
With reference to the first aspect, in a sixth implementation manner of the first aspect, the reducing the label table based on the positional relationship between the line primitive and the text primitive includes: acquiring coordinate information of a line segment corresponding to the line element, and determining an intersecting line element; generating a table frame based on the intersecting line pattern element, and determining cell coordinates of the table frame; and inserting the text graphic element into a cell in the table frame based on the coordinate information of the text corresponding to the text graphic element and the cell coordinate to obtain the icon table.
With reference to the sixth implementation manner of the first aspect, in a seventh implementation manner of the first aspect, the generating a table frame based on the intersection line primitives includes: extracting corresponding horizontal lines and vertical lines of the intersection line figure elements; and generating the table frame based on the first coordinate value corresponding to the horizontal line and the second coordinate value corresponding to the vertical line.
According to the extraction method of the icon information, provided by the embodiment of the application, the coordinate information of the line segment corresponding to the line drawing element is obtained, the intersecting line drawing element is determined, the table frame is generated based on the intersecting line drawing element, the cell coordinates corresponding to each cell in the table frame are obtained, the text graphic element is inserted into each cell in the table frame based on the coordinate information of the text corresponding to the text graphic element and the cell coordinates corresponding to each cell, and the icon table is obtained, so that the relevance between the icon table content and the coordinates is realized, the restoration accuracy of the icon table is improved, and the identification accuracy of the icon information is ensured.
According to a second aspect, an embodiment of the present application provides an extraction apparatus for icon information, including: the acquisition module is used for acquiring a target vector drawing and determining a label area of the target vector drawing; the first extraction module is used for extracting line primitives and text primitives in the icon area; the restoring module is used for restoring the icon table based on the position relation between the line primitive and the text primitive; and the second extraction module is used for extracting the icon information in the icon table.
According to a third aspect, an embodiment of the present application provides an electronic device, including: the device comprises a memory and a processor, wherein the memory and the processor are in communication connection, the memory stores computer instructions, and the processor executes the computer instructions so as to execute the method for extracting the icon information according to the first aspect or any implementation mode of the first aspect.
According to a fourth aspect, an embodiment of the present application provides a computer readable storage medium, where computer instructions are stored, where the computer instructions are configured to cause a computer to execute the method for extracting the tag information according to the first aspect or any implementation manner of the first aspect.
It should be noted that, the description of the corresponding content in the method for extracting the icon information is omitted herein for brevity.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are needed in the description of the embodiments or the prior art will be briefly described, and it is obvious that the drawings in the description below are some embodiments of the present application, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method of extracting tab information according to an embodiment of the application;
FIG. 2 is another flow chart of a method of extracting tab information according to an embodiment of the application;
FIG. 3 is another flow chart of a method of extracting tab information according to an embodiment of the application;
FIG. 4 is a diagram of a label in accordance with an embodiment of the present application;
FIG. 5 is another diagram of a label according to an embodiment of the present application;
FIG. 6 is another diagram of a label according to an embodiment of the present application;
fig. 7 is a block diagram of a structure of an extraction apparatus of icon information according to an embodiment of the present application;
fig. 8 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The vector drawing is usually designed with a corresponding icon to carry out related description on the drawing, when the vector drawing needs to be correspondingly adjusted, the icon on the vector drawing needs to be correspondingly modified, but at present, the icon is usually extracted by an OCR technology based on target detection, but the OCR recognition performance of the vector drawing is reduced due to the influence of resolution ratio when the vector drawing is converted into a picture, and for the vector drawing like the description, most of the vector drawing is in a form background, the OCR recognition is also interfered, and the recognition accuracy of icon information is difficult to ensure.
Based on the method, the technical scheme of the application ensures the construction accuracy of the icon table by extracting the line elements of the icon area and reducing the icon table by the text elements, and then extracts the icon information from the icon table, thereby avoiding the influence of the table background on the icon identification and improving the identification accuracy and the identification efficiency of the icon information.
According to an embodiment of the present application, there is provided an embodiment of a method of extracting tab information, it being noted that the steps shown in the flowchart of the drawings may be performed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be performed in an order different from that herein.
In this embodiment, a method for extracting tab information is provided, which may be used in an electronic device, such as a mobile phone, a computer, a tablet computer, etc., fig. 1 is a flowchart of a method for extracting tab information according to an embodiment of the present application, and as shown in fig. 1, the flowchart includes the following steps:
s11, acquiring a target vector drawing, and determining a label area of the target vector drawing.
The target vector drawing is a DWG drawing to be identified, which may be read from a mobile storage device, for example, a mobile hard disk or a usb disk, or may be read from a local storage space of an electronic device, or may be obtained in other manners, where the manner of obtaining the target vector drawing is not limited, and may be determined by a person skilled in the art according to actual needs.
The icon area is an area where the icon is located in the target vector drawing, and the icon is an icon column used for indicating information of a drafter on the target vector drawing and comprises information such as a design unit, design time, project names and the like. The electronic device performs data analysis on the target vector drawing by identifying the target vector drawing, extracts the signature features contained in the target vector drawing, and demarcates the position of the signature in the target vector drawing according to the extracted signature features, for example, demarcates a signature region at the lower left side of the target vector drawing or demarcates a signature region at the lower right side of the target vector drawing.
S12, extracting line primitives and text primitives in the icon area.
The line segment data and the text graphic element are the line segment data and the text data, and the electronic equipment can analyze all the data contained in the graphic label area and determine the line segment data and the text graphic element contained in the graphic label area according to the characteristics of the line segment data and the text data.
S13, reducing the label table based on the position relation between the line primitive and the text primitive.
The electronic equipment determines the line drawing element corresponding to the drawing from all the line drawing elements identified in the drawing area according to the drawing characteristics, then generates a table frame according to the horizontal line and the vertical line corresponding to the line drawing element, and then combines the coordinate information of the text graphic element in the drawing area and the coordinate information of each cell to incorporate the text graphic element into the corresponding cell in the table frame to obtain the drawing table.
S14, extracting the icon information in the icon table.
After the electronic equipment completes the restoration of the icon table based on the line primitive and the text primitive, the information of each cell in the restored icon table can be obtained, and at the moment, the electronic equipment can identify the information of each cell in the icon table based on the icon category corresponding to the icon, so as to obtain the icon information corresponding to the icon table. The icon category, namely a field to be identified, comprises an icon name, an icon number, a specialty, an engineering name, a date, a subitem name, a proportion and the like, a value corresponding to the icon category is determined, and the icon category and the value corresponding to the icon category are determined to be icon information. For example, if the icon category is a proportion, identifying the icon table determines a possible value 1:200 corresponding to the proportion, and then obtaining the primitive set {1:200, proportion 1:200} corresponding to the icon category.
According to the extraction method of the icon information, the icon table is reduced by extracting the line primitives and the text primitives of the icon area, so that the construction accuracy of the icon table is ensured, and the influence of the table background on the icon identification is avoided; the icon table is constructed based on the line elements corresponding to the icons and the text elements to determine the icon information corresponding to the icon table, so that the icon information in the icon table can be directly identified, and the identification accuracy and the identification efficiency of the icon information are improved.
In this embodiment, a method for extracting tab information is provided, which may be used in an electronic device, such as a mobile phone, a computer, a tablet computer, etc., fig. 2 is a flowchart of a method for extracting tab information according to an embodiment of the present application, and as shown in fig. 2, the flowchart includes the following steps:
s21, acquiring a target vector drawing, and determining a label area of the target vector drawing. The detailed description refers to the corresponding related descriptions of the above embodiments, and will not be repeated here.
S22, extracting line primitives and text primitives in the icon area. The detailed description refers to the corresponding related descriptions of the above embodiments, and will not be repeated here.
S23, reducing the icon table based on the position relation between the icon element and the text icon element. The detailed description refers to the corresponding related descriptions of the above embodiments, and will not be repeated here.
S24, extracting the icon information in the icon table.
Specifically, the step S24 may include:
s241, the tab key field and the tab key field value are obtained.
The tab key field is a field for characterizing the tab category, such as a tab name, a tab number, a specialty, an engineering name, a date, a sub-item name, and a scale. The key field value of the icon is a value corresponding to the category of the icon, for example, the value corresponding to the icon is "building space layout", the date is "XX year, X month and X day", and the like. In particular, the tab key field and the tab key field value may be determined by identifying text primitives in the tab area.
S242, information filtering is carried out on the icon table based on the icon key fields and the matching relation between the icon key field values, and icon information corresponding to the icon table is determined.
The tab key fields and the tab key field values have a certain matching relationship, namely the tab categories and the corresponding values thereof are in one-to-one correspondence. The electronic equipment filters and matches the information contained in the tab form according to the tab key fields and the matching relation between the tab key field values, so that the tab information is extracted from the tab form.
Specifically, the step S242 may include:
(1) And judging whether the tab key field and the tab key field value are in the same cell in the tab table.
The electronic equipment obtains the tab table based on restoration to determine the coordinates of each cell, and then, by combining the coordinates of the tab key field and the tab key field value, whether the tab key field and the tab key field value are in the same cell or not can be determined, and then, the tab key field and the tab key field value in the same cell in the tab table can be determined. And (3) executing the step (2) when the tab key and the corresponding value of the tab key are not in the same cell in the tab table, otherwise, executing the step (6).
(2) And judging whether the tab key field exists in the tab table.
When the tab key and the corresponding value of the tab key are not in the same cell in the tab table, the electronic device may identify text primitive information in the tab table to determine whether a tab key field exists in the tab table, and when the tab key field exists in the tab table, execute the step (3), otherwise execute the step (8).
(3) And determining a first candidate cell corresponding to the tab key field based on a preset tab knowledge base.
The preset signature knowledge base is constructed based on the signature features in the vector drawing, specifically, the electronic equipment can perform data analysis on the vector drawing in advance, extract the signature features to be identified in the vector drawing, and add the signature features into the signature knowledge base. For example, the icon category identified by the electronic device is proportional, the interference information knowledge to be deleted can be extracted from the vector drawing, then the name corresponding to the proportional category is extracted, and the knowledge that the name corresponding to the proportional category and the corresponding value of the proportional category are in the same cell is extracted, so that the proportional category knowledge base construction is completed.
The first candidate cell is a possible cell where the tab key field is located, the electronic device may construct a coordinate system of the tab table, determine coordinate information of the cell where the tab key field is located and coordinate information of other cells, calculate distances between the cell where the tab key field is located and other cells according to the coordinate information of the cell where the tab key field is located and the coordinate information of other cells, and determine N cells closest to the cell where the tab key field is located, for example, N cells closest to the lower side and the right side of the cell where the tab key field is located, where N may be determined according to data analysis of the tab table. The electronic device may search a preset tab knowledge base, filter the tab table according to the tab key field, and determine N cells closest to the cell where the tab key field is located as the first candidate cells.
(4) And determining a second candidate cell corresponding to the tab key field value based on the first candidate cell corresponding to the tab key field.
The second candidate cell is a possible cell in which the tag key field value is located. The electronic equipment searches a preset tab knowledge base according to the tab key field by identifying the tab key field to determine the tab key field value corresponding to the tab key field, and then screens the first candidate cell according to the tab key field value to determine the second candidate cell corresponding to the tab key field value.
(5) And filtering the second candidate cell based on the tab key field value to obtain a target cell, wherein the tab key field value of the target cell is used as tab information.
The electronic equipment can analyze the information contained in the second candidate cell while determining the second candidate cell, filter text information in the candidate cell according to the tab key field value, determine a target cell with the tab key field matched with the tab key field value, and determine the tab key field corresponding to the target cell as the tab information.
(6) And judging whether the tab key field and the tab key field value are matched or not based on a preset tab knowledge base.
Because the patterns of the same key field and the key field value of the same key field are different, the key field and the key field may be in different cells or may be in the same cell. When the tab key field and the tab key field value are in the same cell in the tab table, the electronic device may query a preset tab knowledge base to determine whether the tab key field and the tab key field value match. And (3) when the tab key field and the tab key field value are matched, executing the step (7), otherwise, determining the grid of the tab key field according to the tab key field, searching a preset tab knowledge base according to the tab key field, determining a candidate set of the tab key field value corresponding to the tab key field, and taking the tab key field value as tab information if the tab key field value in the candidate set has a corresponding matching value in the preset tab knowledge base.
(7) And determining the tab key field value as tab information.
When the tab key field and the tab key field value are matched, the tab key field and the tab key field value which are currently in the same cell are in one-to-one correspondence, and the tab key field value can be determined to be tab information.
(8) When the tab key field does not exist in the tab table, judging whether the tab key field value in the tab table has a corresponding matching value in a preset tab knowledge base or not.
When the tab key field does not exist in the tab table, the electronic device can query a preset tab knowledge base according to the tab key field value at the moment so as to determine whether the tab key field value has a corresponding matching value in the preset tab knowledge base. And (3) executing the step (9) when the tab key field value in the tab table has a corresponding matching value in a preset tab knowledge base, otherwise, deleting the tab key field value.
(9) And taking the key field value of the icon as the icon information.
If the tab key field value in the tab table has a corresponding matching value in the preset tab knowledge base, the pattern corresponding to the tab key field value is indicated to exist in the preset tab knowledge base, and the tab key field value can be used as tab information at the moment.
As shown in fig. 4 to 6, taking the example of identifying the "design stage" of the tab key field, it can be seen based on the tabs of fig. 4 to 6 that the "design stage" of the tab key field and the "value of the tab key field" are applied together, so that the tab key field can be applied together with the same cell, as shown in fig. 4, or can be respectively applied to two cells, as shown in fig. 5, and of course, only the "value of the tab key field" is applied together (here, the "design stage" of the tab key field is taken as a key, and the "value" of the tab key field is applied together with the "value"). Specifically, the step of identifying the tab key field "design phase" is as follows:
1) Acquiring information contained in the restored tab form, wherein the information comprises all cell coordinates and values in all cells in the tab form;
2) According to the interference information of the key field ' design stage ' of the icon in the preset icon knowledge base, the icon table is initially filtered to filter the interference information, for example, the ' icon in the drawing corresponding to fig. 4: junction application ";
3) As shown in fig. 4, the condition that the key field of the icon is in the same cell with the key field value of the icon is identified in the "design stage", specifically, the information of the same cell with the key and the value is matched according to a preset icon knowledge base, and if the information is matched, the information is used as icon information;
4) As shown in fig. 5, the situation that the lattice where the key field of the tab is "designed" and the key field value of the tab are "applied" are in different cells is identified, specifically, the information in the tab table is matched according to the key information in the preset tab knowledge base. If the coordinate information of the lattice where the key field of the icon is located in the design stage is found after the matching, recalling suspected cells of the key field value of the icon according to the coordinate information of the lattice where the key field of the icon is located in the design stage, and taking the suspected cells as candidate cells;
5) Screening the candidate cells, if the candidate cells can be matched with the value in the preset icon knowledge base, reserving the candidate cells as icon information, and if the candidate cells can not be matched with the value in the preset icon knowledge base, deleting the candidate cells from the candidate cells;
6) As shown in fig. 6, when there is no key field "design stage" or the candidate cell is empty, no key search is required, specifically, the text primitive is matched according to the value in the preset icon knowledge base, and if matching is completed, the text primitive is used as the icon information.
According to the method for extracting the icon information, the icon table is subjected to information filtering through the icon key fields and the matching relation between the icon key field values, so that the icon information contained in the icon table is determined, and the extracting accuracy of the icon information is guaranteed.
In this embodiment, a method for extracting tab information is provided, which may be used in an electronic device, such as a mobile phone, a computer, a tablet computer, etc., fig. 3 is a flowchart of a method for extracting tab information according to an embodiment of the present application, and as shown in fig. 3, the flowchart includes the following steps:
s31, acquiring a target vector drawing, and determining a label area of the target vector drawing. The detailed description refers to the corresponding related descriptions of the above embodiments, and will not be repeated here.
S32, extracting line primitives and text primitives in the icon area.
Specifically, the step S32 may include:
s321, extracting layer information of the target vector drawing, and determining a target layer where the icon area is located.
The target vector drawing is a drawing obtained by stacking a plurality of layers according to a certain sequence, the layer information comprises corresponding text information or graphic information of the target vector drawing, and the electronic equipment can determine the target layer where the drawing is located according to the drawing area.
S322, each graphic element contained in the target graphic layer is obtained.
The target layer contains the line primitives and the character primitives for generating the icons, and the electronic equipment can extract the character information or the graphic information in the target layer and then determine each primitive contained in the target layer according to the character information or the graphic information.
S323, determining the line primitives and text primitives belonging to the icons based on the position information and the type information of each primitive.
The location information is the location of each primitive in the icon area, which can be characterized by coordinates. The type information contains information for representing the category of the primitive such as line segments, texts, circular arcs, polygons and the like. Specifically, the electronic equipment constructs a coordinate system according to the icon area to acquire coordinate values of each graphic element in the icon area, then filters out background interference graphic elements according to coordinate values corresponding to each graphic element, and combines type information of each graphic element to determine the graphic elements and text graphic elements belonging to the icon.
S33, reducing the icon table based on the position relation between the icon element and the text icon element.
Specifically, the step S33 may include:
s331, acquiring coordinate information of a line segment corresponding to the line element, and determining the intersecting line element.
The electronic equipment can identify all line segments corresponding to the line drawing element, acquire the coordinate information of each line segment in the drawing area, sort each line segment according to the coordinate information of all line segments, find the closest intersecting transverse line to the upper side and the lower side of any one vertical line, and find the closest intersecting vertical line to the left side and the right side of any one transverse line, namely the intersecting line drawing element.
S332, generating a table frame based on the intersecting line pattern elements, and determining cell coordinates of the table frame.
According to the intersection property among the intersecting line pattern elements, a table frame containing a plurality of cells can be generated, specifically, for any one vertical line a, the electronic equipment can find the nearest vertical line b from the line pattern elements, then find intersecting line pattern elements corresponding to the vertical line a and the vertical line b respectively, the cells corresponding to the vertical line a can be formed according to the intersecting line pattern elements, then the cells can be sequentially constructed, the cells can be combined, the table frame can be obtained, and then the electronic equipment can obtain the cell coordinates of each cell in the table frame in the label area.
Specifically, the step of generating a table frame based on intersecting line primitives may include:
(1) And extracting corresponding transverse lines and vertical lines of the intersecting line pattern elements.
The intersecting line element is composed of line elements with intersecting relation, and the electronic equipment can determine corresponding transverse lines and vertical lines according to the intersecting line elements.
(2) And generating a table frame based on the first coordinate value corresponding to the horizontal line and the second coordinate value corresponding to the vertical line.
The first coordinate value is the ordinate corresponding to each horizontal line, and the second coordinate value is the abscissa corresponding to each vertical line. The electronic device may sort the horizontal lines from small to large according to the ordinate, and sort the vertical lines from small to large according to the abscissa, thereby creating a table frame.
S333, based on the coordinate information and the cell coordinates of the text corresponding to the text graphic primitive, inserting the text graphic primitive into the cell in the table frame to obtain the icon table.
The electronic device can determine the coordinate range covered by the cell according to the first coordinate value and the second coordinate value of the cell, and then compares the coordinate information of the text in the text primitive with the coordinates of the cell to determine whether the coordinate range covered by the cell can cover the coordinate information of the text in the text primitive. When the coordinate range covered by the cell can cover the coordinate information of the text in the text primitive, inserting the text corresponding to the text primitive into the corresponding cell in the table frame, and further obtaining the icon table.
S34, extracting the icon information in the icon table. The detailed description refers to the corresponding related descriptions of the above embodiments, and will not be repeated here.
According to the method for extracting the icon information, the icon layer of the target vector drawing is extracted, the target icon layer where the icon area is located is determined, each icon contained in the target icon layer is obtained, and the icon and the text icon which belong to the icon are determined based on the position information and the type information of each icon, so that the relative icon and the text icon of the icon are determined based on the position information, the type information and the icon information of the icon, and the influence of drawing resolution and drawing background on the identification of the icon is avoided. The method comprises the steps of obtaining coordinate information of line segments corresponding to line primitives, determining the intersecting line primitives, generating a table frame based on the intersecting line primitives, obtaining cell coordinates corresponding to each cell in the table frame, inserting text primitives into each cell in the table frame based on the coordinate information of texts corresponding to the text primitives and the cell coordinates corresponding to each cell, and obtaining a label table, so that the relevance between the content of the label table and the coordinates is achieved, the recovery accuracy of the label table is improved, and the identification accuracy of the label information is guaranteed.
The embodiment also provides a device for extracting the icon information, which is used for implementing the above embodiment and the preferred implementation, and is not described again. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. While the means described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.
The embodiment provides an extraction device of icon information, as shown in fig. 7, including:
the obtaining module 41 is configured to obtain a target vector drawing, and determine a label area of the target vector drawing. The detailed description refers to the corresponding related description of the above method embodiments, and will not be repeated here.
A first extraction module 42 is configured to extract line primitives and text primitives in the label area. The detailed description refers to the corresponding related description of the above method embodiments, and will not be repeated here.
And a restoring module 43, configured to restore the label table based on the positional relationship between the line primitive and the text primitive. The detailed description refers to the corresponding related description of the above method embodiments, and will not be repeated here.
A second extraction module 44, configured to extract the icon information in the icon table. The detailed description refers to the corresponding related description of the above method embodiments, and will not be repeated here.
According to the extraction device for the icon information, the icon table is reduced by extracting the line primitives and the text primitives of the icon area, so that the construction accuracy of the icon table is ensured, and the influence of the table background on the icon identification is avoided; the icon table is constructed based on the line elements corresponding to the icons and the text elements to determine the icon information corresponding to the icon table, so that the icon information in the icon table can be directly identified, and the identification accuracy and the identification efficiency of the icon information are improved.
The extraction means of the tag information in this embodiment is presented in the form of functional units, where the units refer to ASIC circuits, processors and memories executing one or more software or firmware programs, and/or other devices capable of providing the above described functionality.
Further functional descriptions of the above modules are the same as those of the above corresponding embodiments, and are not repeated here.
The embodiment of the application also provides electronic equipment, which is provided with the extraction device of the icon information shown in fig. 7.
Referring to fig. 8, fig. 8 is a schematic structural diagram of an electronic device according to an alternative embodiment of the present application, as shown in fig. 8, the electronic device may include: at least one processor 501, such as a CPU (Central Processing Unit ), at least one communication interface 503, a memory 504, at least one communication bus 502. Wherein a communication bus 502 is used to enable connected communications between these components. The communication interface 503 may include a Display screen (Display), a Keyboard (Keyboard), and the optional communication interface 503 may further include a standard wired interface, and a wireless interface. The memory 504 may be a high-speed RAM memory (Random Access Memory, volatile random access memory) or a non-volatile memory (non-volatile memory), such as at least one disk memory. The memory 504 may also optionally be at least one storage device located remotely from the aforementioned processor 501. Wherein the processor 501 may have stored in the memory 504 an application program in the apparatus described in connection with fig. 7 and the processor 501 invokes the program code stored in the memory 504 for performing any of the above-mentioned method steps.
The communication bus 502 may be a peripheral component interconnect standard (peripheral component interconnect, PCI) bus or an extended industry standard architecture (extended industry standard architecture, EISA) bus, among others. The communication bus 502 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in fig. 8, but not only one bus or one type of bus.
Wherein the memory 504 may include volatile memory (english) such as random-access memory (RAM); the memory may also include a nonvolatile memory (english: non-volatile memory), such as a flash memory (english: flash memory), a hard disk (english: hard disk drive, abbreviated as HDD) or a solid state disk (english: solid-state drive, abbreviated as SSD); memory 504 may also include a combination of the types of memory described above.
The processor 501 may be a central processor (English: central processing unit, abbreviated: CPU), a network processor (English: network processor, abbreviated: NP) or a combination of CPU and NP.
The processor 501 may further include a hardware chip, among others. The hardware chip may be an application-specific integrated circuit (ASIC), a Programmable Logic Device (PLD), or a combination thereof (English: programmable logic device). The PLD may be a complex programmable logic device (English: complex programmable logic device, abbreviated: CPLD), a field programmable gate array (English: field-programmable gate array, abbreviated: FPGA), a general-purpose array logic (English: generic array logic, abbreviated: GAL), or any combination thereof.
Optionally, the memory 504 is also used for storing program instructions. The processor 501 may invoke program instructions to implement the extraction method of the tag information as shown in the embodiments of fig. 1 to 3 of the present application.
The embodiment of the application also provides a non-transitory computer storage medium, which stores computer executable instructions, and the computer executable instructions can execute the processing method of the extraction method of the icon information in any method embodiment. Wherein the storage medium may be a magnetic Disk, an optical Disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a Flash Memory (Flash Memory), a Hard Disk (HDD), or a Solid State Drive (SSD); the storage medium may also comprise a combination of memories of the kind described above.
Although embodiments of the present application have been described in connection with the accompanying drawings, various modifications and variations may be made by those skilled in the art without departing from the spirit and scope of the application, and such modifications and variations fall within the scope of the application as defined by the appended claims.

Claims (11)

1. The extraction method of the icon information is characterized by comprising the following steps:
acquiring a target vector drawing and determining a label area of the target vector drawing;
extracting line primitives and text primitives in the icon area;
reducing a label table based on the position relationship between the line primitive and the text primitive;
and extracting the icon information in the icon table.
2. The method of claim 1, wherein the extracting the tab information in the tab table comprises:
acquiring a tab key field and a tab key field value;
and filtering the information of the icon table based on the key field of the icon and the matching relation between the key field values of the icon, and determining the icon information corresponding to the icon table.
3. The method of claim 2, wherein the information filtering the tab form based on the tab key field and the tab key field value, determining the tab information corresponding to the tab form, comprises:
judging whether the tab key field and the tab key field value are in the same cell in the tab table or not;
when the tab key field and the tab key field value are not in the same cell in the tab table, judging whether the tab key field exists in the tab table;
when the tab key field exists in the tab table, determining a first candidate cell corresponding to the tab key field based on a preset tab knowledge base;
determining a second candidate cell corresponding to the tab key field value based on the first candidate cell corresponding to the tab key field;
filtering the second candidate cell based on the tab key field value to obtain a target cell, wherein the tab key field value of the target cell is used as the tab information;
the preset icon knowledge base is constructed based on icon features in the vector drawing.
4. The method of claim 3, wherein the information filtering the tab form based on the tab key field and the tab key field value determines tab information corresponding to the tab form, further comprising:
when the tab key field and the tab key field value are in the same cell in the tab table, judging whether the tab key field is matched with the tab key field value or not based on the preset tab knowledge base;
and when the tab key field and the tab key field value are matched, determining the tab key field and the tab key field value as the tab information.
5. A method according to claim 3, further comprising:
when the tab key field does not exist in the tab table, judging whether the tab key field value in the tab table has a corresponding matching value in the preset tab knowledge base or not;
and if the tab key field value in the tab table has a corresponding matching value in the preset tab knowledge base, taking the tab key field value as the tab information.
6. The method of claim 1, wherein the extracting line primitives and text primitives in the label area comprises:
extracting layer information of the target vector drawing and determining a target layer where the icon area is located;
acquiring each primitive contained in the target layer;
and determining the line primitives and text primitives which belong to the icons based on the position information and the type information of each primitive.
7. The method of claim 1, wherein the reducing the label table based on the positional relationship of the line primitive and the text primitive comprises:
acquiring coordinate information of a line segment corresponding to the line element, and determining an intersecting line element;
generating a table frame based on the intersecting line pattern element, and determining cell coordinates of the table frame;
and inserting the text graphic element into a cell in the table frame based on the coordinate information of the text corresponding to the text graphic element and the cell coordinate to obtain the icon table.
8. The method of claim 7, wherein the generating a table frame based on the intersecting line primitives comprises:
extracting corresponding horizontal lines and vertical lines of the intersection line figure elements;
and generating the table frame based on the first coordinate value corresponding to the horizontal line and the second coordinate value corresponding to the vertical line.
9. An extraction device of icon information, characterized by comprising:
the acquisition module is used for acquiring a target vector drawing and determining a label area of the target vector drawing;
the first extraction module is used for extracting line primitives and text primitives in the icon area;
the restoring module is used for restoring the icon table based on the position relation between the line primitive and the text primitive;
and the second extraction module is used for extracting the icon information in the icon table.
10. An electronic device, comprising:
a memory and a processor, the memory and the processor being communicatively connected to each other, the memory having stored therein computer instructions, the processor executing the computer instructions to perform the method of extracting the icon information of any one of claims 1-8.
11. A computer-readable storage medium storing computer instructions for causing a computer to perform the method of extracting tab information according to any one of claims 1 to 8.
CN202210161786.XA 2022-02-22 2022-02-22 Method, device and equipment for extracting icon information and readable storage medium Pending CN116682130A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210161786.XA CN116682130A (en) 2022-02-22 2022-02-22 Method, device and equipment for extracting icon information and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210161786.XA CN116682130A (en) 2022-02-22 2022-02-22 Method, device and equipment for extracting icon information and readable storage medium

Publications (1)

Publication Number Publication Date
CN116682130A true CN116682130A (en) 2023-09-01

Family

ID=87785980

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210161786.XA Pending CN116682130A (en) 2022-02-22 2022-02-22 Method, device and equipment for extracting icon information and readable storage medium

Country Status (1)

Country Link
CN (1) CN116682130A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117290906A (en) * 2023-11-20 2023-12-26 山东鲁浦信息技术有限公司 Picture label information replacement method and system for CAD drawing
CN117373052A (en) * 2023-12-05 2024-01-09 江西少科智能建造科技有限公司 CAD drawing frame information extraction method and system

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117290906A (en) * 2023-11-20 2023-12-26 山东鲁浦信息技术有限公司 Picture label information replacement method and system for CAD drawing
CN117373052A (en) * 2023-12-05 2024-01-09 江西少科智能建造科技有限公司 CAD drawing frame information extraction method and system
CN117373052B (en) * 2023-12-05 2024-02-23 江西少科智能建造科技有限公司 CAD drawing frame information extraction method and system

Similar Documents

Publication Publication Date Title
CN110032998B (en) Method, system, device and storage medium for detecting characters of natural scene picture
JP5665125B2 (en) Image processing method and image processing system
US11182544B2 (en) User interface for contextual document recognition
CN116682130A (en) Method, device and equipment for extracting icon information and readable storage medium
CN112560862B (en) Text recognition method and device and electronic equipment
CN111652266A (en) User interface component identification method and device, electronic equipment and storage medium
CN114005126A (en) Table reconstruction method and device, computer equipment and readable storage medium
CN115546809A (en) Table structure identification method based on cell constraint and application thereof
CN116881515B (en) Method and electronic equipment for comparing capacitance results solved by different algorithms
CN110688995B (en) Map query processing method, computer-readable storage medium and mobile terminal
CN114842482B (en) Image classification method, device, equipment and storage medium
CN111259764A (en) Text detection method and device, electronic equipment and storage device
CN113269153B (en) Form identification method and device
CN116631003A (en) Equipment identification method and device based on P & ID drawing, storage medium and electronic equipment
CN115457581A (en) Table extraction method and device and computer equipment
CN110908570B (en) Image processing method, device, terminal and storage medium
CN115186240A (en) Social network user alignment method, device and medium based on relevance information
CN114821617A (en) Door and window hole identification method, device, equipment and readable storage medium
CN113870382A (en) Automatic drawing method of curve track directional drilling section diagram
CN110490084A (en) Detection method, device, the network equipment and the storage medium of target object
CN114120016B (en) Character string extraction method, device, equipment and storage medium
CN114283437A (en) Legend identification method, device, equipment and storage medium
CN115270038A (en) Method and system for acquiring webpage similar elements of RPA system
CN114329009A (en) Method and system for constructing and searching picture index database, equipment and medium thereof
CN116166807A (en) Method, device, equipment and medium for detecting name and name based on knowledge graph

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