Citation identification method, device, equipment and storage medium

By extracting and analyzing the text and line segment position information in the CAD drawing, the baseline and text that meet the citation conditions are automatically identified, solving the problem of low citation search efficiency in the drawing, and achieving efficient and accurate citation recognition.

CN115116084BActive Publication Date: 2024-11-15深圳市万翼数字技术有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210877437.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-25
Publication Date
2024-11-15
Estimated Expiration
2042-07-25

AI Technical Summary

Technical Problem

The invocation search in CAD drawings is inefficient and requires manual search, which is easy to miss and consumes manpower.

Method used

By extracting the text and line segment position information in the drawing, find target baselines and text that meet the citation conditions, automatically identify citations, and improve search efficiency and accuracy.

Benefits of technology

It realizes automated search of citations, improves efficiency and accuracy, avoids omissions, and ensures the integrity of citations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115116084B_ABST
    Figure CN115116084B_ABST
Patent Text Reader

Abstract

The present application relates to a method, device, equipment and storage medium for identifying citations, and relates to the field of drawing identification. The citation identification method includes: extracting the first position information of the text and the second position information of the line segment in the drawing; searching for the target line segment in the first preset area near the text according to the first position information and the second position information; searching for the target baseline that meets the citation conditions from the target line segment, and determining the target lead line corresponding to the target baseline; obtaining the third position information of the target baseline, and searching for the complete text in the second preset area near the target baseline according to the third position information and the first position information; searching for the target text that meets the citation conditions from the complete text; identifying the target baseline, the target lead line and the target text as citations. The present application is used to solve the problem of low efficiency in searching for citations in drawings.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of drawing recognition, and in particular to a method, device, equipment and storage medium for citation recognition. Background Art

[0002] CAD (Computer Aided Design) drawings include a large number of annotations, which generally include line segments and texts, and are used to indicate the attribute information of building components or spaces.

[0003] The references in the CAD drawings need to be searched manually, and it is impossible to quickly find each reference in the CAD drawings. The efficiency of searching for references is low, and it is easy to miss them, which consumes manpower. Summary of the invention

[0004] The present application provides a method, device, equipment and storage medium for identifying references, so as to solve the problem of low efficiency in searching for references in drawings.

[0005] In a first aspect, an embodiment of the present application provides a method for identifying a reference, including:

[0006] Extracting first position information of text and second position information of line segments in the drawing;

[0007] Searching for a target line segment in a first preset area near the text according to the first position information and the second position information;

[0008] Find a target baseline that meets the lead-in condition from the target line segment, and determine a target lead-in line corresponding to the target baseline;

[0009] Acquire third position information of the target baseline, and search for complete text in a second preset area near the target baseline according to the third position information and the first position information;

[0010] Searching for a target text that meets the citation condition from the complete text;

[0011] The target baseline, the target leader, and the target text are identified as annotations.

[0012] Optionally, searching for a target baseline that meets the lead-in condition from the target line segment and determining a target lead-in line corresponding to the target baseline includes:

[0013] Obtaining vertex information of the target line segment;

[0014] Determine candidate baselines and candidate leading lines according to vertex information of the target line segment;

[0015] Acquire fourth position information of the candidate baseline, and determine the target baseline that meets the injection condition from the candidate baselines according to the first position information and the fourth position information;

[0016] The candidate lead corresponding to the target baseline is used as the target lead.

[0017] Optionally, the vertex information includes the number of line segments connected to the vertex;

[0018] The step of determining a candidate baseline and a candidate lead line according to vertex information of the target line segment comprises:

[0019] Determine the categories of the two vertices of the target line segment according to the number of line segments respectively connected to the two vertices of the target line segment, wherein the category includes one of a starting point, a turning point, and an end point;

[0020] In the case where the categories of the two vertices of the target line segment are respectively a starting point and a turning point, obtaining the candidate vertices connected by the turning point and the attribute information of the candidate vertices, obtaining the attribute information of the turning point, taking the candidate vertices other than the starting point that are consistent with the attribute information of the turning point as the end point, taking the target line segment as the candidate baseline, and taking the line segment formed by the turning point and the end point as the candidate leader;

[0021] In the case that the categories of the two vertices of the target line segment are the starting point and the end point respectively, the target line segment is used as the candidate baseline, and the candidate leader is empty.

[0022] Optionally, determining the categories of the two vertices of the target line segment according to the number of line segments respectively connected to the two vertices of the target line segment includes:

[0023] When the number of line segments connected to the two vertices of the target line segment is equal to 1, determining that the categories of the two vertices of the target line segment are respectively a starting point and an end point;

[0024] When the number of line segments connected to a vertex in the target line segment is equal to 1, and the number of line segments connected to another vertex is greater than or equal to 2, the category of the one vertex is determined to be a starting point, and the category of the other vertex is determined to be a turning point.

[0025] Optionally, determining the target baseline that meets the injection condition from the candidate baselines according to the first position information and the fourth position information includes:

[0026] Acquire the writing direction of the text according to the first position information;

[0027] Acquire the direction of the candidate baseline according to the fourth position information;

[0028] Calculating the angle between the writing direction of the text and the direction of the candidate baseline;

[0029] Acquire a projection of the text on the candidate baseline according to the first position information and the fourth position information;

