A drawing table recognition method
By identifying table names and drawing frame location information in drawings, constructing target filtering ranges, filtering line segments within drawing frames, identifying tables, and establishing an index system, the accuracy and efficiency problems of table recognition in existing technologies are solved, achieving automated and accurate table recognition.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TECHNOLOGY (CHENGDU) CO LTD
- Filing Date
- 2026-02-28
- Publication Date
- 2026-06-09
AI Technical Summary
Existing technologies struggle to accurately identify basic cells when dealing with table recognition in complex scenarios, and lack an efficient merging index mechanism, resulting in low recognition accuracy and efficiency.
By identifying the table names in the drawings, determining the position information of the drawing frame and the table name, constructing the target filtering range, filtering the line segments within the drawing frame, identifying the tables, and establishing a row and column incremental index system, the basic cells are accurately located.
It enables automatic recognition of table ranges without the need for manual selection, improving the accuracy and efficiency of table recognition and reducing the amount of data processing.
Smart Images

Figure CN121789245B_ABST
Abstract
Description
Technical Field
[0001] This manual relates to the field of building construction technology, and in particular to a method for recognizing drawings and tables. Background Technology
[0002] With the widespread adoption of digital office technologies and intelligent document processing, automatically extracting table structure from scanned documents or images has become a crucial step in information automation. Traditional methods primarily rely on image morphological processing (such as dilation and erosion) or Hough transforms to detect horizontal and vertical lines in tables and then segment cells based on the geometric intersections of these lines. However, such methods exhibit poor robustness in complex scenarios (such as slightly broken lines, tilted tables, or background interference). Furthermore, traditional rules often struggle to handle irregular table layouts, easily leading to misaligned cells or missing topological structures, failing to meet the demands for high-precision structured extraction.
[0003] To address these issues, researchers have introduced graph theory concepts, abstracting table lines as nodes and edges of a graph and using algorithms such as cycle search to identify closed cell regions. While this approach improves upon line topology, it often identifies large loops containing multiple smaller cells when searching for closed paths, making it difficult to accurately define the physical base cells. Furthermore, existing graph theory solutions often lack a unified and efficient indexing mechanism when dealing with merged cells, making it difficult to accurately describe the logical correspondence between merged regions and the standard grid.
[0004] Therefore, it is desirable to provide a drawing table recognition method that can accurately locate basic cells through rigorous graphic algorithms and establish a row and column incremental indexing system that is compatible with merged structures. Summary of the Invention
[0005] This specification provides one or more embodiments of a drawing table identification method, the method comprising: identifying at least one table name in the drawing; for each of the at least one table name, determining the drawing frame to which the table name belongs; determining a target filtering range for the table name based on drawing frame location information and table name location information; filtering line segments within the drawing frame based on the target filtering range to identify the table corresponding to the table name.
[0006] In some embodiments, determining the target filtering range of the table name based on the frame position information and the table name position information includes: determining a first size and a second size of the frame based on the frame position information, wherein the first size is the size of the frame in a first direction, the second size is the size of the frame in a second direction, and the first direction is perpendicular to the second direction; determining an initial filtering range based on the first size, the second size, and the table name position information; and determining the target filtering range based on the initial filtering range and the frame.
[0007] In some embodiments, determining the target filtering range based on the initial filtering range and the frame includes: determining whether the initial filtering range exceeds the frame; if the initial filtering range does not exceed the frame, determining the initial filtering range as the target filtering range; if the initial filtering range exceeds the frame, segmenting the initial filtering range based on the frame to obtain an intermediate filtering range, wherein the intermediate filtering range is located within the frame; and determining the target filtering range based on the intermediate filtering range.
[0008] In some embodiments, filtering line segments within the frame based on the target filtering range to identify the table corresponding to the table name includes: filtering line segments within the frame that are at least partially located within the target filtering range to obtain a first parallel line segment group and a first perpendicular line segment group, wherein the line segments in the first parallel line segment group are parallel to a first direction, and the line segments in the first perpendicular line segment group are parallel to a second direction, and the first direction is perpendicular to the second direction; determining a target line segment group from the first parallel line segment group and the first perpendicular line segment group, wherein the target line segment group is one of the first parallel line segment group and the first perpendicular line segment group; filtering the target line segment group according to the filtering order to determine the target line segment in the target line segment group, wherein the target line segment is located within the target filtering range and is the edge line of the table; filtering the line segments within the frame based on the target line segment to determine the table corresponding to the table name.
[0009] In some embodiments, the step of filtering the target line segment group according to the filtering order to determine the target line segments in the target line segment group includes: sequentially determining whether the line segments in the target line segment group simultaneously satisfy a first preset condition, a second preset condition, and a third preset condition according to the filtering order; in response to the line segments in the target line segment group not simultaneously satisfying the first preset condition, the second preset condition, and the third preset condition, filtering the next line segment in the target line segment group; in response to the line segments in the target line segment group simultaneously satisfying the first preset condition, the second preset condition, and the third preset condition, and the line segments... If the number of segments exceeds a preset threshold, the segment is identified as the target segment, and the filtering ends. The first preset condition is that the segment is within the target filtering range. The second preset condition is that the number of first intersecting segments that intersect with the segment in the target segment group is not less than a first preset threshold, where the first intersecting segments are segments in the first parallel segment group and the first perpendicular segment group relative to the other of the target segment group. The third preset condition is that the number of second intersecting segments is not less than a second preset threshold, where the second intersecting segments are segments in the frame that simultaneously intersect with at least two of the first intersecting segments.
[0010] In some embodiments, determining the target line segment group from the first parallel line segment group and the first vertical line segment group includes: determining the orientation information of the table name relative to the table; and determining the target line segment group from the first parallel line segment group and the first vertical line segment group based on the orientation information.
[0011] In some embodiments, the step of filtering the line segments within the frame based on the target line segment to determine the table corresponding to the table name includes: determining a third intersecting line segment that intersects the target line segment with another member of the first parallel line segment group and the first perpendicular line segment group; determining a fourth intersecting line segment in the frame that intersects with the third intersecting line segment; and determining the table corresponding to the table name based on the third intersecting line segment and the fourth intersecting line segment.
[0012] In some embodiments, determining the table corresponding to the table name based on the third intersecting line segment and the fourth intersecting line segment includes: determining a plurality of closed rectangles based on the third intersecting line segment and the fourth intersecting line segment; and determining the range content corresponding to the closed rectangle with the largest area among the plurality of closed rectangles as the table corresponding to the table name.
[0013] In some embodiments, the method further includes: obtaining a second group of parallel line segments and a second group of perpendicular line segments within the table, wherein the line segments in the second group of parallel line segments are parallel to a first direction, the line segments in the second group of perpendicular line segments are parallel to a second direction, and the first direction is perpendicular to the second direction; determining all intersection points between the second group of parallel line segments and the second group of perpendicular line segments; dividing the second group of parallel line segments and the second group of perpendicular line segments into multiple line segments based on the intersection points; and determining multiple basic cells based on the multiple line segments.
[0014] In some embodiments, the method further includes: determining column information of the table based on the maximum value of the intersection points of the line segments located in the second parallel line segment group; determining row information of the table based on the maximum value of the intersection points of the line segments located in the second vertical line segment group; and determining the index value of each basic cell in the plurality of basic cells based on the position information of each basic cell in the plurality of basic cells, the column information, and the row information.
[0015] This invention eliminates the need for manual selection of table ranges and can automatically identify tables outlined by straight lines in drawings, effectively solving the problem of existing technologies' difficulty in automatically identifying tables; at the same time, it reduces data processing volume and improves the efficiency and accuracy of table recognition. Attached Figure Description
[0016] This specification will be further described by way of exemplary embodiments, which will be described in detail with reference to the accompanying drawings. These embodiments are not limiting; in these embodiments, the same reference numerals denote the same structures, wherein:
[0017] Figure 1 This is an exemplary structural diagram of a drawing and table recognition system according to some embodiments of this specification;
[0018] Figure 2 This is an exemplary flowchart of a method for identifying drawing tables according to some embodiments of this specification;
[0019] Figure 3 This is an exemplary schematic diagram illustrating the determination of a target filtering range according to some embodiments of this specification;
[0020] Figure 4 This is an exemplary schematic diagram of a table corresponding to an identification table name, as shown in some embodiments of this specification;
[0021] Figure 5 This is an exemplary schematic diagram illustrating the determination of basic cells according to some embodiments of this specification. Detailed Implementation
[0022] To more clearly illustrate the technical solutions of the embodiments in this specification, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are merely some examples or embodiments of this specification. For those skilled in the art, these drawings can be applied to other similar scenarios without creative effort. Unless obvious from the context or otherwise specified, the same reference numerals in the drawings represent the same structures or operations.
[0023] It should be understood that the terms “system,” “device,” “unit,” and / or “module” used herein are one way to distinguish different components, elements, parts, sections, or assemblies at different levels. However, if other terms can achieve the same purpose, they may be replaced by other expressions.
[0024] Unless the context clearly indicates an exception, words such as "a," "an," "a kind," and / or "the" do not specifically refer to the singular and may also include the plural. Generally speaking, the terms "comprising" and "including" only indicate the inclusion of explicitly identified steps and elements, which do not constitute an exclusive list, and the method or apparatus may also include other steps or elements.
[0025] Flowcharts are used in this specification to illustrate the operations performed by the system according to embodiments of this specification. It should be understood that the preceding or following operations are not necessarily performed in exact order. Instead, the steps can be processed in reverse order or simultaneously. Furthermore, other operations can be added to these processes, or one or more steps can be removed from them.
[0026] Figure 1 This is an exemplary structural diagram of a drawing and table recognition system according to some embodiments of this specification.
[0027] In some embodiments, such as Figure 1 As shown, system 100 may include a table name recognition module 110, a determination module 120, a filtering module 130, and a table determination module 140.
[0028] In some embodiments, the table name recognition module 110 may be configured to recognize at least one table name in a drawing.
[0029] In some embodiments, the determining module 120 may be configured to determine the frame to which the table name belongs.
[0030] In some embodiments, the filtering module 130 can be configured to determine the target filtering range of table names based on the frame position information and the table name position information.
[0031] In some embodiments, the filtering module 130 may be further configured to: determine a first size and a second size of the frame to which the table name belongs based on the frame position information of the frame to which the table name belongs, wherein the first size is the size of the frame in a first direction and the second size is the size of the frame in a second direction, and the first direction is perpendicular to the second direction; determine an initial filtering range based on the first size, the second size and the table name position information; and determine a target filtering range based on the initial filtering range and the frame to which the table name belongs.
[0032] In some embodiments, the filtering module 130 may be further configured to: determine whether the initial filtering range exceeds the frame to which the table name belongs; if the initial filtering range does not exceed the frame to which the table name belongs, determine the initial filtering range as the target filtering range; if the initial filtering range exceeds the frame to which the table name belongs, divide the initial filtering range based on the frame to obtain an intermediate filtering range, wherein the intermediate filtering range is located within the frame to which the table name belongs; and determine the target filtering range based on the intermediate filtering range.
[0033] In some embodiments, the table determination module 140 can be configured to filter line segments within the frame based on a target filtering range and identify the table corresponding to the table name.
[0034] In some embodiments, the table determination module 140 may be further configured to: filter line segments within the frame that are at least partially located within the target filtering range to obtain a first parallel line segment group and a first vertical line segment group, wherein the line segments in the first parallel line segment group are parallel to a first direction, and the line segments in the first vertical line segment group are parallel to a second direction, and the first direction is perpendicular to the second direction; determine a target line segment group from the first parallel line segment group and the first vertical line segment group, wherein the target line segment group is one of the first parallel line segment group and the first vertical line segment group; filter the target line segment group according to the filtering order to determine the target line segments in the target line segment group, wherein the target line segments are located within the target filtering range and are the edges of the table; and filter the line segments within the frame based on the target line segments to determine the table corresponding to the table name.
[0035] In some embodiments, the table determination module 140 may be further configured to: sequentially determine whether the line segments in the target line segment group simultaneously meet the first preset condition, the second preset condition, and the third preset condition according to the filtering order; in response to the line segments in the target line segment group not simultaneously meeting the first preset condition, the second preset condition, and the third preset condition, filter the next line segment in the target line segment group; in response to the line segments in the target line segment group simultaneously meeting the first preset condition, the second preset condition, and the third preset condition, determine the line segment as the target line segment and end the filtering; wherein, the first preset condition is being within the target filtering range; the second preset condition is that the number of first intersecting line segments intersecting with the line segments in the target line segment group is not less than the first preset threshold, wherein the first intersecting line segments are the line segments in the first parallel line segment group and the first perpendicular line segment group relative to the other of the target line segment group; the third preset condition is that the number of second intersecting line segments is not less than the second preset threshold, wherein the second intersecting line segments are the line segments in the frame that simultaneously intersect with at least two of the first intersecting line segments.
[0036] In some embodiments, the table determination module 140 may be further configured to determine the orientation information of the table name relative to the table; and based on the orientation information, determine the target line segment group from the first parallel line segment group and the first vertical line segment group.
[0037] In some embodiments, the table determination module 140 may be further configured to: determine a third intersecting line segment that intersects the target line segment with another of the first parallel line segment group and the first vertical line segment group; determine a fourth intersecting line segment in the drawing frame that intersects with the third intersecting line segment; and determine the table corresponding to the table name based on the third intersecting line segment and the fourth intersecting line segment.
[0038] In some embodiments, the table determination module 140 may be further configured to: obtain a second group of parallel line segments and a second group of perpendicular line segments within the table, wherein the line segments in the second group of parallel line segments are parallel to a first direction, the line segments in the second group of perpendicular line segments are parallel to a second direction, and the first direction is perpendicular to the second direction; determine all intersection points between the second group of parallel line segments and the second group of perpendicular line segments; divide the second group of parallel line segments and the second group of perpendicular line segments into multiple line segments based on the intersection points; and determine multiple basic cells based on the multiple line segments.
[0039] In some embodiments, the table determination module 140 may be further configured to determine the column information of the table based on the maximum value of the intersection points of the line segments in the second parallel line segment group; determine the row information of the table based on the maximum value of the intersection points of the line segments in the second vertical line segment group; and determine the index value of each basic cell in the multiple basic cells based on the position information, column information and row information of each basic cell in the multiple basic cells.
[0040] Figure 2 This is an exemplary flowchart of a method for identifying drawing tables according to some embodiments of this specification.
[0041] In some embodiments, such as Figure 2 As shown, process 200 can be executed by a processor, and process 200 includes steps 210-240.
[0042] In some embodiments, the processor may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), an application-specific instruction set processor (ASIP), a physical arithmetic processing unit (PPU), a digital signal processor (DSP), a processor, a microprocessor unit, a reduced instruction set computer (RISC), a microprocessor, or any combination thereof. In some embodiments, the processor may be local or remote. In some embodiments, the processor may be implemented on a cloud platform. By way of example only, the cloud platform may include a private cloud, a public cloud, a hybrid cloud, a community cloud, a distributed cloud, an internal cloud, a multi-tiered cloud, or any combination thereof.
[0043] Step 210: Identify at least one table name in the drawing.
[0044] Drawings are technical documents created using engineering design software. Engineering design software may include AutoCAD, Tianzheng CAD, etc. Drawings may be in formats including, but not limited to, DWG and DXF.
[0045] In some embodiments, a user can upload drawings to the processor, or a user can upload drawings to a storage device, and the processor can directly retrieve the drawings from the storage device.
[0046] The table name refers to the name of the table in the drawing. For example, the table name can be drawing index, material list, measures table, etc.
[0047] In some embodiments, the processor can use CAD parsing technology to obtain text-based graphic elements in the drawing, and query the drawing table header template library based on the text-based graphic elements to identify the table name.
[0048] CAD analysis technology refers to the technical methods used to structurally decompose drawings (such as DWG and DXF format drawings) and extract all basic graphic elements and their attribute information. Basic graphic elements refer to the fundamental constituent units of a drawing. For example, basic graphic elements can include graphic elements and text elements.
[0049] Graphic primitives can include lines, polylines, rectangles, circles, arcs, etc.
[0050] Text-based graphic elements refer to graphic elements in drawings that carry text information. For example, text-based graphic elements may include table names (such as "Drawing Catalog"), table header content (such as "Serial Number" or "Drawing Name"), and data within the table.
[0051] The drawing, table, and header template library refers to a database that includes common table names and header content found in drawings.
[0052] The table header refers to the main content of the table. For example, the table header may include serial number, figure title, figure number, scale, figure size, etc.
[0053] In some embodiments, the processor can parse the text-type graphic elements in the drawing, determine the specific text content of the text-type graphic elements, compare the specific text content of the text-type graphic elements with the table names in the drawing table header template library, and take the table names in the drawing table header template library that are consistent with the text content of the text-type graphic elements as the "identified table names".
[0054] For example, if the processor parses the text element "drawing catalog" in the drawing using CAD parsing technology and matches it with the table name "drawing catalog" in the drawing table header template library, then "drawing catalog" is recognized as a valid table name.
[0055] Step 220: For each table name in at least one table name, determine the frame to which the table name belongs.
[0056] A drawing frame is a closed rectangular boundary in a drawing that divides an independent drawing unit.
[0057] In some embodiments, a drawing may contain multiple bounding boxes, each with explicit bounding box parameters. Bounding box parameters are parameters used to define the spatial extent of the bounding box. For example, bounding box parameters can be (ximn, ymin, xmax, ymax).
[0058] In some embodiments, the processor can pre-set a reference coordinate system for the drawing. For example, before determining the bounding box parameters, the processor can set the lower left corner vertex of the drawing as the origin of the reference coordinate system, the horizontal direction of the drawing as the X-axis, and the vertical direction of the drawing as the Y-axis, and define the coordinate system composed of the origin, the X-axis, and the Y-axis as the reference coordinate system.
[0059] In some embodiments, the processor can determine the inclusion relationship between the coordinates of the table name and the range defined by the bounding box parameter of the title frame based on the table name location information. If the coordinates of the table name fall within the range defined by the bounding box parameter of a title frame, then the title frame corresponding to that bounding box parameter is determined to be the title frame to which the table name belongs. More information regarding the table name location information can be found in the description of step 230.
[0060] For example, when the processor parses text-based graphic elements in a CAD drawing, it determines the text content and position coordinates of each text-based graphic element. The position coordinates of each text-based graphic element can be the coordinates of any point within the text-based graphic element. If the position coordinates of the table name (e.g., the position coordinates of the diagonal points of the table name's bounding rectangle [(ax, ay), (bx, by)]) are within the range defined by the bounding box parameters of a certain drawing frame (e.g., (xmin, ymin, xmax, ymax)), (e.g., xmin < ax < xmax, ymin < ay < ymax, xmin < bx < xmax, ymin < by < ymax), then the drawing frame corresponding to that bounding box parameter is determined as the drawing frame to which the table name belongs.
[0061] Step 230: Based on the position information of the chart frame and the position information of the table name, determine the target filtering range of the table name.
[0062] The title frame location information refers to the information used to describe the location of the title frame.
[0063] For example, the position information of the bounding box can be the minimum horizontal coordinate (xmin), minimum vertical coordinate (ymin), maximum horizontal coordinate (xmax), and maximum vertical coordinate (ymax) in the bounding box parameters.
[0064] In some embodiments, the processor can use CAD parsing technology to obtain all straight line segments in the drawing and divide all straight line segments into parallel line segment groups and perpendicular line segment groups according to their direction; iterates through the parallel line segment groups and perpendicular line segment groups, and determines the closed rectangular structure in the drawing by the intersection of the straight line segments in the parallel line segment groups and perpendicular line segment groups; it determines the coordinates of each vertex of the closed rectangular structure, and uses the maximum and minimum values of the coordinates of each vertex of the closed rectangular structure on each coordinate axis as elements in the bounding box parameters, and uses the bounding box parameters as the frame position information of the drawing frame.
[0065] Table name location information refers to information used to describe the location of table names.
[0066] For example, the table name location information can be one or more of the following: the location information of the center point of the outer rectangle of the table name, the location information of a point on the edge of the outer rectangle of the table name, or the location information of the diagonal point of the outer rectangle of the table name.
[0067] In some embodiments, the processor can use CAD parsing technology to determine the specific location of the table name in the drawing, and based on the reference coordinate system, determine the coordinates of the table name in the reference coordinate system (such as the coordinates of the center point of the geometric figure shown by the table name), and determine the coordinates of the table name in the reference coordinate system as the table name location information.
[0068] The target filtering range refers to the rectangular area used to limit the boundaries of the table search.
[0069] In some embodiments, the processor can acquire pre-identified frame location information and table name location information, determine the relative spatial vector information between the frame location information and the table name location information, and determine an initial filtering range based on the relative spatial vector information; it then uses the initial filtering range to perform spatial clipping or cluster analysis to eliminate rectangular ranges that do not conform to the plan or logic, thereby determining the clipped initial filtering range as the target filtering range. Relative spatial vector information refers to information describing the spatial size and position of the initial filtering range corresponding to the table name location information and the frame location information. For example, relative spatial vector information may include the coordinate range of the initial filtering range, and the relative spatial vector information can be calculated from the frame location information and the table name location information.
[0070] For more information on how to determine the target filtering scope, please refer to [link / reference]. Figure 3 And its related descriptions.
[0071] Step 240: Filter the line segments within the frame based on the target filtering range and identify the table corresponding to the table name.
[0072] A line segment is a graphic element in a drawing that is a straight line used to form a table.
[0073] In some embodiments, the processor can determine whether a line segment belongs to the table by considering its geometric relationship with the target filter range. The geometric relationship can include inclusion, exclusion, and intersection. For example, the processor can determine line segments that are included in or intersect with the target filter range as belonging to the table.
[0074] A table is a closed rectangular area consisting of a table name, a table header, and cells, and is composed of multiple rows and columns of line segments.
[0075] In some embodiments, the processor may filter line segments within the frame that are at least partially within the target filtering range, and determine the set of line segments that are partially within the target filtering range as a target line segment group; determine the target line segments in the target line segment group through a first preset condition, a second preset condition, and a third preset condition; filter line segments within the frame based on the target line segments, and determine the table corresponding to the table name according to the geometric relationship between the line segments within the frame and the target line segments.
[0076] For more information on how to determine the form, please refer to [link / reference]. Figure 4 And its related descriptions.
[0077] In some embodiments of this specification, the table name is identified, the drawing frame to which the table name belongs is determined, and then the target filtering range is determined. The table corresponding to the table name is identified, eliminating the need for manual selection of the table range. The table outlined by straight line segments in the drawing can be automatically identified, effectively solving the problem that the prior art is difficult to automatically identify such tables. At the same time, by associating the table name with the drawing frame and limiting the target filtering range, the search boundary is narrowed, the amount of data processing is reduced, and the efficiency and accuracy of table recognition are improved.
[0078] It should be noted that the above description of process 200 is for illustrative purposes only and does not limit the scope of this specification. Those skilled in the art can make various modifications and changes to process 200 under the guidance of this specification. However, these modifications and changes remain within the scope of this specification.
[0079] Figure 3 This is an exemplary schematic diagram illustrating the determination of a target filtering range according to some embodiments of this specification.
[0080] In some embodiments, such as Figure 3 As shown, the processor can determine the first size 320 and the second size 330 of the frame 360 to which the table name belongs based on the frame position information 310 of the frame to which the table name belongs; determine the initial filtering range 350 based on the first size 320, the second size 330 and the table name position information 340; and determine the target filtering range 370 based on the initial filtering range 350 and the frame 360 to which the table name belongs.
[0081] The first dimension refers to the length of the drawing frame in the first direction. The first direction is the direction parallel to the X-axis.
[0082] In some embodiments, the processor may project the frame in a first direction, determine the minimum and maximum values of the frame in the first direction, and use the difference between the minimum and maximum values as the first size of the frame.
[0083] In some embodiments, the processor may determine the X-axis direction of the reference coordinate system as the first direction.
[0084] The second dimension refers to the length of the drawing frame in the second direction. The second direction is the direction parallel to the Y-axis.
[0085] In some embodiments, the processor may map the frame in a second direction, determine the minimum and maximum values of the frame in the second direction, and use the difference between the minimum and maximum values as the second size of the frame.
[0086] In some embodiments, the processor may determine the Y-axis direction of the reference coordinate system as the second direction.
[0087] In some embodiments, the first direction is perpendicular to the second direction.
[0088] The initial filtering range refers to the candidate rectangular area used to determine the target filtering range.
[0089] In some embodiments, the processor may determine the initial filtering range of table names in a variety of ways based on the first size, the second size, and the table name location information.
[0090] For example, if the table name location information is the coordinates (cx, cy) of the center point of the bounding rectangle of the table name, and the chart frame location information is (xmin, ymin, xmax, ymax), then the first dimension of the chart frame on the X-axis is x. L =xmax-xmin, the second dimension of the frame on the Y-axis is y. L =ymax-ymin, taking the geometric center (cx, cy) as the reference, extend half of the first dimension (x) in both the positive and negative directions of the X-axis. L / 2), extending half of the second dimension in both the positive and negative directions of the Y-axis (y L / 2), forming a rectangular area is the initial filtering range. The extreme values of the coordinates corresponding to the four vertices of the initial filtering range are cx-x. L / 2, cx+x L / 2, cy-y L / 2, cy+y L / 2.
[0091] In some embodiments, the processor can determine the target filtering range in various ways based on the initial filtering range and the frame to which the table name belongs. For example, the processor can compare the initial filtering range with the frame position information of the frame to which the table name belongs, modify the boundary of the initial filtering range that exceeds the boundary shown by the frame position information to the boundary shown by the frame position information, and determine the modified initial filtering range as the target filtering range.
[0092] It should be noted that determining the target filtering range based on the initial filtering range and the drawing frame can prevent the filtering range from crossing the drawing frame, ensuring that the filtering range is always within the drawing frame to which the table name belongs, and improving the accuracy of subsequent line segment filtering.
[0093] For more information on how to determine the target filter range based on the initial filter range and the frame, please refer to the relevant description below.
[0094] In some embodiments, the processor may determine whether the initial screening range exceeds the frame to which the table name belongs. In response to the initial screening range not exceeding the frame to which the table name belongs, the initial screening range is determined as the target screening range; in response to the initial screening range exceeding the frame to which the table name belongs, the initial screening range is segmented based on the frame to obtain an intermediate screening range, where the intermediate screening range is located within the frame to which the table name belongs; and the target screening range is determined based on the intermediate screening range.
[0095] In some embodiments, the processor may respectively compare the maximum value of the X-axis, the minimum value of the X-axis, the maximum value of the Y-axis, and the minimum value of the Y-axis in the position information of the initial screening range with the maximum value of the X-axis, the minimum value of the X-axis, the maximum value of the Y-axis, and the minimum value of the Y-axis in the frame position information based on the position information of the initial screening range and the frame position information; if at least one of the maximum value of the X-axis, the minimum value of the X-axis, and the maximum value of the Y-axis in the position information of the initial screening range is greater than the maximum value of the X-axis, the minimum value of the X-axis, the maximum value of the Y-axis, and the minimum value of the Y-axis in the frame position information, it is determined that the initial screening range exceeds the frame.
[0096] For example, if the maximum value of the X-axis in the position information of the initial screening range is greater than the maximum value of the X-axis in the frame position information, it is considered that the initial screening range exceeds the frame to which the table name belongs. For another example, if the maximum value of the Y-axis in the position information of the initial screening range is greater than the maximum value of the Y-axis in the frame position information, it is considered that the initial screening range exceeds the frame to which the table name belongs. For still another example, if the minimum value of the X-axis in the position information of the initial screening range is less than the minimum value of the X-axis in the frame position information, it is considered that the initial screening range exceeds the frame to which the table name belongs. For yet another example, if the minimum value of the Y-axis in the position information of the initial screening range is less than the minimum value of the Y-axis in the frame position information, it is considered that the initial screening range exceeds the frame to which the table name belongs.
[0097] The intermediate screening range refers to the screening range obtained by segmenting the initial screening range.
[0098] In some embodiments, the processor may determine the intermediate screening range based on the initial screening range and the frame in various ways.
[0099] In some embodiments, if a certain side boundary of the initial screening range exceeds the corresponding boundary of the frame (e.g., cx - x L / 2 < xmin), the side boundary is adjusted to the corresponding frame boundary value (e.g., xmin), and the initial screening range after adjusting the side boundary is determined as the intermediate screening range.
[0100] In some embodiments, the processor may also determine the orientation information of the table name relative to the adjacent rectangular structure; and determine the intermediate screening range based on the orientation information, the first dimension, the second dimension, and the table name position information.
[0101] An adjacent rectangular structure refers to a closed rectangular structure composed of line segments that is closest to the table name location. In some embodiments, the processor can determine a closed rectangular structure composed of multiple line segments using CAD parsing technology, and identify the closed rectangular structure to which the line segment closest to the table name location information belongs as an adjacent rectangular structure.
[0102] Location information refers to information used to describe the location of the table name relative to the table. For example, location information can include above, below, left, right, etc.
[0103] In some embodiments, the processor may determine the location information of the table name relative to the table in a variety of ways.
[0104] For example, the processor can use CAD analysis technology to determine the position information of each line segment in the reference coordinate system, and based on the position information of the table name in the reference coordinate system, determine the orientation information of the table name relative to the adjacent closed rectangular structure.
[0105] For example, a processor can use machine recognition technology (such as image recognition) to identify the table name and table in the frame, thereby determining the positional information of the table name relative to the table.
[0106] In some embodiments, the processor may, based on orientation information, a first size, a second size, and table name location information, delete the portion of the initial filtering range that extends beyond the table, and determine the remaining rectangular area as the intermediate filtering range.
[0107] Understandably, table names are generally not located in the center of the table. Therefore, the area around the table name relative to the other side of the table is redundant and can be excluded. For example, if the table name is at the top of the table, then the area above the table name that exceeds the table's rectangular area can be deleted. Similarly, if the table name is at the bottom of the table, then the area below the table name that exceeds the table's rectangular area can be deleted.
[0108] In some embodiments of this specification, excluding the useless range on the other side of the table name can further narrow the initial filtering range, reduce interference from irrelevant line segments, improve the accuracy of subsequent filtering, focus on the effective area to reduce the amount of computation, and make the table recognition more efficient.
[0109] In some embodiments, the processor can compare the position information of the intermediate filtering range with the position information of the frame of the image. If the position information of the intermediate filtering range is within the range shown by the position information of the frame of the image, the intermediate filtering range is determined as the target filtering range. If the position information of the intermediate filtering range exceeds the range shown by the position information of the frame of the image, the intermediate filtering range is adjusted and the adjusted intermediate filtering range is determined as the target filtering range.
[0110] For example, if the positions of the four vertices of the middle filtering range are cx-xL / 2,cx+x L / 2,cy-y L / 2,cy+y L / 2, the position information of the graph frame is (xmin, xmax, ymin, ymax), if cx-x L / 2≥xmin and / or cy-y L If / 2≥ymin, then the intermediate filtering range is determined as the target filtering range. If cx-x L / 2 < xmin and / or cy-y L If / 2 < ymin, then modify the size of the plot frame on the X and Y axes to x. L =xmax-xmin+1, y L =ymax-ymin+1, and set the redefined intermediate filtering range as the target filtering range.
[0111] In some embodiments of this specification, by clearly defining the boundary judgment and correction logic between the initial filtering range and the drawing frame, it is ensured that the target filtering range always falls within the drawing frame, avoiding erroneous filtering across ranges. Simultaneously, precise range definition further narrows the effective processing area, improving the efficiency and accuracy of subsequent line segment filtering and table recognition.
[0112] In some embodiments of this specification, by clearly defining the association logic between the size of the drawing frame and the position of the table name, the initial filtering range is accurately constructed, which can cover the table to the greatest extent and reduce omissions; boundary correction avoids the range from exceeding the drawing frame, improving the accuracy of subsequent line segment filtering; at the same time, it narrows the effective range of subsequent line segment processing, reduces the amount of calculation, improves the efficiency of table recognition, and lays a solid foundation for the subsequent accurate recognition of tables outlined by straight line segments.
[0113] Figure 4 This is an exemplary schematic diagram of a table corresponding to an identification table name, as shown in some embodiments of this specification.
[0114] In some embodiments, such as Figure 4 As shown, the processor can filter line segments 410 within the frame that are at least partially within the target filtering range to obtain a first parallel line segment group 420 and a first vertical line segment group 430; from the first parallel line segment group 420 and the first vertical line segment group 430, determine a target line segment group 440; filter the target line segment group 440 according to the filtering order 450 to determine the target line segment 460 in the target line segment group 440; based on the target line segment 460, filter the line segments within the frame to determine the table 470 corresponding to the table name.
[0115] The line segment must be at least partially within the target filtering range, meaning that both endpoints of the line segment are within the target filtering range or one endpoint is within the target filtering range.
[0116] In some embodiments, the processor can use CAD parsing technology to filter line segments within the drawing frame that are at least partially within the target filtering range.
[0117] For example, the processor can use CAD parsing technology to analyze the drawing frame containing the table name, identify all line segments and polylines within the frame, break down polylines into independent line segments, and filter line segments within the drawing frame that intersect with or are included in the target filtering range, based on the target filtering range. Here, a line segment refers to a basic straight line segment containing only two endpoints. A polyline segment refers to a line segment composed of multiple connected line segments.
[0118] The first parallel line segment group refers to a group of line segments consisting of multiple line segments parallel to the first direction.
[0119] In some embodiments, the processor may use CAD analysis technology to determine multiple filtered line segments parallel to the first direction, and form a first group of parallel line segments based on the multiple filtered line segments.
[0120] The first vertical line segment group refers to a group of line segments consisting of multiple line segments parallel to the second direction.
[0121] In some embodiments, since the first direction is perpendicular to the second direction, the line segments in the first parallel line segment group are perpendicular to the line segments in the first perpendicular line segment group.
[0122] In some embodiments, the processor may use CAD analysis technology to determine multiple filtered line segments parallel to the second direction, and form a first vertical line segment group based on the multiple filtered line segments.
[0123] For more information on the first and second directions, please refer to [link / reference]. Figure 2 And its related descriptions.
[0124] The target line segment group refers to a specific line segment group used for subsequent precise matching of table edges.
[0125] In some embodiments, the target line segment group can be one of the first parallel line segment group and the first perpendicular line segment group.
[0126] In some embodiments, the processor may determine the target line segment group from the first parallel line segment group and the first vertical line segment group in a variety of ways.
[0127] For example, the processor can preset the first group of parallel line segments as the target group of line segments.
[0128] For example, target line segment groups can be determined by manual annotation.
[0129] In some embodiments, the processor may determine the orientation information of the table name relative to the table; based on the orientation information, determine the target line segment group from the first parallel line segment group and the first vertical line segment group.
[0130] For more information on location, please refer to [link / reference]. Figure 2 Related descriptions.
[0131] In some embodiments, the processor determines the first parallel line segment group as the target line segment group in response to the table name being located above or below the table; the processor determines the first vertical line segment group as the target line segment group in response to the table name being located to the left or right of the table.
[0132] In some embodiments of this specification, determining the target line segment group through orientation information can increase the variety of table recognition and improve the robustness of the method.
[0133] The filtering order refers to the priority logic for searching or sorting line segments in the target direction.
[0134] For example, the filtering order could be filtering target line segments from the positive X-axis direction toward the origin or filtering target line segments from the negative Y-axis direction toward the origin, etc.
[0135] In some embodiments, the filtering order is related to the position of the target line segment group in the target direction.
[0136] The target direction is the direction perpendicular to the line segments in the target line segment group. For example, if the target line segment group is the first parallel line segment group, then the target direction is the second direction.
[0137] In some embodiments, the processor can determine the filtering order in various ways based on the position of the target line segment group in the target direction and the table name position information.
[0138] For example, if the table name location information is in the positive direction of the target direction (such as the first direction), the filtering order is to sort the first vertical line segments in descending order of their X values, and then filter the target line segments from the positive X-axis direction towards the origin. Alternatively, the filtering order could be to select the line segment in the first parallel line segment group whose y-value is closest to the y-value in the table name location information as the target line segment.
[0139] The target line segment refers to a single straight line segment within the drawing frame that is determined to be a valid table boundary.
[0140] In some embodiments, the target line segment is located within the target filtering range and is the edge of the table.
[0141] In some embodiments, the processor can filter the target line segment group according to the filtering order, and determine the first line segment in the target line segment group as the target line segment.
[0142] In some embodiments, the processor may sequentially determine whether the line segments in the target line segment group simultaneously meet the first preset condition, the second preset condition, and the third preset condition according to the filtering order. In response to the line segments in the target line segment group not simultaneously meeting the first preset condition, the second preset condition, and the third preset condition, the processor filters the next line segment in the target line segment group. In response to the line segments in the target line segment group simultaneously meeting the first preset condition, the second preset condition, and the third preset condition, the processor determines the line segment as the target line segment and ends the filtering.
[0143] The first preset condition is that all line segments in the target line segment group are located within the target filtering range. For example, both endpoints of the line segments in the target line segment group are located within the target filtering range.
[0144] The second preset condition is that the number of the first intersecting line segments that intersect with the line segments in the target line segment group is not less than the first preset threshold.
[0145] The first intersecting line segment is the line segment in the first parallel line segment group and the first perpendicular line segment group that is relative to the other of the target line segment group.
[0146] For example, if the first group of parallel line segments is the target group of line segments, then the first intersecting line segment is a line segment in the first group of perpendicular line segments; if the first group of perpendicular line segments is the target group of line segments, then the first intersecting line segment is a line segment in the first group of parallel line segments.
[0147] The first preset threshold is a parameter used to determine whether a line segment in the target line segment group meets the second preset condition. For example, the first preset threshold can be an integer value greater than 2.
[0148] In some embodiments, the first preset threshold may be preset by a technician based on requirements.
[0149] The third preset condition is that the number of line segments of the second intersecting line segment is not less than the second preset threshold.
[0150] The second intersecting line segment is the line segment in the drawing frame that intersects with at least two of the first intersecting line segments simultaneously.
[0151] The second preset threshold is a parameter used to determine whether a line segment in the target line segment group meets the third preset condition. For example, the second preset threshold can be an integer value greater than 2.
[0152] In some embodiments, the second preset threshold may be preset by a technician based on requirements.
[0153] It is understandable that the first preset threshold and the second preset threshold are not equal. If one of the first preset threshold and the second preset threshold is at least 2, then the other is at least 3.
[0154] Understandably, if the number of segments in the first and second intersecting lines is less than 2, then the first and second intersecting lines cannot form a closed table; if the number of segments in the first and second intersecting lines is 2, then the first and second intersecting lines form a box, which cannot form a table.
[0155] In some embodiments, the processor can traverse the line segments in the target line segment group in the filtering order. For each line segment, it determines whether the line segment simultaneously satisfies the first preset condition, the second preset condition, and the third preset condition. In response to the current line segment simultaneously satisfying the first preset condition, the second preset condition, and the third preset condition, the traversal stops, the filtering ends, and the current line segment is determined as the target line segment. The current line segment refers to the line segment that has been filtered by the first preset condition, the second preset condition, and the third preset condition.
[0156] In some embodiments of this specification, a dual screening mechanism of "target selection range + intersection judgment" is used to achieve automated and accurate identification of tables in CAD drawings, completely eliminating the reliance on manual selection. The line segment search space is reduced from the entire drawing frame to a local rectangular area, resulting in an exponential decrease in data processing volume and a significant improvement in recognition efficiency and accuracy. This method breaks through the limitation of existing technologies that only identify standard table elements, adapting to a large number of non-standard tables in engineering drawings that are hand-drawn by horizontal and vertical lines, greatly expanding the application scenarios. In addition, by constructing a three-level spatial mapping relationship of table name-drawing frame-line segment, semantic intelligent positioning capability is established, providing precise boundaries for subsequent structured information extraction, effectively solving the industry pain point of automatic table recognition in complex drawings.
[0157] In some embodiments, the processor can determine other edges of the table corresponding to the table name based on the target line segment, thereby determining the table corresponding to the table name.
[0158] The target line segment can be considered as the edge of the table closest to the table name. Based on the aforementioned edge, other edges of the table can be further determined.
[0159] In some embodiments, the table is generally rectangular, and in response to the processor determining one side edge of the table, the processor can determine the other edges of the table based on geometric relationships.
[0160] For example, if the target line segment is the top edge of the table near the table name, then the table has two edges perpendicular to the target line segment and one edge parallel to the target line segment. The processor can identify the line segment that intersects the two endpoints of the target line segment and is perpendicular to the target line segment as the two perpendicular edges of the table, and identify the line segment that intersects the endpoints of the two perpendicular edges and is parallel to the target line segment as the other parallel edge of the table.
[0161] In some embodiments, the processor may further determine a third intersecting line segment that intersects the target line segment with another of the first parallel line segment group and the first vertical line segment group; determine a fourth intersecting line segment in the drawing frame that intersects with the third intersecting line segment; and determine the table corresponding to the table name based on the third intersecting line segment and the fourth intersecting line segment.
[0162] The third intersecting segment is the segment that intersects with the target segment. The third intersecting segment can be a segment from either the first group of parallel segments or the first group of perpendicular segments, relative to the other segment in the target segment group.
[0163] The fourth intersecting line segment refers to the line segment in the drawing frame that intersects with the third intersecting line segment.
[0164] In some embodiments, in response to the third intersecting line segment being within the target filtering range, the processor can identify the line segment within the target filtering range that intersects with the third intersecting line segment as the fourth intersecting line segment; in response to the third intersecting line segment not being within the target filtering range, the processor can identify the line segment within the frame that intersects with the third intersecting line segment as the fourth intersecting line segment.
[0165] Understandably, the fourth intersecting line segment also includes the target line segment.
[0166] In some embodiments, the processor may determine the closed rectangular region formed by the third intersecting line segment and the fourth intersecting line segment as the table corresponding to the table name.
[0167] For example, the processor can use the maximum and minimum values of the x and y values of all line segments in the third and fourth intersecting line segments as the true range of the table, and determine the table represented by the true range of the table as the table corresponding to the table name.
[0168] In some embodiments, the processor may also determine multiple closed rectangles based on the third intersecting line segment and the fourth intersecting line segment; and determine the range content corresponding to the closed rectangle with the largest area among the multiple closed rectangles as the table corresponding to the table name.
[0169] A closed rectangle is a closed region consisting of at least two sets of mutually perpendicular line segments.
[0170] In some embodiments, the processor may define the closed region formed by the intersection of the third and fourth intersecting line segments as a closed rectangle.
[0171] In some embodiments, the processor can determine the x-value range and y-value range of multiple closed rectangles using CAD analysis technology, determine the difference between the end values of the x-value range and the difference between the end values of the y-value range as the horizontal and vertical dimensions of the closed rectangles, and use the product of the horizontal and vertical dimensions as the area of the closed rectangles.
[0172] The scope content refers to all graphic elements contained within a closed rectangle. For example, the scope content may include a table composed of multiple line segments and text-type graphic elements within the table.
[0173] In some embodiments of this specification, a rigorous geometric topological constraint algorithm is constructed through multi-level line segment cross-validation and coordinate extreme value extraction mechanism. This algorithm can deeply explore the mutual pointing relationship between line segments, effectively eliminate interfering broken lines in the target area, and accurately outline the true physical contour of the table even when facing complex CAD scenarios with merged cells or irregular drawing, thereby ensuring the integrity of subsequent range content extraction and laying a solid foundation for achieving highly reliable chart structure conversion.
[0174] In some embodiments of this specification, an adaptive optimization of the target feature line retrieval path is achieved by establishing a logical association between the relative orientation of the table name and the coordinate sorting direction. This scheme enables the processor to automatically switch between ascending and descending filtering order based on the prior spatial position of the table name, thereby capturing the line segment closest to the reference target in the first instance from a massive amount of primitives. This significantly reduces the computational overhead of invalid traversals and greatly improves the response speed and positioning accuracy of automated parsing.
[0175] In some embodiments of this specification, by grouping in a vertical or parallel direction and filtering by range, irrelevant line segments such as diagonal lines and curves are eliminated, greatly reducing interference; the table edges are accurately matched based on the target line segment group, which not only adapts to the core scenario of outlining the table with straight lines, but also improves the recognition accuracy and efficiency.
[0176] Figure 5 This is an exemplary schematic diagram illustrating the determination of basic cells according to some embodiments of this specification.
[0177] In some embodiments, such as Figure 5 As shown, the processor can obtain the second parallel line segment group 510 and the second vertical line segment group 520 in table 470, determine all intersection points 530 between the second parallel line segment group 510 and the second vertical line segment group 520; divide the second parallel line segment group 510 and the second vertical line segment group 520 into multiple line segments 540 based on the intersection points 530; and determine multiple basic cells 550 based on the multiple line segments 540.
[0178] The second parallel line segment group refers to the line segment group formed by the line segments in the table that are parallel to the first direction.
[0179] The second vertical line segment group refers to the line segment group formed by the line segments in the table that are parallel to the second direction.
[0180] For more information on the first and second directions, please refer to [link / reference]. Figure 2 And its related descriptions.
[0181] The intersection point refers to the point where the line segments in the second parallel line segment group and the line segments in the second perpendicular line segment group intersect.
[0182] In some embodiments, all segments in the second vertical segment group are traversed, and in response to a segment in the second vertical segment group intersecting at least two segments in the second parallel segment group, the processor determines the coordinate point that the segments in the second vertical segment group and the segments in the second parallel segment group pass through together as the intersection point.
[0183] It should be noted that the processor can record the intersection points into the second vertical line segment group and the second parallel line segment group respectively.
[0184] In some embodiments, the processor can split multiple line segments based on intersection points.
[0185] For example, the processor can traverse each line segment, obtain the starting point, ending point and intersection point of each line segment, sort them in a certain order (perpendicular line segments are sorted by y-value, and parallel line segments are sorted by x-value), and determine the line segment formed by connecting two adjacent coordinate points (such as the same y-value and adjacent x-value, or the same x-value and adjacent y-value) as the split line segment.
[0186] A basic cell is a closed rectangular area within a table, bounded by the intersection of two adjacent parallel line segments and two adjacent perpendicular line segments, and containing no other line segments within it. A table typically consists of multiple basic cells. "Containing no other line segments" refers to its indivisibility within the current table topology. Therefore, a table may contain basic cells of varying areas (e.g., different areas of the table may have different grid densities), but each basic cell is the fundamental unit constituting the drawing table within its local area.
[0187] In some embodiments, the processor can construct an undirected graph based on the split line segments, and use the Depth-First Search (DFS) algorithm to determine all closed paths within the graph and their containment relationships, identifying all closed paths that do not contain other closed paths as base cells. An undirected graph is a mathematical structure consisting of vertices and edges. The DFS algorithm is an algorithm used to traverse or search a tree or graph.
[0188] In some embodiments of this specification, by identifying the basic, non-overlapping basic cells of the drawing table, the local grid density of the drawing table can be accurately depicted, deconstructing the table, which is visually outlined by continuous line segments, into a discrete, standardized set of basic units, thereby laying the geometric foundation for establishing a digital model that describes the logical row and column structure of the table.
[0189] In some embodiments, the processor may determine the column information of the table based on the maximum value of the intersection points of the line segments in the second parallel line segment group; determine the row information of the table based on the maximum value of the intersection points of the line segments in the second vertical line segment group; and determine the index value of each basic cell in the multiple basic cells based on the position information, column information, and row information of each basic cell in the multiple basic cells.
[0190] The maximum value of the intersection point in the second parallel line segment group refers to the maximum value of the x-coordinate of the intersection point recorded in the second parallel line segment group.
[0191] Column information refers to information describing the number of columns contained in a table.
[0192] In some embodiments, the processor can sort the x-values of the intersection points of the line segments in the second parallel line segment group from smallest to largest, and label each x-value with a column number. The column number corresponding to the maximum x-value of the intersection points in the second parallel line segment group is determined as the column information. For example, after removing duplicate x-coordinate values from all intersection points on the second parallel line segment group (e.g., horizontal line segments), sorting them from smallest to largest, the number of such values is the total number of columns in the table. The column number corresponding to the largest x-coordinate value after sorting is the total number of columns.
[0193] The maximum value of the intersection point in the second vertical line segment group refers to the maximum value of the ordinate of the intersection point recorded in the second vertical line segment group.
[0194] Row information refers to information describing the number of rows contained in a table.
[0195] In some implementations, the processor can sort the y-values of the intersection points of the line segments in the second vertical line segment group from smallest to largest, and label each y-value with a row number. The row number corresponding to the maximum y-value of the intersection points in the second vertical line segment group is determined as the row information. For example, after removing duplicate y-coordinate values from all intersection points on the second vertical line segment group (e.g., vertical line segments), the number of these values represents the total number of rows in the table. The row number corresponding to the largest y-coordinate value after sorting is the total number of rows.
[0196] The location information of a base cell refers to the range parameter formed by the position coordinates of each vertex of the base cell.
[0197] In some embodiments, the processor can decompose the position coordinates of each vertex of the base cell into the x-value range and y-value range of the base cell, and combine the x-value range and y-value range to form the position information of the base cell.
[0198] An index value is a numerical value or key used to locate the row or column of a base cell. For example, an index value can include a row index and a column index. Index values represent the logical position of each base cell within the table grid defined by row and column information.
[0199] In some embodiments, the index value may include a row index value and a column index value. The row index value is used to represent the logical position number of each basic cell in the horizontal direction of the table grid, and the column index value is used to represent the logical position number of each basic cell in the vertical direction of the table grid.
[0200] By assigning a unique row index value and column index value to each basic cell, a standardized, discrete row and column coordinate reference system is established for the entire table.
[0201] By establishing index values for row and column coordinates, text, graphic elements, and other content identified within the table can be precisely associated with the index value of their respective (smallest or merged) cells based on their geometric location information. This enables subsequent content extraction, data querying, and structured output based on row and column order, thus completing the final transformation from drawing images to structured data. In some embodiments, the processor can determine the index value of each basic cell based on its position, column, and row information.
[0202] For example, the processor can view the table as an M-row × N-column grid defined by row information (total number of rows M) and column information (total number of columns N). The Y-coordinate values of the top-left corner or center point of all basic cells in the table are sorted and matched with the sequence of Y-coordinate values of the intersection points in the second vertical line segment group to determine the row number, i.e., the row index, of each basic cell. Similarly, its X-coordinate values are matched with the sequence of X-coordinate values of the intersection points in the second parallel line segment group to determine the column number, i.e., the column index, of each basic cell. Therefore, each basic cell can be identified by a unique (row index, column index) pair.
[0203] In some embodiments of this specification, the maximum value of the intersection point is used to accurately lock the table's row and column information, avoiding statistical deviations in rows and columns. Combining the position of the base cell to determine the index value establishes a standard, discrete coordinate reference system for the entire table, assigning each base cell a unique coordinate within the table's logical structure. This transforms visual geometry into structured data that can be processed and queried by a computer. Furthermore, by establishing indexes for base cells, any table area, including merged cells, can be accurately located using the starting index and span information, greatly improving the accuracy of table data extraction and structure reconstruction. For example, a complex cell formed by merging multiple adjacent base cells can be accurately described using the index of the starting base cell it covers (starting row index, starting column index) and the number of rows and columns it spans (row span, column span). This solves the problem of existing technologies struggling to digitally define merged cells, laying a solid foundation for subsequent accurate extraction of table content and reconstruction of the table's logical structure.
[0204] The basic concepts have been described above. It is clear that the detailed disclosure above is merely illustrative and does not constitute a limitation of the present invention. Although not explicitly stated herein, various modifications, improvements, and corrections may be made to the present invention by those skilled in the art. Such modifications, improvements, and corrections are suggested in this invention and therefore remain within the spirit and scope of the exemplary embodiments of the present invention.
[0205] Furthermore, this invention uses specific terms to describe embodiments of the invention. For example, "some embodiments" refers to a particular feature, structure, or characteristic associated with at least one embodiment of the invention. Additionally, certain features, structures, or characteristics in one or more embodiments of the invention can be appropriately combined.
[0206] Furthermore, unless expressly stated in the claims, the order of processing elements and sequences, the use of numbers and letters, or other names described in this invention are not intended to limit the order of the processes and methods of this invention. Although the foregoing disclosure has discussed some currently considered useful embodiments of the invention through various examples, it should be understood that such details are for illustrative purposes only, and the appended claims are not limited to the disclosed embodiments; rather, the claims are intended to cover all modifications and equivalent combinations that conform to the spirit and scope of the embodiments of this invention. For example, while the system components described above can be implemented by hardware devices, they can also be implemented solely by software solutions, such as installing the described system on existing servers or mobile devices.
[0207] Similarly, it should be noted that, in order to simplify the description of this invention and thus aid in the understanding of one or more embodiments, the foregoing description of the embodiments of this invention sometimes combines multiple features into a single embodiment, drawing, or description thereof. However, this disclosure method does not imply that the subject matter of the invention requires more features than those mentioned in the claims. In fact, the embodiments contain fewer features than all the features of the single embodiment disclosed above.
[0208] Finally, it should be understood that the embodiments described in this invention are merely illustrative of the principles of the invention. Other variations may also fall within the scope of this invention. Therefore, alternative configurations of the embodiments in this specification are considered as examples and not limitations, and are regarded as consistent with the teachings of this invention. Accordingly, this invention is not limited to the embodiments explicitly described and illustrated herein.
Claims
1. A method for recognizing drawings and tables, characterized in that, The method includes: Identify at least one table name within the drawing; For each of the at least one table name, Determine the frame to which the table name belongs; Based on the position information of the frame and the position information of the table name, the target filtering range of the table name is determined; Based on the target filtering range, the line segments within the frame are filtered, and the table corresponding to the table name is identified, including: Filter the line segments within the frame that are at least partially located within the target filtering range to obtain a first parallel line segment group and a first perpendicular line segment group, wherein the line segments in the first parallel line segment group are parallel to a first direction, and the line segments in the first perpendicular line segment group are parallel to a second direction, and the first direction is perpendicular to the second direction; From the first group of parallel line segments and the first group of perpendicular line segments, a target line segment group is determined, wherein the target line segment group is one of the first group of parallel line segments and the first group of perpendicular line segments. The target line segment group is filtered according to the filtering order to determine the target line segment in the target line segment group. The target line segment is located within the target filtering range and is the edge line of the table. Based on the target line segment, the line segments within the frame are filtered to determine the table corresponding to the table name.
2. The method as described in claim 1, characterized in that, The determination of the target filtering range for the table name based on the frame position information and the table name position information includes: Based on the position information of the drawing frame to which the table name belongs, the first size and the second size of the drawing frame to which the table name belongs are determined, wherein the first size is the size of the drawing frame in a first direction, the second size is the size of the drawing frame in a second direction, and the first direction is perpendicular to the second direction; Based on the first size, the second size, and the table name location information, determine the initial filtering range; Based on the initial filtering range and the frame to which the table name belongs, the target filtering range is determined.
3. The method as described in claim 2, characterized in that, Determining the target filtering range based on the initial filtering range and the frame includes: Determine whether the initial filtering range exceeds the frame to which the table name belongs. In response to the initial filtering range not exceeding the frame to which the table name belongs, the initial filtering range is determined as the target filtering range; In response to the initial filter range exceeding the frame to which the table name belongs. The initial filtering range is divided based on the frame to obtain an intermediate filtering range, wherein the intermediate filtering range is located within the frame to which the table name belongs; Based on the intermediate filtering range, the target filtering range is determined.
4. The method as described in claim 1, characterized in that, The step of filtering the target line segment group according to the filtering order to determine the target line segments in the target line segment group includes: According to the filtering order, determine in turn whether the line segments in the target line segment group simultaneously meet the first preset condition, the second preset condition, and the third preset condition. In response to the fact that a line segment in the target line segment group does not simultaneously meet the first preset condition, the second preset condition and the third preset condition, the next line segment in the target line segment group is filtered. In response to the fact that the line segment in the target line segment group simultaneously satisfies the first preset condition, the second preset condition and the third preset condition, the line segment is determined as the target line segment and the filtering ends; The first preset condition is that all the line segments in the target line segment group are located within the target filtering range; The second preset condition is that the number of first intersecting line segments that intersect with the line segments in the target line segment group is not less than the first preset threshold, wherein the first intersecting line segments are line segments in the first parallel line segment group and the first perpendicular line segment group relative to the target line segment group. The third preset condition is that the number of the second intersecting line segments is not less than the second preset threshold, and the second intersecting line segments are the line segments in the frame that intersect with at least two of the first intersecting line segments at the same time.
5. The method as described in claim 1, characterized in that, Determining the target line segment group from the first parallel line segment group and the first perpendicular line segment group includes: Determine the location information of the table name relative to the table; Based on the orientation information, the target line segment group is determined from the first parallel line segment group and the first vertical line segment group.
6. The method as described in claim 1, characterized in that, The step of filtering the line segments within the frame based on the target line segment to determine the table corresponding to the table name includes: Identify the third intersecting line segment that intersects the target line segment with the other of the first parallel line segment group and the first perpendicular line segment group; Determine the fourth intersecting line segment in the drawing frame that intersects with the third intersecting line segment; Based on the third intersecting line segment and the fourth intersecting line segment, the table corresponding to the table name is determined.
7. The method as described in claim 6, characterized in that, The step of determining the table corresponding to the table name based on the third intersecting line segment and the fourth intersecting line segment includes: Based on the third intersecting line segment and the fourth intersecting line segment, a plurality of closed rectangular frames are determined; The content corresponding to the largest closed rectangle among the multiple closed rectangles is determined as the table corresponding to the table name.
8. The method as described in claim 1, characterized in that, The method further includes: Obtain the second parallel line segment group and the second perpendicular line segment group in the table, wherein the line segments in the second parallel line segment group are parallel to the first direction, and the line segments in the second perpendicular line segment group are parallel to the second direction, and the first direction is perpendicular to the second direction; Determine all intersection points between the second group of parallel line segments and the second group of perpendicular line segments; Based on the intersection point, the second parallel line segment group and the second perpendicular line segment group are divided into multiple straight line segments; Based on the multiple line segments, multiple basic cells are determined.
9. The method as described in claim 8, characterized in that, The method further includes: The column information of the table is determined based on the maximum value of the intersection points of the line segments located in the second parallel line segment group; The row information of the table is determined based on the maximum value of the intersection points of the line segments located in the second vertical line segment group; Based on the position information of each basic cell in the plurality of basic cells, the column information, and the row information, the index value of each basic cell in the plurality of basic cells is determined. The index value is used to represent the logical position of each basic cell in the table grid defined by the row information and column information.