Table text processing method, device, electronic device and readable medium
By extracting and clustering sub-line segments in images, determining the direction lines and connection points of the table, the problem of poor accuracy of table recognition in the prior art is solved, and more efficient, accurate and reliable table recognition is achieved.
Patent Information
- Application Number
- CN202210103038.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-27
- Publication Date
- 2025-05-16
- Estimated Expiration
- 2042-01-27
AI Technical Summary
In the prior art, table recognition accuracy is poor, especially when image noise is high and styles are variable, the accuracy and reliability of the extraction table are low.
By extracting the sub-line segments in the image, determining the attribute information of the sub-line segments, and dividing the sub-line segments into the corresponding set of segments based on the attribute information, clustering processing is performed to obtain the direction lines and connection points of the table, thereby determining the text information in the cells of the table.
Improves the efficiency, accuracy and reliability of table recognition, does not require identification, training and testing of tables, and is not affected by table format and image quality.
Smart Images

Figure CN114445840B_ABST
Abstract
Description
Background Art
[0002] Currently, office efficiency is improved by extracting tables from captured images and converting them into spreadsheets through image processing and recognition algorithms.
[0003] In the related art, the table recognition algorithm is usually implemented through a table recognition model, which is trained based on a graph convolutional network and performs post-processing on the node relationship of the table to restore the table structure of the table to be recognized.
[0004] However, the table recognition process relies on a lot of training work, that is, the training process is based on labeled table samples, which not only requires a lot of training and testing work, but also the accuracy and reliability of table extraction are poor when the image is noisy and the style is varied.
[0005] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0006] The purpose of the present disclosure is to provide a method, device, electronic device and readable medium for processing table text, so as to at least overcome the problem of poor table recognition accuracy caused by the limitations and defects of related technologies to a certain extent.
[0007] According to a first aspect of an embodiment of the present disclosure, a method for processing table text is provided, including: extracting sub-line segments in an image; determining attribute information of the sub-line segments; dividing the sub-line segments into corresponding line segment sets according to the attribute information; clustering the sub-line segments in the line segment set to obtain first direction lines, second direction lines and connection points between lines of the table; and determining text information within cells of the table according to the first direction lines, second direction lines and connection points between lines.
[0008] In an exemplary embodiment of the present disclosure, before determining the sub-segments in an image through the LSD (Line Segment Detector) line segment extraction algorithm, it also includes: detecting whether the coloring form of the image to be processed is grayscale; if the coloring form of the image to be processed is not grayscale, recoloring the image to be processed into a grayscale image; and determining the grayscale image as the image to be subjected to the LSD line segment extraction algorithm.
[0009] In an exemplary embodiment of the present disclosure, dividing sub-line segments into corresponding line segment sets according to attribute information includes: parsing the attribute information to determine the first width, first height and angle of the sub-line segment; determining the second width and second height of the image; calculating the width ratio between the first width and the second width; calculating the height ratio between the first height and the second height; dividing the sub-line segments whose width ratio is greater than a preset width ratio and whose angles belong to a preset first angle threshold interval into a first direction line segment set; dividing the sub-line segments whose height ratio is greater than a preset height ratio and whose angles belong to a preset second angle threshold interval into a second direction line segment set.
[0010] In an exemplary embodiment of the present disclosure, clustering sub-line segments in a line segment set to obtain first direction lines, second direction lines, and connection points between lines in a table includes: determining a first spacing between sub-line segments in the line segment set; clustering the sub-line segments into subsets according to the first spacing; determining a second spacing between the subsets; and clustering and merging the sub-line segments according to the second spacing to obtain first direction lines, second direction lines, and connection points between lines in the table.
[0011] In an exemplary embodiment of the present disclosure, clustering and merging sub-line segments according to the second spacing to obtain first-direction lines, second-direction lines, and connection points between lines of a table include: clustering the sub-line segments of the first-direction line segment set according to the second spacing; splicing the sub-line segments of the clustered first-direction line segment set end to end in the row direction to obtain first-direction long line segments of the table; merging the first-direction long line segments in the column direction according to the spacing of the first-direction long line segments to obtain first-direction lines of the table.
[0012] In an exemplary embodiment of the present disclosure, clustering and merging sub-line segments according to the second spacing to obtain first direction lines, second direction lines and connection points between lines in a table also includes: clustering the sub-line segments of the second direction line segment set according to the second spacing; splicing the sub-line segments of the clustered second direction line segment set end to end in the column direction to obtain second direction long line segments of the table; merging the second direction long line segments in the row direction according to the spacing of the second direction long line segments to obtain second direction lines of the table.
[0013] In an exemplary embodiment of the present disclosure, clustering and merging sub-line segments according to the second spacing to obtain first direction lines, second direction lines and connection points between lines of a table also includes: clustering and merging sub-line segments according to the second spacing to obtain first direction lines and second direction lines of the table; determining the intersection between the first direction lines and the second direction lines as the connection points between lines; filtering the first direction lines and the second direction lines according to the connection points between lines; and determining the table to be filled based on the filtered first direction lines, the filtered second direction lines and the connection points between lines.
[0014] In an exemplary embodiment of the present disclosure, the method for processing table text also includes: extracting the table from the image according to the first direction lines, the second direction lines and the connection points between the lines, and determining the cells of the table; performing text detection and text row recognition on the text in the cells; determining the text content in the cells according to the results of the text detection and the results of the text row recognition; and writing the text content into the corresponding table to be filled according to the position coordinates of the connection points between the lines.
[0015] According to a second aspect of an embodiment of the present disclosure, a device for processing table text is provided, including: a determination module for extracting sub-line segments in an image; the determination module is also used to determine attribute information of the sub-line segments; a division module for dividing the sub-line segments into corresponding line segment sets according to the attribute information; a clustering module for clustering the sub-line segments in the line segment set to obtain first direction lines, second direction lines and connection points between lines of the table; the determination module is also used to determine text information in cells of the table according to the first direction lines, second direction lines and connection points between lines.
[0016] According to a third aspect of the present disclosure, an electronic device is provided, comprising: a memory; and a processor coupled to the memory, wherein the processor is configured to execute any one of the above methods based on instructions stored in the memory.
[0017] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, on which a program is stored, and when the program is executed by a processor, the method for processing a table text as described in any one of the above items is implemented.
[0018] The disclosed embodiment extracts sub-line segments from an image and determines the attribute information of the sub-line segments, and then determines the first direction line segments, the second direction line segments and the connection points between the lines based on the attribute information to determine the cells of a table and the corresponding filled text content. It does not require identification, training and testing of the table and is not affected by the table form and image quality, thereby improving the recognition efficiency, accuracy and reliability of the table.
[0019] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0021] Figure 1 is a flowchart of a method for processing table text in an exemplary embodiment of the present disclosure;
[0022] Figure 2 is a flowchart of a method for processing table text in another exemplary embodiment of the present disclosure;
[0023] Figure 3 is a flowchart of a method for processing table text in another exemplary embodiment of the present disclosure;
[0024] Figure 4 is a flowchart of a method for processing table text in another exemplary embodiment of the present disclosure;
[0025] Figure 5 is a flowchart of a method for processing table text in another exemplary embodiment of the present disclosure;
[0026] Figure 6 is a flowchart of a method for processing table text in another exemplary embodiment of the present disclosure;
[0027] Figure 7 is a flowchart of a method for processing table text in another exemplary embodiment of the present disclosure;
[0028] Figure 8 is a flowchart of a method for processing table text in another exemplary embodiment of the present disclosure;
[0029] Fig. 9 is a flowchart of a method for processing table text in another exemplary embodiment of the present disclosure;
[0030] Fig.10 is a schematic diagram of a table in a processing scheme of a table text in an exemplary embodiment of the present disclosure;
[0031] Fig.11 is a schematic diagram of a table in a processing scheme for table text in another exemplary embodiment of the present disclosure;
[0032] Fig.12 is a schematic diagram of a table in a processing scheme of table text in another exemplary embodiment of the present disclosure;
[0033] Fig.13 is a schematic diagram of a table in a processing scheme of table text in another exemplary embodiment of the present disclosure;
[0034] Fig.14 is a schematic diagram of a table in a processing scheme of table text in another exemplary embodiment of the present disclosure;
[0035] Fig.15 is a block diagram of a table text processing device in an exemplary embodiment of the present disclosure;
[0036] Fig.16 is a block diagram of an electronic device in an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0037] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present disclosure will be more comprehensive and complete, and the concepts of the example embodiments are fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present disclosure.
[0038] In addition, the accompanying drawings are only schematic diagrams of the present disclosure, and the same reference numerals in the drawings represent the same or similar parts, so their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities, which do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0039] The exemplary embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
[0040] Figure 1 Detailed description is a flowchart of a method for processing a table text in an exemplary embodiment of the present disclosure.
[0041] refer to Figure 1, the processing methods of table text can include:
[0042] Step S102, extracting sub-line segments in the image.
[0043] Step S104, determining the attribute information of the sub-line segment.
[0044] Step S106: Divide the line sub-segments into corresponding line segment sets according to the attribute information.
[0045] Step S108: clustering the sub-line segments in the line segment set to obtain first direction lines, second direction lines and connecting points between lines in the table.
[0046] Step S110, determining text information in a cell of a table according to the first direction lines, the second direction lines and the connection points between the lines.
[0047] In an exemplary embodiment of the present disclosure, by extracting sub-line segments in an image and determining the attribute information of the sub-line segments, and then determining the first direction line segments, the second direction line segments and the connection points between the lines based on the attribute information, the cells of the table and the corresponding filled text content are determined. There is no need to identify, train and test the table, and it is not affected by the table form and image quality, thereby improving the recognition efficiency, accuracy and reliability of the table.
[0048] In an exemplary embodiment of the present disclosure, the first direction and the second direction are two perpendicular directions.
[0049] In an exemplary embodiment of the present disclosure, the first direction is a horizontal direction.
[0050] In an exemplary embodiment of the present disclosure, the second direction is a longitudinal direction.
[0051] The following is a detailed description of each step of the method for processing table text.
[0052] like Figure 2 As shown, before extracting the sub-line segments in the image, it also includes:
[0053] Step S202, detecting whether the coloring form of the image to be processed is grayscale.
[0054] Step S204: if the coloring form of the image to be processed is not grayscale, the image to be processed is recolored into a grayscale image.
[0055] Step S206, determining the grayscale image as the image to be subjected to the LSD line segment extraction algorithm.
[0056] In an exemplary embodiment of the present disclosure, by converting the input document image into a grayscale image, it is achieved that the local straight line edge is an image area where the grayscale value changes significantly from black to white or from white to black. After conversion to a grayscale image, the straight line edge of the image is more easily detected and extracted by LSD.
[0057] like Figure 3 As shown, dividing the sub-segments into corresponding segment sets according to the attribute information includes:
[0058] Step S302: parsing the attribute information to determine the first width, the first height and the angle of the sub-line segment.
[0059] Step S304, determining a second width and a second height of the image.
[0060] Step S306, calculating a width ratio between the first width and the second width.
[0061] Step S308, calculating the height ratio between the first height and the second height.
[0062] Step S310: divide the sub-line segments whose width ratio is greater than a preset width ratio and whose angles belong to a preset first angle threshold interval into a first direction line segment set.
[0063] Step S312: divide the sub-line segments whose height ratio is greater than the preset height ratio and whose angles belong to the preset second angle threshold interval into the second direction line segment set.
[0064] In an exemplary embodiment of the present disclosure, a method for classifying horizontal line segments is implemented by calculating whether the ratio of the width of a line segment in an image to the width of the image exceeds a threshold value, combined with a horizontal line determination strategy of whether the line segment angle is within a first angle threshold interval. At the same time, by setting the angle threshold interval, this method is made more flexible in detecting horizontal lines of tables with certain rotation angles, thereby greatly reducing the probability of missing horizontal lines in tables.
[0065] In an exemplary embodiment of the present disclosure, the first angle threshold interval is a lateral angle threshold interval.
[0066] In an exemplary embodiment of the present disclosure, a method for classifying vertical line segments is implemented by calculating whether the ratio of the height of a line segment in an image to the image height exceeds a threshold value, combined with a vertical line determination strategy of whether the line segment angle is within a second angle threshold interval. At the same time, by setting the angle threshold interval, this method is made more flexible in detecting vertical lines of tables with certain rotation angles, thereby greatly reducing the probability of missing vertical lines in tables.
[0067] In an exemplary embodiment of the present disclosure, the second angle threshold interval is a longitudinal angle threshold interval.
[0068] like Figure 4 As shown, clustering is performed on the sub-line segments in the line segment set to obtain the first direction lines, second direction lines and line connection points in the table, including:
[0069] Step S402: determining a first spacing between sub-line segments in the line segment set.
[0070] Step S404: clustering the sub-line segments into subsets according to the first distance.
[0071] Step S406: determine a second interval between subsets.
[0072] Step S408: clustering and merging the sub-line segments according to the second spacing to obtain the first direction lines, the second direction lines and the connection points between the lines in the table.
[0073] In an exemplary embodiment of the present disclosure, all horizontal line segments are sorted by y-axis coordinates, and after the horizontal line segments are arranged in order from top to bottom, it is determined whether multiple horizontal line segments can be aggregated into a long horizontal line segment in the horizontal direction by calculating whether the spacing between two adjacent horizontal lines on the left and right sides in the first direction of the x-axis is less than a certain threshold. This makes up for the deficiency that the local detection algorithm will be split into multiple line segments in the horizontal direction when extracting straight lines, and improves the accuracy of extracting horizontal lines in tables.
[0074] In an exemplary embodiment of the present disclosure, all vertical line segments are sorted by x-axis coordinates, and after the vertical line segments are arranged in order from left to right, it is determined whether multiple vertical line segments can be aggregated into a long vertical line segment in the vertical direction by calculating whether the distance between each two adjacent vertical lines in the second direction of the y-axis is less than a certain threshold. This makes up for the deficiency that the local detection algorithm will be split into multiple line segments in the vertical direction when extracting straight lines, and improves the accuracy of extracting vertical lines in tables.
[0075] In an exemplary embodiment of the present disclosure, after all horizontal line segments are arranged in order from left to right, it is determined whether multiple horizontal line segments can be aggregated into a long horizontal line segment by calculating whether the distance between every two adjacent horizontal lines in the second direction of the y-axis is less than a certain threshold. This makes up for the deficiency that the local detection algorithm will extract two or more adjacent horizontal line segments for the same horizontal line segment in the vertical direction when performing straight line extraction, and further improves and ensures the accuracy of the extraction of horizontal line segments in the table.
[0076] In an exemplary embodiment of the present disclosure, after all vertical line segments are arranged in order from top to bottom, it is determined whether multiple vertical line segments can be aggregated into one long vertical line segment by calculating whether the spacing between every two adjacent vertical lines in the first direction of the x-axis is less than a certain threshold. This makes up for the deficiency that the local detection algorithm will extract two or more adjacent vertical line segments for the same vertical line segment in the horizontal direction when performing straight line extraction, and further improves and ensures the accuracy of the extraction of the vertical line segments of the table.
[0077] like Figure 5 As shown, the sub-line segments are clustered and merged according to the second spacing to obtain the first direction lines, the second direction lines and the connection points between the lines in the table, including:
[0078] Step S502: clustering the sub-segments of the first direction segment set according to the second interval.
[0079] Step S504 , performing head-to-tail splicing in the row direction on the sub-segments of the clustered first-direction line segment set to obtain the first-direction long line segments of the table.
[0080] Step S506 , merging the long line segments in the first direction in the column direction according to the spacing between the long line segments in the first direction to obtain the first direction lines of the table.
[0081] In an exemplary embodiment of the present disclosure, multiple short horizontal line segments are first connected end to end in the row direction to form a long horizontal line segment, and then two or more horizontal line segments with very close spacing in the column direction are merged into one horizontal line segment. High-precision extraction of table horizontal lines is double guaranteed.
[0082] like Figure 6 As shown, clustering and merging the sub-line segments according to the second spacing to obtain the first direction lines, the second direction lines and the connecting points between the lines in the table also include:
[0083] Step S602: clustering the sub-segments of the second direction segment set according to the second interval.
[0084] Step S604 , performing head-to-tail splicing in the column direction on the sub-line segments of the clustered second-direction line segment set to obtain the second-direction long line segments of the table.
[0085] Step S606 , merging the second direction long line segments in the row direction according to the spacing between the second direction long line segments to obtain the second direction lines of the table.
[0086] In an exemplary embodiment of the present disclosure, multiple short vertical line segments are first connected end to end in the column direction to form a long vertical line segment, and then two or more columns of vertical line segments with very close spacing are merged into one vertical line segment in the row direction. Double guarantee is achieved for high-precision extraction of table vertical lines.
[0087] like Figure 7 As shown, clustering and merging the sub-line segments according to the second spacing to obtain the first direction lines, the second direction lines and the connecting points between the lines in the table also include:
[0088] Step S702: clustering and merging the sub-line segments according to the second spacing to obtain the first direction lines and the second direction lines of the table.
[0089] Step S704: determine the intersection point between the first direction line and the second direction line as the line connection point.
[0090] Step S706: screening the lines in the first direction and the lines in the second direction according to the connection points between the lines.
[0091] Step S708, determining a table to be filled according to the filtered first direction lines, the filtered second direction lines and the connection points between the lines.
[0092] In an exemplary embodiment of the present disclosure, after the classified horizontal and vertical line segments are subjected to two screenings of line segment clustering and line segment merging, the intersection features of all line segments are analyzed to exclude the horizontal and vertical lines that do not meet the intersection features of the wired table in the document image, thereby realizing three rounds of screening of the table lines. On the one hand, the three rounds of screening are closely combined with the table line features in the document image, and on the other hand, the phenomenon that a line segment is split into multiple line segments when the local detection algorithm detects the line segments is reasonably avoided, so that the detection of the table by the method of the patent is more robust.
[0093] like Figure 8 As shown, the method for processing table text also includes:
[0094] Step S802: extracting a table from the image according to the first direction lines, the second direction lines and the connection points between the lines, and determining the cells of the table.
[0095] Step S804, performing text detection and text line recognition on the text in the cell.
[0096] Step S806, determining the text content in the cell according to the result of text detection and the result of text line recognition.
[0097] Step S808, writing the text content into the corresponding table to be filled according to the position coordinates of the connection points between the lines.
[0098] In an exemplary embodiment of the present disclosure, the table horizontal line set and the table vertical line set are merged into a new set, and the horizontal lines and vertical lines with intersections are subjected to a "union" operation of a union-find set in the new set, and classified into a parent class. After a round of union operations, all horizontal lines and vertical lines belonging to the same table are classified into a set of a parent class. Then, these subsets are traversed, and a "check" operation of a union-find set is performed to find the horizontal line set and the vertical line set belonging to the same parent node (that is, belonging to the same table), so as to achieve accurate extraction of line segment information of multiple tables.
[0099] In an exemplary embodiment of the present disclosure, after analyzing the line segment information of each table, the position information of all intersection points in the table is obtained, and then the position coordinates of the four outermost corner points of each table are extracted to achieve positioning and detection of multiple tables.
[0100] In an exemplary embodiment of the present disclosure, a correspondence is established based on the four-point position information of the cell and the text row position coordinate information of text detection. If there are multiple lines of text in a cell, the multiple lines of text are spliced into one line of text and corresponded to the cell; if there is only one line of text in a cell, the single line of text is directly corresponded to the cell; if a cell has no recognized text, the text content corresponding to the cell is empty, thereby achieving accurate recognition of single-line text, multiple lines of text and empty text in the table.
[0101] like Fig. 9 , Fig.10 , Fig.11 , Fig.12 , Fig.13 and Fig.14 As shown, the method for processing table text according to an embodiment of the present disclosure also includes:
[0102] Step S902, start processing of table text.
[0103] Step S904 , converting the document image into a grayscale image 1002 .
[0104] In one embodiment of the present disclosure, before using the LSD line segment detection algorithm, the input document image needs to be converted into a grayscale image, thereby realizing that the local straight line edge is an image area where the grayscale value changes significantly from black to white or from white to black. After the image is converted into a grayscale image, the straight line edge of the image is easier to be detected and extracted by LSD, such as Fig.10 As shown, the grayscale image 1002 also includes a borderless text box 1006, and the content of the text box is not extracted.
[0105] Step S906: Use LSD to perform line segment detection on the image.
[0106] Step S908, determine whether there is a line segment in the image, if so, execute step S910, if not, execute step S926.
[0107] Step S910, constructing a line segment set, and screening out a line segment set L that meets the characteristic length of the table (1004 or 1008).
[0108] Step S912, line segment set classification: calculate the angles and lengths of all line segments in the line segment set L, and classify the line segment set L into a horizontal line set HL and a vertical line set VL according to a preset threshold.
[0109] In one embodiment of the present disclosure, the line segments extracted by LSD are counted into the line segment set L. If the line segment set L is not empty, the line segment features in the line segment set L are analyzed to obtain the width, height and angle information of each line segment. The width w_i and height h_i of each line segment are calculated to correspond to the ratio of the width W and height H of the document image, respectively, and are recorded as w_ratio_i and h_ratio_i, respectively. According to the preset rules of threshold judgment, the first horizontal line set HL and the first vertical line set VL that meet the line features of the table (1004 or 1008) are preliminarily screened out.
[0110] In one embodiment of the present disclosure, the preset rules for threshold judgment include: if w_ratio_i is greater than a set threshold and the angle of the line segment is within the threshold interval of the first angle, then the line segment is divided into a horizontal line set, and the line segment is divided into the first horizontal line set HL.
[0111] In one embodiment of the present disclosure, the preset rules for threshold judgment include: if h_ratio_i is greater than a set threshold and the angle of the line segment is within the threshold interval of the second angle, then the line segment is divided into a vertical line set, and the line segment is divided into a first vertical line set VL.
[0112] Step S914, determining whether both the first horizontal line set HL and the first vertical line set VL exist, if so, executing step S916, if not, executing step S926.
[0113] Step S916, line segment clustering: based on the attribute characteristics of the table (1004 or 1008), the attribute information includes width, height, spacing and angle information, but is not limited thereto, the horizontal lines and vertical lines that do not belong to the table (1004 or 1008) are filtered out from the first horizontal line set HL and the first vertical line set VL to complete a screening of the lines in the table (1004 or 1008).
[0114] In one embodiment of the present disclosure, if the L set is empty, or any one of the first horizontal line set HL and the first vertical line set VL is empty, it means that there is no wired table (1004 or 1008) in the document image, because the wired table (1004 or 1008) is composed of horizontal lines and vertical lines. Therefore, when L is empty, or any one of the first horizontal line set HL and the first vertical line set VL is empty, it is detected that there is no wired table (1004 or 1008) and no table (1004 or 1008) recognition is performed.
[0115] Step S918, line segment merging: merge the horizontal lines in the same row and the vertical lines in the same column in the horizontal line set HT and the vertical line set VT, respectively, and record them as the horizontal line set HL' and the vertical line set VL', completing the secondary screening of the lines in the table (1004 or 1008).
[0116] In one embodiment of the present disclosure, the step of merging horizontal lines includes:
[0117] (1) Sort all the line segments in the first horizontal line set HL by their y-axis coordinates. This is done to arrange the horizontal lines in the first horizontal line set HL in order from top to bottom. Calculate the distance between each two adjacent horizontal line segments in the sorted first horizontal line set HL. If the distance is less than a certain threshold, it means that these two horizontal line segments are likely to be a long horizontal line segment. In the first horizontal line set HL, a small group is created for these line segments that were originally a long horizontal line, recorded as Hgroup(i).
[0118] (2) All line segments in each small set Hgroup(i) are sorted according to the x-axis coordinates. This is done to arrange the line segments in each subset Hgroup(i) in order from left to right. Then, the L2 distance between each subset is calculated based on the subset Hgroup(i). A certain threshold condition is set according to the L2 distance. Combined with the characteristics of LSD for line detection in the table (1004 or 1008), the horizontal lines in the table (1004 or 1008) can be screened, thereby completing a screening of the horizontal line segments in the table (1004 or 1008). The L2 distance HL2_distance between each subset of horizontal lines is calculated as shown in the following formula (1):
[0119]
[0120] Where i and j are the line segment numbers in the Hgroup subset, Hgroup(i) start is the starting point of the i-th horizontal line segment in the subset Hgroup(i), Hgroup(i) endis the end point of the i-th horizontal line segment in the subset Hgroup(i), Hgroup(j) start is the starting point of the jth horizontal line segment in the subset Hgroup(i), Hgroup(j) end It is the end point of the j-th horizontal line segment in the subset Hgroup(i).
[0121] In one embodiment of the present disclosure, the step of merging the vertical lines includes:
[0122] All the line segments in the first vertical line set VL are sorted by x-axis coordinates. This is done to arrange the vertical lines in the first vertical line set VL from left to right. The distance between each two adjacent vertical line segments in the sorted first horizontal line set HL is calculated. If the distance is less than a certain threshold, it means that these two vertical line segments are likely to be a long vertical line segment. A small set is established in the set VL for these line segments that were originally a long vertical line, recorded as Vgroup(i).
[0123] All the line segments in each small set Vgroup(i) are sorted according to the y-axis coordinates. This is done to arrange the line segments in each subset Vgroup(i) in order from top to bottom, and then calculate the L2 distance between each subset based on the subset Vgroup(i). According to the L2 distance, a certain threshold condition is set. Combined with the characteristics of LSD for line detection of the table (1004 or 1008), the vertical lines belonging to the table (1004 or 1008) can be screened, thereby completing a screening of the vertical line segments in the table (1004 or 1008).
[0124] The L2 distance VL2_distance between each subset of vertical lines is calculated as shown in the following formula (2):
[0125]
[0126] Where i and j are the line segment numbers in the subset Vgroup(i), Vgroup(i) start is the starting point of the i-th vertical line segment in the subset Vgroup(i), Vgroup(i) end is the end point of the i-th vertical line segment in the subset Vgroup(i), Vgroup(j) start is the starting point of the jth vertical line segment in the subset Vgroup(i), Vgroup(j) end It is the end point of the j-th vertical line segment in the subset Vgroup(i).
[0127] In one embodiment of the present disclosure, after the horizontal line clustering of the table (1004 or 1008) is completed and the first horizontal line set HL is obtained after screening, the horizontal line segments of all the subsets Hgroup(i) in the first horizontal line set HL are merged, and the merging strategy is as follows:
[0128] In one embodiment of the present disclosure, a row-wise merge is first performed: if there is a long horizontal line segment corresponding to multiple short horizontal line segments in the subset Hgroup(i), the multiple short horizontal line segments are connected end to end to form a long horizontal line segment.
[0129] In one embodiment of the present disclosure, column-wise merging is performed later: if a horizontal line segment in the subset Hgroup(i) is detected with multiple rows of horizontal line segments with very close spacing, these multiple rows of horizontal line segments are merged into the following: Fig.11 A horizontal line (1102 or 1104) is shown.
[0130] In one embodiment of the present disclosure, after the horizontal lines of the table (1004 or 1008) are merged, the phenomenon that a long horizontal line is split into multiple short horizontal lines during extraction is accurately eliminated.
[0131] In one embodiment of the present disclosure, column-wise merging is first performed: if there is a long vertical line segment corresponding to multiple short vertical line segments in the subset Vgroup(i), the multiple short vertical line segments are connected end to end to form a long vertical line segment.
[0132] In one embodiment of the present disclosure, row-wise merging is performed later: if a vertical line segment in the subset Vgroup(i) is detected with multiple columns of vertical line segments with very close spacing, these multiple columns of vertical line segments are merged into the following: Fig.12 A vertical line (1202 or 1204) is shown.
[0133] In one embodiment of the present disclosure, after the vertical lines of the table (1004 or 1008) are merged, the phenomenon that a long vertical line is split into multiple short vertical lines during extraction is accurately eliminated.
[0134] Step S920, intersection calculation: calculate the intersections of the second horizontal line set HL' and the second vertical line set VL', and record the number of intersections of each horizontal line and each vertical line.
[0135] Step S922, three-fold screening of the lines in the table (1004 or 1008): three-fold screening of the second horizontal line set HL' and the second vertical line set VL' according to the intersection features of the horizontal lines and vertical lines in the table (1004 or 1008).
[0136] In one embodiment of the present disclosure, after obtaining the second horizontal line set HL' and the second vertical line set VL' that have undergone secondary screening, the intersection points of all line segments in the second horizontal line set HL' and the second vertical line set VL' are calculated, and the number of intersection points of each horizontal line and vertical line is marked, and the horizontal lines and vertical lines that do not meet the intersection features of the wired table (1004 or 1008) in the document image are excluded, completing the third round of screening of the table (1004 or 1008) lines.
[0137] In one embodiment of the present disclosure, after the third screening of the horizontal and vertical lines of the table (1004 or 1008) is performed in combination with the line segment intersection features, the extraction effect of the vertical lines of the table (1004 or 1008) is greatly improved. Through the intersection features of the table (1004 or 1008), the line segments outside the table (1004 or 1008) are effectively filtered out, which greatly improves the accuracy of the line detection of the table (1004 or 1008).
[0138] Step S924, determining whether the second horizontal line set HL' and the second vertical line set VL' are both non-empty sets, if so, executing step S928, if not, executing step S926.
[0139] Step S926, detecting that there is no table (1004 or 1008).
[0140] Step S928, multiple table (1004 or 1008) detection: Based on the position information of all the intersection points 1402 of the table (1004 or 1008), the coordinate positions of the outermost four corner points 1402 of the table (1004 or 1008) are calculated. One table (1004 or 1008) corresponds to a group of four corner points 1402. The position coordinate information of multiple tables (1004 or 1008) is located according to the number of corner point groups.
[0141] In one embodiment of the present disclosure, after completing the third round of screening of table horizontal lines and vertical lines in the document image using table intersection information, the final quasi-table horizontal line set and quasi-table vertical line set are obtained.
[0142] In one embodiment of the present disclosure, Fig.13 As shown, the quasi-table horizontal line set 1302 and the quasi-table vertical line set 1304 are first merged into a new set 1306. In the new set 1306, the horizontal lines and vertical lines that have intersections are subjected to a "union" operation of a union-find set and classified into a parent class. After a round of union operations, all the horizontal lines and vertical lines belonging to the same table are classified into a set of a parent class, such as Fig.13The first parent set 1308, the second parent set 1310 and the third parent set 1312 are shown. Next, these subsets are traversed, and the "check" operation of the union-find set is performed to find the horizontal line set and the vertical line set belonging to the same parent node (that is, belonging to the same table), and the multi-table line segment information is extracted to obtain the first sub-table 1314, the second sub-table 1316 and the third sub-table 1318 corresponding to the parent set.
[0143] In one embodiment of the present disclosure, by obtaining all the line segment information in each table, all the intersection position information in each table can be calculated based on the line segment information, and then the point coordinates of the four outermost corners 1402 of each table can be extracted to achieve the positioning of each table and complete the detection function of multiple tables in the document image.
[0144] Step S930, coordinates of the four corner points 1402 of the table cell are located: Fig.14 As shown, based on the position information of all intersection points 1404 of the second horizontal line set HL' and the second vertical line set VL', and the position information of all line segments of the table, the coordinate position information of the four corner points 1402 of each cell in the table is obtained.
[0145] In one embodiment of the present disclosure, the table horizontal line set after the third round of screening is sorted from left to right, and the table vertical line set is sorted from top to bottom, and the position information of all intersection points 1404 of all line segments in the two sets are calculated in turn, and the position information is converted into coordinate information of four corner points 1402 in units of table cells.
[0146] Step S932, table cell text recognition: taking cells as units, use text detection and text recognition modules to perform text line detection and text line recognition respectively, so as to extract the text content of table cells.
[0147] Step S934, excel generation: Use the xlwt tool to write the coordinate information of the four corner points 1402 of the table cell and the corresponding text content into excel one by one.
[0148] In one embodiment of the present disclosure, after obtaining the four-point coordinate position information of the table cell, the cell is cut out from the document image, and the text in the cell is respectively detected and recognized using the text detection and text recognition algorithms. According to the four-point position information of the text line detection box and the four-point position information of the table cell, the corresponding relationship between the cell and the text is found:
[0149] If there are multiple lines of text in a cell, the multiple lines of text are concatenated into one line of text and assigned to the cell;
[0150] If there is only one line of text in a cell, the single line of text will be directly matched to the cell;
[0151] If no text is recognized in a cell, the text content corresponding to the cell is empty.
[0152] In one embodiment of the present disclosure, the xlwt tool is used to write the four-point position coordinates and text content of the table cells into Excel one by one, and finally the Excel table output is completed.
[0153] In one embodiment of the present disclosure, xlwt is a library for operating Excel in Python, which can save data in Excel.
[0154] Step S936, generate and output an Excel spreadsheet.
[0155] Step S938, no table output.
[0156] Corresponding to the above method embodiment, the present disclosure also provides a table text processing device, which can be used to execute the above method embodiment.
[0157] Fig.15 It is a block diagram of a device for processing a table text in an exemplary embodiment of the present disclosure.
[0158] refer to Fig.15 , the table text processing device 1500 may include:
[0159] The determination module 1502 is used to extract sub-line segments in the image.
[0160] The determination module 1502 is further used to determine the attribute information of the sub-line segment.
[0161] The division module 1504 is used to divide the sub-segments into corresponding segment sets according to the attribute information.
[0162] The clustering module 1506 is used to perform clustering processing on the sub-line segments in the line segment set to obtain the first direction lines, the second direction lines and the connection points between the lines in the table.
[0163] The determination module 1502 is further configured to determine text information in a cell of the table according to the first direction lines, the second direction lines, and the connection points between the lines.
[0164] In an exemplary embodiment of the present disclosure, the determination module 1502 is also used to: detect whether the coloring form of the image to be processed is grayscale; if the coloring form of the image to be processed is not grayscale, recolor the image to be processed into a grayscale image; and determine the grayscale image as the image to be subjected to the LSD line segment extraction algorithm.
[0165] In an exemplary embodiment of the present disclosure, the division module 1504 is also used to: parse attribute information to determine the first width, first height and angle of the sub-segment; determine the second width and second height of the image; calculate the width ratio between the first width and the second width; calculate the height ratio between the first height and the second height; divide the sub-segments whose width ratio is greater than the preset width ratio and whose angles belong to the preset first angle threshold interval into the first direction segment set; divide the sub-segments whose height ratio is greater than the preset height ratio and whose angles belong to the preset second angle threshold interval into the second direction segment set.
[0166] In an exemplary embodiment of the present disclosure, the clustering module 1506 is also used to: determine a first spacing between sub-segments in a segment set; cluster the sub-segments into subsets according to the first spacing; determine a second spacing between subsets; cluster and merge the sub-segments according to the second spacing to obtain first direction lines, second direction lines, and connection points between lines in a table.
[0167] In an exemplary embodiment of the present disclosure, the clustering module 1506 is also used to: cluster the sub-segments of the first direction line segment set according to the second spacing; connect the sub-segments of the clustered first direction line segment set end to end in the row direction to obtain the first direction long line segments of the table; merge the first direction long line segments in the column direction according to the spacing of the first direction long line segments to obtain the first direction lines of the table.
[0168] In an exemplary embodiment of the present disclosure, the clustering module 1506 is also used to: cluster the sub-segments of the second direction line segment set according to the second spacing; perform head-to-tail splicing in the column direction on the clustered sub-segments of the second direction line segment set to obtain the second direction long line segments of the table; and merge the second direction long line segments in the row direction according to the spacing of the second direction long line segments to obtain the second direction lines of the table.
[0169] In an exemplary embodiment of the present disclosure, the clustering module 1506 is also used to: cluster and merge the sub-line segments according to the second spacing to obtain the first direction lines and the second direction lines of the table; determine the intersection between the first direction lines and the second direction lines as the connection points between the lines; filter the first direction lines and the second direction lines according to the connection points between the lines; determine the table to be filled based on the filtered first direction lines, the filtered second direction lines and the connection points between the lines.
[0170] In an exemplary embodiment of the present disclosure, the determination module 1502 is also used to: extract a table from an image based on first direction lines, second direction lines and connection points between lines, and determine cells of the table; perform text detection and text line recognition on the text in the cell; determine the text content in the cell based on the results of text detection and text line recognition; and write the text content into the corresponding table to be filled based on the position coordinates of the connection points between lines.
[0171] Since the functions of the device 1500 have been described in detail in the corresponding method embodiments, the present disclosure will not elaborate on them here.
[0172] In summary, the embodiments of the present disclosure, with the help of the LSD line segment extraction method, have realized a complete solution for detecting and identifying wired tables through line segment set extraction and classification, line segment clustering, line segment merging, intersection calculation, multi-table detection, table cell position coordinate positioning, table cell text recognition, Excel generation and other methods.
[0173] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.
[0174] In an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided.
[0175] It will be appreciated by those skilled in the art that various aspects of the present invention may be implemented as a system, method or program product. Therefore, various aspects of the present invention may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as a "circuit", "module" or "system".
[0176] Refer to the following Fig.16 16A and 16B are used to describe the electronic device 1600 according to this embodiment of the present invention. Fig.16 The electronic device 1600 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0177] like Fig.16As shown, the electronic device 1600 is in the form of a general computing device. The components of the electronic device 1600 may include but are not limited to: at least one processing unit 1610, at least one storage unit 1620, and a bus 1630 connecting different system components (including the storage unit 1620 and the processing unit 1610).
[0178] The storage unit stores program codes, which can be executed by the processing unit 1610, so that the processing unit 1610 performs the steps of various exemplary embodiments of the present invention described in the above “Exemplary Method” section of this specification. For example, the processing unit 1610 can perform the method shown in the embodiment of the present disclosure.
[0179] The storage unit 1620 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 16201 and / or a cache storage unit 16202 , and may further include a read-only storage unit (ROM) 16203 .
[0180] The storage unit 1620 may also include a program / utility 16204 having a set (at least one) of program modules 16205, such program modules 16205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0181] Bus 1630 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0182] The electronic device 1600 may also communicate with one or more external devices 1640 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 1600, and / or communicate with any device that enables the electronic device 1600 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 1650. Furthermore, the electronic device 1600 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 1660. As shown, the network adapter 1660 communicates with other modules of the electronic device 1600 via a bus 1630. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 1600, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0183] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present disclosure.
[0184] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of the present specification is stored. In some possible implementations, various aspects of the present invention may also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Method" section of the present specification.
[0185] The program product for implementing the above method according to an embodiment of the present invention can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto, and in this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.
[0186] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0187] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0188] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0189] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0190] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to an exemplary embodiment of the present invention, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0191] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are to be considered exemplary only, and the true scope and concept of the present disclosure are indicated by the claims.
Claims
1. A method for processing table text, characterized in that: include: Extract sub-line segments in the image; Determining attribute information of the sub-line segment; Dividing the sub-line segments into corresponding line segment sets according to the attribute information includes: parsing the attribute information to determine a first width, a first height, and an angle of the sub-line segment; determining a second width and a second height of the image; calculating a width ratio between the first width and the second width; Calculating a height ratio between the first height and the second height; Divide the sub-line segments whose width ratio is greater than the preset width ratio and whose angles belong to the preset first angle threshold interval into the first direction line segment set; Divide the sub-line segments whose height ratio is greater than the preset height ratio and whose angles belong to the preset second angle threshold interval into the second direction line segment set; Clustering the sub-line segments in the line segment set to obtain first direction lines, second direction lines and connecting points between lines in a table; The text information in the cell of the table is determined according to the first directional lines, the second directional lines and the connection points between the lines.
2. The method for processing a table text according to claim 1, characterized in that: Before extracting the sub-line segments in the image, it also includes: Detect whether the coloring form of the image to be processed is grayscale; If the coloring form of the image to be processed is not the grayscale, recoloring the image to be processed into a grayscale image; The grayscale image is determined as the image to be extracted.
3. The method for processing table text according to claim 1, characterized in that: Clustering the sub-line segments in the line segment set to obtain first direction lines, second direction lines, and line connection points in a table includes: Determine the spacing between the sub-line segments in the line segment set and record it as a first spacing; clustering the sub-line segments into subsets according to the first spacing; Determine the spacing between the subsets and record it as a second spacing; The sub-line segments are clustered and merged according to the second spacing to obtain first direction lines, second direction lines and connecting points between lines in a table.
4. The method for processing table text according to claim 3, characterized in that: Clustering and merging the sub-line segments according to the second spacing to obtain first direction lines, second direction lines, and line connection points in a table include: Clustering the sub-segments of the first direction segment set according to a second spacing; Performing head-to-tail splicing in the row direction on the sub-segments of the clustered first-direction line segment set to obtain the first-direction long line segments of the table; The long line segments in the first direction are merged in a column direction according to the spacing between the long line segments in the first direction to obtain the first direction lines of the table.
5. The method for processing table text according to claim 3, characterized in that: Clustering and merging the sub-line segments according to the second spacing to obtain the first direction lines, the second direction lines, and the connecting points between the lines in the table further includes: Clustering the sub-segments of the second direction segment set according to a second spacing; Performing head-to-tail splicing in the column direction on the sub-segments of the clustered second-direction line segment set to obtain the second-direction long line segments of the table; The second-direction long line segments are merged in a row direction according to the spacing between the second-direction long line segments to obtain the second-direction lines of the table.
6. The method for processing a table text according to any one of claims 3 to 5, characterized in that: Clustering and merging the sub-line segments according to the second spacing to obtain the first direction lines, the second direction lines, and the connecting points between the lines in the table further includes: Clustering and merging the sub-line segments according to the second spacing to obtain first direction lines and second direction lines of a table; Determine the intersection point between the first direction line and the second direction line as the line connection point; Screening the first direction lines and the second direction lines according to the connection points between the lines; A table to be filled is determined according to the filtered first direction lines, the filtered second direction lines and the connection points between the lines.
7. The method for processing table text according to claim 6, characterized in that: Also includes: Extracting a table from the image according to the first directional lines, the second directional lines and the connection points between the lines, and determining cells of the table; Performing text detection and text line recognition on the text in the cell; Determine the text content in the cell according to the result of the text detection and the result of the text line recognition; The text content is written into the corresponding table to be filled according to the position coordinates of the connection points between the lines.
8. A device for processing table text, characterized in that: include: A determination module, used for extracting sub-line segments in an image; The determination module is further used to determine the attribute information of the sub-line segment; A division module, used to divide the sub-segments into corresponding segment sets according to the attribute information, including: parsing the attribute information to determine a first width, a first height, and an angle of the sub-line segment; determining a second width and a second height of the image; calculating a width ratio between the first width and the second width; Calculating a height ratio between the first height and the second height; Divide the sub-line segments whose width ratio is greater than the preset width ratio and whose angles belong to the preset first angle threshold interval into the first direction line segment set; Divide the sub-line segments whose height ratio is greater than the preset height ratio and whose angles belong to the preset second angle threshold interval into the second direction line segment set; A clustering module, used for clustering the sub-line segments in the line segment set to obtain the first direction lines, the second direction lines and the connection points between the lines in the table; The determination module is further used to determine text information in the cell of the table according to the first direction line, the second direction line and the connection point between the lines.
9. An electronic device, characterized in that: include: Memory; as well as A processor coupled to the memory, wherein the processor is configured to execute the table text processing method according to any one of claims 1 to 7 based on instructions stored in the memory.
10. A computer-readable storage medium having a program stored thereon, wherein when the program is executed by a processor, the method for processing a table text according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Page conversion method and device and page conversion equipment
CN107943956A
Table cell extraction method and device, equipment and computer readable storage medium
CN112528724A