[0030] Acquire a vertical distance between the text and the candidate baseline according to the first position information and the fourth position information;

[0031] The candidate baseline whose included angle is smaller than a first threshold, whose projection is larger than a second threshold, and whose vertical distance is smaller than a third threshold is used as the target baseline.

[0032] Optionally, the second position information of the line segment includes a first line segment abscissa value and a first line segment ordinate value of a vertex in the line segment, and a second line segment abscissa value and a second line segment ordinate value of another vertex;

[0033] The searching, according to the first position information and the second position information, for a target line segment in a first preset area near the text comprises:

[0034] Sort each line segment according to the first line segment horizontal coordinate value from small to large to obtain a first line segment sorting sequence, sort each line segment according to the first line segment vertical coordinate value from small to large to obtain a second line segment sorting sequence, sort each line segment according to the second line segment horizontal coordinate value from small to large to obtain a third line segment sorting sequence, sort each line segment according to the second line segment vertical coordinate value from small to large to obtain a fourth line segment sorting sequence;

[0035] According to the first position information, acquiring a first preset line segment abscissa value, a first preset line segment ordinate value, a second preset line segment abscissa value, and a second preset line segment ordinate value of a first preset area near the text;

[0036] Determine a first line segment set from the first line segment sorting sequence according to the first preset line segment abscissa value and the second preset line segment abscissa value, determine a second line segment set from the third line segment sorting sequence, determine a third line segment set from the second line segment sorting sequence according to the first preset line segment ordinate value and the second preset line segment ordinate value, and determine a fourth line segment set from the fourth line segment sorting sequence;

[0037] The intersection of the first line segment set, the second line segment set, the third line segment set and the fourth line segment set is used as the target line segment.

[0038] Optionally, the first position information of the text includes a first text abscissa value and a first text ordinate value of a vertex in a preset diagonal line in the text, and a second text abscissa value and a second text ordinate value of another vertex;

[0039] The searching for complete text in a second preset area near the target baseline according to the third position information and the first position information includes:

[0040] Sort the texts according to the first text horizontal coordinate value from small to large to obtain a first text sorting sequence, sort the texts according to the first text vertical coordinate value from small to large to obtain a second text sorting sequence, sort the texts according to the second text horizontal coordinate value from small to large to obtain a third text sorting sequence, and sort the texts according to the second text vertical coordinate value from small to large to obtain a fourth text sorting sequence;

[0041] According to the third position information, a first preset text horizontal coordinate value, a first preset text vertical coordinate value, a second preset text horizontal coordinate value, and a second preset text vertical coordinate value of a second preset area near the target baseline are acquired;

[0042] Determine a first text set from the first text sorting sequence according to the first preset text horizontal coordinate value and the second preset text horizontal coordinate value, determine a second text set from the third text sorting sequence, determine a third text set from the second text sorting sequence according to the first preset text vertical coordinate value and the second preset text vertical coordinate value, and determine a fourth text set from the fourth text sorting sequence;

[0043] The intersection of the first text set, the second text set, the third text set and the fourth text set is taken as the complete text.

[0044] In a second aspect, an embodiment of the present application provides a device for identifying an injection, comprising:

[0045] An extraction module, used for extracting first position information of text and second position information of line segments in a drawing;

[0046] A first search module, configured to search for a target line segment in a first preset area near the text according to the first position information and the second position information;

[0047] A second search module is used to search for a target baseline that meets the lead-in condition from the target line segment, and determine a target lead-in line corresponding to the target baseline;

[0048] A third search module, configured to obtain third position information of the target baseline, and search for complete text in a second preset area near the target baseline according to the third position information and the first position information;

[0049] A fourth search module, used for searching the target text that meets the citation condition from the complete text;

[0050] A recognition module is used to recognize the target baseline, the target leader and the target text as annotations.

[0051] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a memory, and a communication bus, wherein the processor and the memory communicate with each other via the communication bus;

[0052] The memory is used to store computer programs;

[0053] The processor is used to execute the program stored in the memory to implement the citation identification method described in the first aspect.

[0054] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the citation identification method described in the first aspect.

[0055] The above technical solution provided by the embodiment of the present application has the following advantages compared with the prior art: In the embodiment of the present application, the first position information of the text and the second position information of the line segment in the drawing are extracted, and according to the first position information and the second position information, the target line segment in the first preset area near the text is searched, and the target baseline that meets the citation condition is searched from the target line segment, and the target lead line corresponding to the target baseline is determined, and the third position information of the target baseline is obtained, and according to the third position information and the first position information, the complete text in the second preset area near the target baseline is searched, and the target text that meets the citation condition is searched from the complete text, and the target baseline, the target lead line and the target text are identified as citations. The present application first searches for the target line segment in the first preset area near the text, searches for the target baseline that meets the citation condition from the target line segment, and then searches for the complete text in the second preset area near the target baseline, and searches for the target text that meets the citation condition from the complete text, and can automatically search for citations, and the found citations meet the citation conditions, without the need for manual search for citations, thereby improving the efficiency and accuracy of citation search and avoiding missing citations. Moreover, after finding the target baseline, the complete text in the second preset area near the target baseline is continued to be searched, and the target text that meets the citation conditions is searched from the complete text, which can avoid missing the text in the citation and ensure the integrity of the found citation. This solves the problem of low efficiency in citation search in drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] 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.

[0057] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0058] Figure 1 This is a schematic diagram of the method flow of annotation identification in the embodiment of the present application;

[0059] Figure 2 A schematic diagram of a single-baseline single-lead lead, a single-baseline multi-lead lead, and a single-baseline lead in a specific embodiment of the present application;

[0060] Figure 3 This is a flow chart of a method for finding a target baseline and a target lead in a specific embodiment of the present application;

[0061] Figure 4 A schematic diagram of a method flow for determining a target baseline that meets the injection conditions from candidate baselines in a specific embodiment of the present application;

[0062] Figure 5 This is a schematic diagram of the structure of the citation identification device in the embodiment of the present application;

[0063] Figure 6 Schematic diagram of the structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION

[0064] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0065] In the embodiment of the present application, a method for identifying a reference is provided, which can be applied to a server, and of course, can also be applied to other electronic devices, such as terminals (mobile phones, tablet computers, etc.). In the embodiment of the present application, the method is applied to a server as an example for description.

[0066] In the present application embodiment, Figure 1 As shown in the figure, the method flow of citation identification mainly includes:

[0067] Step 101: extract first position information of text and second position information of line segments in a drawing.

[0068] To extract the first position information of the text and the second position information of the line segment in the drawing, the graphics elements in the drawing may be preprocessed first, the line segments, arcs and text graphics elements required for formatting may be extracted, repeated line segments may be merged and the error values ​​between the line segments with the same vertices may be eliminated, and then the first position information of the text and the second position information of the line segment may be extracted for the preprocessed graphics elements.

[0069] Step 102: searching for a target line segment in a first preset area near the text according to the first position information and the second position information.

[0070] The first preset area near the text may be a first preset area formed by points whose distance from the text is less than a first distance threshold. The first distance threshold may be an empirical value or a value obtained through multiple experiments.

[0071] In a specific embodiment, the second position information of the line segment includes a first line segment abscissa value and a first line segment ordinate value of a vertex in the line segment, and a second line segment abscissa value and a second line segment ordinate value of another vertex in the line segment.

[0072] In a specific embodiment, searching for a target line segment in a first preset area near the text according to the first position information and the second position information includes: sorting each line segment according to the first line segment horizontal coordinate value from small to large to obtain a first line segment sorting sequence, sorting each line segment according to the first line segment vertical coordinate value from small to large to obtain a second line segment sorting sequence, sorting each line segment according to the second line segment horizontal coordinate value from small to large to obtain a third line segment sorting sequence, sorting each line segment according to the second line segment vertical coordinate value from small to large to obtain a fourth line segment sorting sequence; obtaining the first preset area near the text according to the first position information. The first preset line segment horizontal coordinate value, the first preset line segment vertical coordinate value, the second preset line segment horizontal coordinate value and the second preset line segment vertical coordinate value of the domain; according to the first preset line segment horizontal coordinate value and the second preset line segment horizontal coordinate value, determine the first line segment set from the first line segment sorting sequence, determine the second line segment set from the third line segment sorting sequence, according to the first preset line segment vertical coordinate value and the second preset line segment vertical coordinate value, determine the third line segment set from the second line segment sorting sequence, and determine the fourth line segment set from the fourth line segment sorting sequence; take the intersection of the first line segment set, the second line segment set, the third line segment set and the fourth line segment set as the target line segment.

[0073] Each line segment is sorted according to the four coordinate values ​​of the line segment to obtain a first line segment sorting sequence, a second line segment sorting sequence, a third line segment sorting sequence and a fourth line segment sorting sequence, so as to facilitate the subsequent search for the target line segment according to the four coordinate values ​​of the first preset area, without having to compare the coordinate value of each line segment with the coordinate value of the first preset area, especially when there are a large number of line segments in the drawing, which can greatly improve the search efficiency of the target line segment, thereby improving the efficiency of the reference search.

[0074] Specifically, according to the first preset line segment horizontal coordinate value and the second preset line segment horizontal coordinate value, a first line segment set is determined from the first line segment sorting sequence, and a second line segment set is determined from the third line segment sorting sequence. According to the first preset line segment vertical coordinate value and the second preset line segment vertical coordinate value, a third line segment set is determined from the second line segment sorting sequence, and a fourth line segment set is determined from the fourth line segment sorting sequence. It can be that the line segment whose first line segment horizontal coordinate value is greater than the first preset line segment horizontal coordinate value and less than the second preset line segment horizontal coordinate value is searched in the first line segment sorting sequence as the first line segment set, and the line segment whose second line segment horizontal coordinate value is searched in the third line segment sorting sequence as the second line segment set. The line segments whose coordinate values ​​are greater than the first preset line segment horizontal coordinate value and less than the second preset line segment horizontal coordinate value are taken as the second line segment set, and the line segments whose first line segment vertical coordinate values ​​are greater than the first preset line segment vertical coordinate value and less than the second preset line segment vertical coordinate value are searched in the second line segment sorting sequence as the third line segment set, and the line segments whose second line segment vertical coordinate values ​​are greater than the first preset line segment vertical coordinate value and less than the second preset line segment vertical coordinate value are searched in the fourth line segment sorting sequence as the fourth line segment set; wherein the first preset line segment horizontal coordinate value is less than the second preset line segment horizontal coordinate value, and the first preset line segment vertical coordinate value is less than the second preset line segment vertical coordinate value.

[0075] Specifically, a binary search method may be used to determine the first line segment set, the second line segment set, the third line segment set, and the fourth line segment set, which can further improve the search efficiency of the target line segment.

[0076] Specifically, before sorting each line segment according to the horizontal coordinate value of the first line segment from small to large to obtain a first line segment sorting sequence, sorting each line segment according to the vertical coordinate value of the first line segment from small to large to obtain a second line segment sorting sequence, sorting each line segment according to the horizontal coordinate value of the second line segment from small to large to obtain a third line segment sorting sequence, and sorting each line segment according to the vertical coordinate value of the second line segment from small to large to obtain a fourth line segment sorting sequence, the four coordinate values ​​of each line segment can be sorted first, and priority can be given to ensuring that the horizontal coordinate value of the sorted first line segment is less than the horizontal coordinate value of the second line segment. When the horizontal coordinate value of the first line segment is equal to the horizontal coordinate value of the second line segment, ensure that the vertical coordinate value of the first line segment is less than the vertical coordinate value of the second line segment, so as to facilitate the subsequent search for the target line segment according to the four coordinate values ​​of the first preset area, and further improve the search efficiency of the target line segment.

[0077] Step 103, searching the target baseline that meets the lead-in condition from the target line segment, and determining the target lead-in line corresponding to the target baseline.

[0078] Among them, meeting the introduction conditions refers to satisfying the geometric characteristics of the introduction.

[0079] In a specific embodiment, a caption is defined as consisting of a baseline, a leader line, and text. The baseline refers to a horizontal line, and the leader line refers to an oblique line. There may also be only a baseline and text, and the text is around the baseline. The distance between the text and the baseline has a certain threshold. The baseline and leader line of the caption can be divided into a starting point, a turning point, and an end point. The end point is also called a pointing point, which points to a building component or space. Figure 2 The figure shows the schematic diagram of the annotation of single baseline single leader line, the annotation of single baseline multiple leaders and the annotation of single baseline. Among them, the number of line segments connected to the starting point is equal to 1, the number of line segments connected to the end point is equal to 1, and the number of line segments connected to the inflection point is greater than or equal to 2.

[0080] In a specific embodiment, Figure 3 As shown, a target baseline that meets the lead-in condition is found from the target line segment, and a target lead line corresponding to the target baseline is determined, including:

[0081] Step 301, obtaining vertex information of a target line segment.

[0082] Step 302: Determine candidate baselines and candidate lead lines according to vertex information of the target line segment.

[0083] In a specific embodiment, the vertex information includes the number of line segments connected by the vertex. Determining the candidate baseline and the candidate leader according to the vertex information of the target line segment includes: determining the categories of the two vertices of the target line segment according to the number of line segments connected by the two vertices of the target line segment, wherein the category includes one of a starting point, a turning point, and an end point; when the categories of the two vertices of the target line segment are the starting point and the turning point, respectively, obtaining the candidate vertices connected by the turning point and the attribute information of the candidate vertices, obtaining the attribute information of the turning point, taking the candidate vertices other than the starting point that are consistent with the attribute information of the turning point as the end point, taking the target line segment as the candidate baseline, and taking the line segment formed by the turning point and the end point as the candidate leader; when the categories of the two vertices of the target line segment are the starting point and the end point, respectively, taking the target line segment as the candidate baseline, and the candidate leader is empty.

[0084] A hash table-1 of "vertex-number of line segments connected to the vertex" can be pre-constructed to query the number of line segments connected to a certain line segment vertex; a hash table-2 of "vertex-vertices connected to the vertex" can be constructed to query the vertices connected to a certain line segment vertex and the attribute information of the connected vertices, wherein the attribute information includes layer, color and line type information.

[0085] When the categories of the two vertices of the target line segment are the starting point and the inflection point respectively, the attribute information of the inflection point is obtained, and the candidate vertex other than the starting point that is consistent with the attribute information of the inflection point is used as the end point. According to the attribute information, interfering line segments can be further eliminated to ensure the accuracy of the candidate leads found.

[0086] When the categories of the two vertices of the target line segment are the starting point and the inflection point, respectively, it indicates that the annotation to be searched is the annotation of a single-baseline single-leader or the annotation of a single-baseline multi-leader. When the categories of the two vertices of the target line segment are the starting point and the end point, respectively, it indicates that the annotation to be searched is a single-baseline annotation.

[0087] In a specific embodiment, the categories of the two vertices of the target line segment are determined according to the number of line segments respectively connected to the two vertices of the target line segment, including: when the number of line segments respectively connected to the two vertices of the target line segment is equal to 1, the categories of the two vertices of the target line segment are determined to be the starting point and the end point respectively; when the number of line segments connected to a vertex in the target line segment is equal to 1, and the number of line segments connected to the other vertex is greater than or equal to 2, the category of one vertex is determined to be the starting point, and the category of the other vertex is determined to be the inflection point.

[0088] When the number of line segments connected to the two vertices of the target line segment is equal to 1, it indicates that the annotation to be searched is a single-baseline annotation. When the number of line segments connected to a vertex in the target line segment is equal to 1, and the number of line segments connected to the other vertex is greater than or equal to 2, it indicates that the annotation to be searched is a single-baseline single-leader annotation or a single-baseline multiple-leader annotation. Among them, when the number of line segments connected to a vertex in the target line segment is equal to 1, and the number of line segments connected to the other vertex is equal to 2, it indicates that the annotation to be searched is a single-baseline single-leader annotation; when the number of line segments connected to a vertex in the target line segment is equal to 1, and the number of line segments connected to the other vertex is greater than 2, it indicates that the annotation to be searched is a single-baseline multiple-leader annotation.

[0089] Step 303: Acquire the fourth position information of the candidate baselines, and determine the target baseline that meets the injection condition from the candidate baselines according to the first position information and the fourth position information.

[0090] In a specific embodiment, Figure 4 As shown, according to the first position information and the fourth position information, determining a target baseline that meets the injection condition from the candidate baselines includes:

[0091] Step 401, obtaining the writing direction of the text according to the first position information.

[0092] Acquiring the writing direction of the text according to the first position information may be to determine the writing direction of the text according to the coordinates of four vertices of the text.

[0093] Step 402: Obtain the direction of the candidate baseline according to the fourth position information.

[0094] Step 403: Calculate the angle between the writing direction of the text and the direction of the candidate baseline.

[0095] Step 404: Obtain a projection of the text on the candidate baseline according to the first position information and the fourth position information.

[0096] Step 405: Obtain a vertical distance between the text and the candidate baseline according to the first position information and the fourth position information.

[0097] Step 406: The candidate baseline whose angle is smaller than the first threshold, whose projection is larger than the second threshold, and whose vertical distance is smaller than the third threshold is taken as the target baseline.

[0098] The first threshold value may be an empirical value or a value obtained through multiple tests, the second threshold value may be an empirical value or a value obtained through multiple tests, and the third threshold value may be an empirical value or a value obtained through multiple tests. For example, the first threshold value is 5 degrees, the second threshold value is 0.75, and the third threshold value is the text height. If the angle is less than the first threshold value, it means that the writing direction of the text is approximately parallel to the candidate baseline.

[0099] The candidate baseline with an angle less than the first threshold, a projection greater than the second threshold and a vertical distance less than the third threshold is used as the target baseline. The target baseline that meets the geometric features of the annotation can be selected, and the interfering line segments can be further eliminated to ensure the accuracy of the target baseline found.

[0100] Step 304: Use the candidate lead corresponding to the target baseline as the target lead.

[0101] Specifically, the candidate lead connected to the target baseline is used as the target lead.

[0102] Step 104 , obtaining third position information of the target baseline, and searching for complete text in a second preset area near the target baseline according to the third position information and the first position information.

[0103] The second preset area near the target baseline may be a second preset area formed by points whose distance from the target baseline is less than a second distance threshold. The second distance threshold may be an empirical value or a value obtained through multiple tests.

[0104] After finding the target baseline, continuing to search for complete text in a second preset area near the target baseline can avoid missing text in the citation and ensure the completeness of the found citation.

[0105] In a specific embodiment, the first position information of the text includes a first text horizontal coordinate value and a first text vertical coordinate value of a vertex in a preset diagonal line in the text, and a second text horizontal coordinate value and a second text vertical coordinate value of another vertex.

[0106] The text in the drawing is parsed into a bounding box surrounded by 4 vertices, so the search for text can be roughly equivalent to the search for a preset diagonal line in the text. The preset diagonal line can be a line segment formed by connecting the lower left vertex and the upper right vertex of the text, or a line segment formed by connecting the upper left vertex and the lower right vertex of the text.

[0107] In a specific embodiment, searching for complete text in a second preset area near a target baseline according to the third position information and the first position information includes: sorting each text according to the first text horizontal coordinate value from small to large to obtain a first text sorting sequence, sorting each text according to the first text vertical coordinate value from small to large to obtain a second text sorting sequence, sorting each text according to the second text horizontal coordinate value from small to large to obtain a third text sorting sequence, and sorting each text according to the second text vertical coordinate value from small to large to obtain a fourth text sorting sequence; obtaining the first preset text horizontal coordinate value, the first preset text vertical coordinate value, the second preset text horizontal coordinate value, and the second preset text vertical coordinate value of the second preset area near the target baseline according to the third position information; determining a first text set from the first text sorting sequence according to the first preset text horizontal coordinate value and the second preset text horizontal coordinate value, determining a second text set from the third text sorting sequence, determining a third text set from the second text sorting sequence according to the first preset text vertical coordinate value and the second preset text vertical coordinate value, and determining a fourth text set from the fourth text sorting sequence; and taking the intersection of the first text set, the second text set, the third text set, and the fourth text set as the complete text.

[0108] The texts are sorted according to the four coordinate values ​​of the preset diagonal lines to obtain the first text sorting sequence, the second text sorting sequence, the third text sorting sequence and the fourth text sorting sequence, so as to facilitate the subsequent search for the complete text according to the four coordinate values ​​of the second preset area, without having to compare the coordinate value of each text with the coordinate value of the second preset area. Especially when there are a large number of texts in the drawing, the search efficiency of the complete text can be greatly improved, thereby improving the efficiency of citation search.

[0109] Specifically, according to the first preset text horizontal coordinate value and the second preset text horizontal coordinate value, a first text set is determined from the first text sorting sequence, a second text set is determined from the third text sorting sequence, according to the first preset text vertical coordinate value and the second preset text vertical coordinate value, a third text set is determined from the second text sorting sequence, and a fourth text set is determined from the fourth text sorting sequence. It can be that the first text sorting sequence is searched for texts whose first text horizontal coordinate values ​​are greater than the first preset text horizontal coordinate value and less than the second preset text horizontal coordinate value as the first text set, the third text sorting sequence is searched for texts whose second text horizontal coordinate values ​​are greater than the first preset text horizontal coordinate value and less than the second preset text horizontal coordinate value as the second text set, the second text sorting sequence is searched for texts whose first text vertical coordinate values ​​are greater than the first preset text vertical coordinate value and less than the second preset text vertical coordinate value as the third text set, and the fourth text sorting sequence is searched for texts whose second text vertical coordinate values ​​are greater than the first preset text vertical coordinate value and less than the second preset text vertical coordinate value as the fourth text set; wherein the first preset text horizontal coordinate value is less than the second preset text horizontal coordinate value, and the first preset text vertical coordinate value is less than the second preset text vertical coordinate value.

[0110] Specifically, a binary search method may be used to determine the first text set, the second text set, the third text set, and the fourth text set, which can further improve the search efficiency of the complete text.

[0111] Step 105, searching the complete text for a target text that meets the citation conditions.

[0112] The specific process of finding the target text that meets the citation conditions from the complete text is similar to the specific process of determining the target baseline that meets the citation conditions from the candidate baselines.

[0113] Searching for a target text that meets the citation conditions from a complete text includes: obtaining the writing direction of the complete text, obtaining the direction of a target baseline, calculating the angle between the writing direction of the complete text and the direction of the target baseline, obtaining the projection of the complete text on the target baseline, obtaining the vertical distance between the complete text and the target baseline, and taking the complete text whose angle is less than a first threshold, whose projection is greater than a second threshold, and whose vertical distance is less than a third threshold as the target text.

[0114] The complete text with an angle less than the first threshold, a projection greater than the second threshold and a vertical distance less than the third threshold is taken as the target text, so that the target text that meets the geometric features of the citation can be selected, and the interference text can be further eliminated to ensure the accuracy of the target text found.

[0115] Step 106, identifying the target baseline, target leader line and target text as annotations.

[0116] In summary, the present application first searches for a target line segment in the first preset area near the text, searches for a target baseline that meets the citation conditions from the target line segment, then searches for the complete text in the second preset area near the target baseline, searches for the target text that meets the citation conditions from the complete text, and can automatically search for citations. The citations found meet the citation conditions, and there is no need to manually search for citations, thereby improving the efficiency and accuracy of citation search and avoiding missing citations. Moreover, after finding the target baseline, continue to search for the complete text in the second preset area near the target baseline, and search for the target text that meets the citation conditions from the complete text, thereby avoiding missing text in the citation and ensuring the integrity of the found citations. The problem of low efficiency in searching for citations in drawings is solved.

[0117] Based on the same concept, an injection identification device is provided in the embodiment of the present application. The specific implementation of the device can be found in the description of the method embodiment part, and the repeated parts will not be repeated. Figure 5 As shown, the device mainly includes:

[0118] An extraction module 501 is used to extract first position information of text and second position information of line segments in a drawing;

[0119] A first search module 502, configured to search for a target line segment in a first preset area near the text according to the first position information and the second position information;

[0120] The second search module 503 is used to search for a target baseline that meets the lead-in condition from the target line segment, and determine a target lead-in line corresponding to the target baseline;

[0121] A third search module 504 is used to obtain third position information of the target baseline, and search for complete text in a second preset area near the target baseline according to the third position information and the first position information;

[0122] A fourth search module 505 is used to search the target text that meets the citation condition from the complete text;

[0123] The identification module 506 is used to identify the target baseline, the target leader line and the target text as annotations.

[0124] Based on the same concept, an electronic device is also provided in the embodiment of the present application, such as Figure 6 As shown, the electronic device mainly includes: a processor 601, a memory 602 and a communication bus 603, wherein the processor 601 and the memory 602 communicate with each other through the communication bus 603. The memory 602 stores a program executable by the processor 601, and the processor 601 executes the program stored in the memory 602 to implement the following steps:

[0125] Extract the first position information of the text and the second position information of the line segment in the drawing; search for the target line segment in the first preset area near the text according to the first position information and the second position information; search for the target baseline that meets the citation conditions from the target line segment, and determine the target lead line corresponding to the target baseline; obtain the third position information of the target baseline, and search for the complete text in the second preset area near the target baseline according to the third position information and the first position information; search for the target text that meets the citation conditions from the complete text; identify the target baseline, the target lead line and the target text as citations.

[0126] The communication bus 603 mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The communication bus 603 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0127] The memory 602 may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the processor 601.

[0128] The above-mentioned processor 601 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc., and can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.

[0129] In another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed on a computer, the computer executes the citation identification method described in the above embodiment.

[0130] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can 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 the computer instruction is loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instruction can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instruction is transmitted from a website site, a computer, a server or a data center by wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, a data center, etc. that contains one or more available media integration. The available medium can be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape, etc.), an optical medium (such as a DVD) or a semiconductor medium (such as a solid-state hard disk), etc.

[0131] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0132] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A method for identifying a reference, characterized in that: include: Extracting first position information of text and second position information of line segments in the drawing; Searching for a target line segment in a first preset area near the text according to the first position information and the second position information; Find a target baseline that meets the lead-in condition from the target line segment, and determine a target lead-in line corresponding to the target baseline; Acquire third position information of the target baseline, and search for complete text in a second preset area near the target baseline according to the third position information and the first position information; Searching for a target text that meets the citation condition from the complete text; identifying the target baseline, the target leader, and the target text as annotations; The step of searching for a target baseline that meets the lead-in condition from the target line segment and determining a target lead-in line corresponding to the target baseline includes: Obtaining vertex information of the target line segment; Determine candidate baselines and candidate leading lines according to vertex information of the target line segment; Acquire fourth position information of the candidate baseline, and determine the target baseline that meets the injection condition from the candidate baselines according to the first position information and the fourth position information; Taking the candidate lead corresponding to the target baseline as the target lead; The step of determining the target baseline that meets the injection condition from the candidate baselines according to the first position information and the fourth position information includes: Acquire the writing direction of the text according to the first position information; Acquire the direction of the candidate baseline according to the fourth position information; Calculating the angle between the writing direction of the text and the direction of the candidate baseline; Acquire a projection of the text on the candidate baseline according to the first position information and the fourth position information; Acquire a vertical distance between the text and the candidate baseline according to the first position information and the fourth position information; The candidate baseline whose angle is smaller than a first threshold, whose projection is larger than a second threshold, and whose vertical distance is smaller than a third threshold is used as the target baseline; The second position information of the line segment includes a first line segment abscissa value and a first line segment ordinate value of a vertex in the line segment, and a second line segment abscissa value and a second line segment ordinate value of another vertex; The searching, according to the first position information and the second position information, for a target line segment in a first preset area near the text comprises: Sort each line segment according to the first line segment horizontal coordinate value from small to large to obtain a first line segment sorting sequence, sort each line segment according to the first line segment vertical coordinate value from small to large to obtain a second line segment sorting sequence, sort each line segment according to the second line segment horizontal coordinate value from small to large to obtain a third line segment sorting sequence, sort each line segment according to the second line segment vertical coordinate value from small to large to obtain a fourth line segment sorting sequence; According to the first position information, acquiring a first preset line segment abscissa value, a first preset line segment ordinate value, a second preset line segment abscissa value, and a second preset line segment ordinate value of a first preset area near the text; Determine a first line segment set from the first line segment sorting sequence according to the first preset line segment abscissa value and the second preset line segment abscissa value, determine a second line segment set from the third line segment sorting sequence, determine a third line segment set from the second line segment sorting sequence according to the first preset line segment ordinate value and the second preset line segment ordinate value, and determine a fourth line segment set from the fourth line segment sorting sequence; Taking the intersection of the first line segment set, the second line segment set, the third line segment set and the fourth line segment set as the target line segment; The first position information of the text includes a first text abscissa value and a first text ordinate value of a vertex in a preset diagonal line in the text, and a second text abscissa value and a second text ordinate value of another vertex; The searching for complete text in a second preset area near the target baseline according to the third position information and the first position information includes: Sort the texts according to the first text horizontal coordinate value from small to large to obtain a first text sorting sequence, sort the texts according to the first text vertical coordinate value from small to large to obtain a second text sorting sequence, sort the texts according to the second text horizontal coordinate value from small to large to obtain a third text sorting sequence, and sort the texts according to the second text vertical coordinate value from small to large to obtain a fourth text sorting sequence; According to the third position information, a first preset text horizontal coordinate value, a first preset text vertical coordinate value, a second preset text horizontal coordinate value, and a second preset text vertical coordinate value of a second preset area near the target baseline are acquired; Determine a first text set from the first text sorting sequence according to the first preset text horizontal coordinate value and the second preset text horizontal coordinate value, determine a second text set from the third text sorting sequence, determine a third text set from the second text sorting sequence according to the first preset text vertical coordinate value and the second preset text vertical coordinate value, and determine a fourth text set from the fourth text sorting sequence; The intersection of the first text set, the second text set, the third text set and the fourth text set is used as the complete text.

2. The method for identifying an injection according to claim 1, characterized in that: The vertex information includes the number of line segments connected to the vertex; The step of determining a candidate baseline and a candidate lead line according to vertex information of the target line segment comprises: Determine the categories of the two vertices of the target line segment according to the number of line segments respectively connected to the two vertices of the target line segment, wherein the category includes one of a starting point, a turning point, and an end point; In the case where the categories of the two vertices of the target line segment are respectively a starting point and a turning point, obtaining the candidate vertices connected by the turning point and the attribute information of the candidate vertices, obtaining the attribute information of the turning point, taking the candidate vertices other than the starting point that are consistent with the attribute information of the turning point as the end point, taking the target line segment as the candidate baseline, and taking the line segment formed by the turning point and the end point as the candidate leader; In the case that the categories of the two vertices of the target line segment are the starting point and the end point respectively, the target line segment is used as the candidate baseline, and the candidate leader is empty.

3. The method for identifying the introduction according to claim 2, characterized in that: The determining the categories of the two vertices of the target line segment according to the number of line segments respectively connected to the two vertices of the target line segment comprises: When the number of line segments connected to the two vertices of the target line segment is equal to 1, determining that the categories of the two vertices of the target line segment are respectively a starting point and an end point; When the number of line segments connected to a vertex in the target line segment is equal to 1, and the number of line segments connected to another vertex is greater than or equal to 2, the category of the one vertex is determined to be a starting point, and the category of the other vertex is determined to be a turning point.

4. A device for identifying injection, characterized in that: include: An extraction module, used for extracting first position information of text and second position information of line segments in a drawing; A first search module, configured to search for a target line segment in a first preset area near the text according to the first position information and the second position information; A second search module is used to search for a target baseline that meets the lead-in condition from the target line segment, and determine a target lead-in line corresponding to the target baseline; A third search module, configured to obtain third position information of the target baseline, and search for complete text in a second preset area near the target baseline according to the third position information and the first position information; A fourth search module, used for searching the target text that meets the citation condition from the complete text; an identification module, for identifying the target baseline, the target lead line and the target text as annotations; The step of searching for a target baseline that meets the lead-in condition from the target line segment and determining a target lead-in line corresponding to the target baseline includes: Obtaining vertex information of the target line segment; Determine candidate baselines and candidate leading lines according to vertex information of the target line segment; Acquire fourth position information of the candidate baseline, and determine the target baseline that meets the injection condition from the candidate baselines according to the first position information and the fourth position information; Taking the candidate lead corresponding to the target baseline as the target lead; The step of determining the target baseline that meets the injection condition from the candidate baselines according to the first position information and the fourth position information includes: Acquire the writing direction of the text according to the first position information; Acquire the direction of the candidate baseline according to the fourth position information; Calculating the angle between the writing direction of the text and the direction of the candidate baseline; Acquire a projection of the text on the candidate baseline according to the first position information and the fourth position information; Acquire a vertical distance between the text and the candidate baseline according to the first position information and the fourth position information; The candidate baseline whose angle is smaller than a first threshold, whose projection is larger than a second threshold, and whose vertical distance is smaller than a third threshold is used as the target baseline; The second position information of the line segment includes a first line segment abscissa value and a first line segment ordinate value of a vertex in the line segment, and a second line segment abscissa value and a second line segment ordinate value of another vertex; The searching, according to the first position information and the second position information, for a target line segment in a first preset area near the text comprises: Sort each line segment according to the first line segment horizontal coordinate value from small to large to obtain a first line segment sorting sequence, sort each line segment according to the first line segment vertical coordinate value from small to large to obtain a second line segment sorting sequence, sort each line segment according to the second line segment horizontal coordinate value from small to large to obtain a third line segment sorting sequence, sort each line segment according to the second line segment vertical coordinate value from small to large to obtain a fourth line segment sorting sequence; According to the first position information, acquiring a first preset line segment abscissa value, a first preset line segment ordinate value, a second preset line segment abscissa value, and a second preset line segment ordinate value of a first preset area near the text; Determine a first line segment set from the first line segment sorting sequence according to the first preset line segment abscissa value and the second preset line segment abscissa value, determine a second line segment set from the third line segment sorting sequence, determine a third line segment set from the second line segment sorting sequence according to the first preset line segment ordinate value and the second preset line segment ordinate value, and determine a fourth line segment set from the fourth line segment sorting sequence; Taking the intersection of the first line segment set, the second line segment set, the third line segment set and the fourth line segment set as the target line segment; The first position information of the text includes a first text abscissa value and a first text ordinate value of a vertex in a preset diagonal line in the text, and a second text abscissa value and a second text ordinate value of another vertex; The searching for complete text in a second preset area near the target baseline according to the third position information and the first position information includes: Sort the texts according to the first text horizontal coordinate value from small to large to obtain a first text sorting sequence, sort the texts according to the first text vertical coordinate value from small to large to obtain a second text sorting sequence, sort the texts according to the second text horizontal coordinate value from small to large to obtain a third text sorting sequence, and sort the texts according to the second text vertical coordinate value from small to large to obtain a fourth text sorting sequence; According to the third position information, a first preset text horizontal coordinate value, a first preset text vertical coordinate value, a second preset text horizontal coordinate value, and a second preset text vertical coordinate value of a second preset area near the target baseline are acquired; Determine a first text set from the first text sorting sequence according to the first preset text horizontal coordinate value and the second preset text horizontal coordinate value, determine a second text set from the third text sorting sequence, determine a third text set from the second text sorting sequence according to the first preset text vertical coordinate value and the second preset text vertical coordinate value, and determine a fourth text set from the fourth text sorting sequence; The intersection of the first text set, the second text set, the third text set and the fourth text set is used as the complete text.

5. An electronic device, characterized in that: include: A processor, a memory and a communication bus, wherein the processor and the memory communicate with each other via the communication bus; The memory is used to store computer programs; The processor is used to execute the program stored in the memory to implement the citation identification method described in any one of claims 1 to 3.

6. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the citation identification method described in any one of claims 1 to 3 is implemented.