Table reduction method and device, storage medium and electronic device

By identifying and supplementing table lines in the table segmentation diagram, a table in edit mode is generated, which solves the problems of low efficiency and low accuracy in table restoration in the existing technology and achieves efficient and accurate table restoration.

CN114239508BActive Publication Date: 2026-02-17BEIJING JINSHAN ZHIYUAN OFFICE SOFTWARE CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111565617.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-20
Publication Date
2026-02-17
Estimated Expiration
2041-12-20

AI Technical Summary

Technical Problem

Existing technologies cannot accurately identify tables when table lines are present in images, resulting in low table reconstruction efficiency and low accuracy.

Method used

By obtaining the table segmentation image of the input image, the first table line on the half-border table is identified, and the second table line is determined based on these lines to supplement the missing lines, thus generating a table in the edit state.

Benefits of technology

It enables automatic and accurate reconstruction of tables in images even when lines are missing or incomplete, improving the efficiency and accuracy of table recognition and avoiding the inefficiency of traditional methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114239508B_ABST
    Figure CN114239508B_ABST
Patent Text Reader

Abstract

The application discloses a table restoration method and device, a storage medium and an electronic device. The method comprises the following steps: obtaining a table segmentation graph corresponding to an input picture, wherein the input picture contains a half-frame table to be restored, and the half-frame table is a table with default table lines; identifying a first table line displayed on the half-frame table from the table segmentation graph; determining a second table line based on the first table line, wherein the second table line is used to supplement the default table line in the half-frame table; and generating an edited table according to the first table line and the second table line. Thus, in the case of a table with missing lines or few lines in the input picture, the table in the picture can be automatically and accurately restored by a low-cost method, thereby avoiding the problem of low restoration efficiency of the table with missing lines or few lines by using a traditional method, and achieving the technical effects of improving table recognition efficiency and recognition accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computers, and more specifically, to a table restoration method and apparatus, a storage medium, and an electronic device. Background Technology

[0002] In daily office and study settings, people often take photos to quickly record key information from paper documents. However, converting this information into editable electronic documents after recording it via images becomes a tedious task.

[0003] Existing image recognition technologies can identify editable text content within images with a certain degree of accuracy. However, when the image contains both text and table lines, current technologies cannot accurately identify it. Therefore, when table lines are present in an image, users must manually create a new table based on the existing lines and content, then fill in the manually created table with the visually recognized text. This manually reconstructed table is prone to errors due to human negligence, resulting in low efficiency and a high error rate when reconstructing tables from a large number of images. In other words, existing methods suffer from low efficiency and low accuracy in table reconstruction.

[0004] There is currently no effective solution to the above problems. Summary of the Invention

[0005] The present invention provides a table restoration method and apparatus, storage medium and electronic device, to at least solve the technical problems of low accuracy and low efficiency in table restoration in the prior art.

[0006] According to one aspect of the present invention, a table restoration method is provided, comprising:

[0007] Obtain a table segmentation image corresponding to the input image, wherein the input image contains a half-border table to be restored, and the half-border table is a table with default table lines;

[0008] Identify the first table line displayed on the half-border table from the table segmentation diagram;

[0009] A second table line is determined based on the first table line, wherein the second table line is used to supplement the default table lines in the half-border table;

[0010] The table in edit mode is generated based on the first table line and the second table line.

[0011] Optionally, determining the second table line based on the first table line includes:

[0012] Supplement a probe line between two adjacent first table lines, wherein the probe line will form a closed border with the two adjacent first table lines, and each probe line is assigned a number.

[0013] The second table line is determined from the probe line.

[0014] Optionally, supplementing the detection line between two adjacent first table lines includes:

[0015] Obtain a reference slope from two adjacent first table lines to supplement the default table line;

[0016] The detection line is drawn between two adjacent first table lines according to the reference slope.

[0017] Optionally, determining the second table line from the detection line includes:

[0018] Determine the text box containing the text content in the half-bordered table;

[0019] Obtain candidate table lines from the probe lines that do not intersect with the text box;

[0020] Select at least one from the candidate table lines as the second table line.

[0021] Optionally, obtaining candidate table lines that do not intersect the text box from the probe lines includes:

[0022] The intersection state between each of the probe lines and each edge of the text box is obtained sequentially;

[0023] If the probe line intersects with at least one edge of the text box, delete the probe line;

[0024] If the probe line does not intersect with any of the edges of the text box, the probe line is retained;

[0025] The retained probe lines are identified as the candidate table lines.

[0026] Optionally, selecting at least one from the candidate table lines as the second table line includes:

[0027] Determine the number of each of the candidate table lines configured;

[0028] Multiple candidate table lines with consecutive numbers are identified as a group of table line segments;

[0029] From each group of table line segments, one candidate table line is determined as the second table line.

[0030] Optionally, determining a group of consecutively numbered candidate table lines as a set of table line segments includes:

[0031] Control the first and second pointers to move at a first speed in the target direction, respectively;

[0032] If the first pointer and the second pointer detect the first candidate table line that does not intersect with the text box, the second pointer is controlled to stop moving, and the first pointer is controlled to move at a second speed.

[0033] When the first pointer detects a reference table line, the first candidate table line that does not intersect with the text box and the reference table line are identified as a set of table line segments.

[0034] Optionally, determining a candidate table line as the second table line from each group of table line segments includes:

[0035] Traverse the table line segments;

[0036] The weights of the candidate table lines for the table line segment are determined, and the candidate table lines with larger weights are selected as the second table lines.

[0037] Optionally, after determining the second table line based on the first table line, the method further includes:

[0038] Obtain the display pattern of the first table line and the second table line;

[0039] If the display form of the first table line and the second table line is not a table line that meets the display conditions, the image carrying the first table line and the second table line is input into the calculation module to obtain the calculation result;

[0040] Based on the calculation results, the first and second table lines that meet the display conditions are reconstructed.

[0041] Optionally, the step of inputting the image carrying the first table line and the second table line into the calculation module, obtaining the calculation result, and reconstructing the first table line and the second table line that meet the display conditions based on the calculation result includes:

[0042] In the calculation module, the coordinate information of the original cell formed between the first table line and the second table line is calculated based on the connected component between the first table line and the second table line. The coordinate information includes: the starting coordinates of the original cell, the centroid coordinates of the original cell, and the ending coordinates of the original cell.

[0043] Based on the coordinate information, determine the edge lines of each cell in the original cell, and delete the edge lines of each cell;

[0044] A new cell that meets the display conditions is drawn based on the coordinate information.

[0045] Optionally, after identifying the first table line displayed on the half-border table from the table segmentation diagram, the method further includes:

[0046] Determine the first table line of the first length as the reference table line;

[0047] Determine the second length of the other first table lines besides the reference table line, and adjust the second length of the other first table lines to be consistent with the first length.

[0048] According to another aspect of the present invention, a table restoration apparatus is also provided, comprising:

[0049] The acquisition unit is used to acquire a table segmentation image corresponding to the input image, wherein the input image contains a half-border table to be restored, and the half-border table is a table with default table lines.

[0050] The identification unit is used to identify the first table line displayed on the half-border table from the table segmentation diagram;

[0051] A determining unit is configured to determine a second table line based on the first table line, wherein the second table line is used to supplement the default table line in the half-border table;

[0052] The restore unit is used to generate the table in the edit state based on the first table line and the second table line.

[0053] According to another aspect of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer-readable storage medium, wherein the computer program is configured to execute the above-described table restoration method at runtime.

[0054] According to another aspect of the present invention, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to execute the above-described table restoration method through the computer program.

[0055] In this embodiment of the invention, a table segmentation image corresponding to an input image is obtained. The input image contains a half-border table to be restored, and the half-border table is a table with default table lines. A first table line displayed on the half-border table is identified from the table segmentation image. A second table line is determined based on the first table line, where the second table line is used to supplement the default table lines in the half-border table. An editable table is generated based on the first and second table lines. This achieves automatic and accurate restoration of tables in an input image using a low-cost method when tables are missing or have incomplete lines. It avoids the low restoration efficiency of traditional methods for tables with missing or incomplete lines, thus improving the efficiency and accuracy of table recognition. Attached Figure Description

[0056] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:

[0057] Figure 1 This is a schematic diagram of a table restoration system in a hardware environment according to an embodiment of the present invention;

[0058] Figure 2 This is a flowchart of an optional table restoration method according to an embodiment of the present invention;

[0059] Figure 3 This is a schematic diagram of a process for restoring a table according to an embodiment of the present invention;

[0060] Figure 4 This is a schematic diagram illustrating another method of restoring a table according to an embodiment of the present invention;

[0061] Figure 5 This is an example schematic diagram illustrating the restoration of text boxes in a table according to an embodiment of the present invention;

[0062] Figure 6 This is a schematic diagram illustrating another method of restoring a table according to an embodiment of the present invention;

[0063] Figure 7 This is an example image of a table according to an embodiment of the present invention;

[0064] Figure 8 This is a schematic diagram illustrating the restoration process of a table image according to an embodiment of the present invention;

[0065] Figure 9 This is a schematic diagram illustrating another method of restoring a table image according to an embodiment of the present invention;

[0066] Figure 10This is a schematic diagram illustrating another method of restoring a table image according to an embodiment of the present invention;

[0067] Figure 11 This is a schematic diagram of a table in an edited state obtained after restoring the table according to an embodiment of the present invention;

[0068] Figure 12 This is a schematic diagram illustrating another method of restoring a table image according to an embodiment of the present invention;

[0069] Figure 13 This is a schematic diagram illustrating another method of restoring a table image according to an embodiment of the present invention;

[0070] Figure 14 This is a schematic diagram illustrating another method of restoring a table image according to an embodiment of the present invention;

[0071] Figure 15 This is a schematic diagram illustrating another method of restoring a table image according to an embodiment of the present invention;

[0072] Figure 16 This is a schematic diagram of a table in an edited state obtained after restoring the table according to an embodiment of the present invention;

[0073] Figure 17 This is a schematic diagram of an optional table restoration device according to an embodiment of the present invention;

[0074] Figure 18 This is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present invention. Detailed Implementation

[0075] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0076] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0077] It should be noted that the terms "horizontal direction" and "lateral direction" in the specification, claims, and accompanying drawings of this invention refer to directions parallel to the top and bottom boundaries of a paper or electronic document page. This is understood to be the direction in which a user normally browses the document. Corresponding to "horizontal direction," the terms "vertical direction" and "longitudinal direction" in this invention refer to directions parallel to the left and right boundaries of a paper or electronic document page. It is understood that in this invention, "vertical direction" is perpendicular to "horizontal direction."

[0078] According to one aspect of the present invention, a table restoration method is provided. Optionally, as an optional implementation, the above-described table restoration method may be applied to, but is not limited to, [examples of other methods]. Figure 1 The table restoration system is shown in the hardware environment. This table restoration system may include, but is not limited to, terminal device 102, network 104, server 106, and database 108. The terminal device 102 runs a target client (e.g., ...). Figure 1 As shown, the target client can be an OCR recognition client used to restore image files to an editable table file. The terminal device 102 includes a human-computer interaction screen, a processor, and a memory. The human-computer interaction screen displays the operating interface of the OCR recognition client and provides a human-computer interaction interface to receive input images uploaded by the user for recognition. The processor generates interaction instructions in response to the aforementioned human-computer interaction operations and sends these instructions to the server 106. The memory stores relevant attribute data, such as OCR recognition parameter data, recognition algorithm data, and intermediate data during the recognition process.

[0079] The specific process is as follows: For example, in step S102, the client running on terminal device 102 obtains the input image to be recognized, where the input image file includes the table image information to be restored; in step S104, terminal device 102 sends the image to be recognized to server 106 via network 104. Server 106 executes steps S106-S114: In step S106, it obtains the table segmentation image corresponding to the input image; in step S108, it identifies the first table line displayed on the half-border table from the table segmentation image; in step S110, it determines the second table line based on the first table line, where the second table line is used to supplement the default table lines in the half-border table; in step S112, it generates an editable table based on the first and second table lines. Then, as in step S114, server 106 sends the editable table to terminal device 102 via network 104; finally, as in step S116, the editable table is displayed on terminal device 102.

[0080] As another optional implementation, when the terminal device 102 has powerful computing capabilities, the above steps S106-S112 can also be performed by the terminal device 102. This is just an example, and no limitation is made in this embodiment.

[0081] Optionally, in this embodiment, the terminal device can be a terminal device configured with a target client, which may include, but is not limited to, at least one of the following: mobile phone (such as Android phone, iOS phone, etc.), laptop computer, tablet computer, PDA, MID (Mobile Internet Devices), PAD, desktop computer, smart TV, etc. The target client may be a video client, instant messaging client, browser client, educational client, etc. The network may include, but is not limited to, wired network and wireless network, wherein the wired network includes: local area network, metropolitan area network and wide area network, and the wireless network includes: Bluetooth, WIFI and other networks that enable wireless communication. The server may be a single server, a server cluster composed of multiple servers, or a cloud server. The above is only an example, and no limitation is made in this embodiment.

[0082] As an optional implementation method, such as Figure 2 As shown, the methods for restoring the above table include:

[0083] S202, obtain the table segmentation image corresponding to the input image, wherein the input image contains a half-border table to be restored, and the half-border table is a table with default table lines.

[0084] S204, Identify the first table line displayed on the half-border table from the table segmentation diagram;

[0085] S206, determine a second table line based on the first table line, wherein the second table line is used to supplement the default table line in the half-border table;

[0086] S208, Generate a table in edit mode based on the first table line and the second table line.

[0087] It is understood that the input image mentioned above can be an image to be recognized received by a client, which includes a table image that needs to be recognized and restored. After performing image segmentation processing on the table image in the image to be recognized, the table segmentation map is obtained. The image segmentation method can be threshold segmentation, region segmentation, edge segmentation, or histogram method. In an optional approach, a neural network model can be used to perform recognition along with the image to obtain the location information of the table lines. In this embodiment, the method of image segmentation processing on the image to be recognized is not limited.

[0088] At the same time, it is important to understand that after performing image segmentation on the input image, further binarization is required to obtain a binary image where the grayscale value of all pixels is set to 0 or 1. For example... Figure 3 Figure (b) in the diagram is a schematic of a binary image, where the text and blank areas are displayed in pure black, and only the table lines, which are displayed in white, are retained. By performing image segmentation and binarization, the amount of image data is reduced, and the outline and lines of the target image are highlighted, thereby improving the efficiency of subsequent table reconstruction operations.

[0089] Further explanation is needed regarding the aforementioned half-bordered table. Tables can be categorized into three types based on the number of lines: unlimited lines, half-bordered tables, and full-bordered tables. Unlimited lines are tables with no lines whatsoever; half-bordered tables lack some lines, insufficient to form a fully enclosed structure, for example, a table containing only two horizontal lines; while full-bordered tables have clearly defined horizontal and vertical lines, with each cell having four complete sides. During the restoration process, all three types of tables must be saved as full-bordered tables; otherwise, the computer will be unable to store the table's line information. In this embodiment, the half-bordered table refers to a table with default table lines, i.e., a table composed of fewer than four sides of table lines. For example, it could refer to a table containing only horizontal table lines or only incomplete horizontal table lines; or it could refer to a table containing only vertical table lines or only incomplete vertical table lines. Through the above implementation method, the aforementioned half-bordered table is restored to a full-bordered table that includes both horizontal and vertical table lines. Figure 3 Figure (a) is an example of a half-bordered table, which has only some horizontal table lines but no vertical table lines, and cannot form a fully enclosed structure.

[0090] In this embodiment, the first table line and the second table line can be either a horizontal table line or a vertical table line. For example, if the first table line is a horizontal table line, the second table line is a vertical table line; if the first table line is a vertical table line, the second table line is a horizontal table line.

[0091] Specifically, the first table line and the second table line can be determined by the existing table lines of the identified half-border table. In an alternative approach, if the identified half-border table only contains horizontal table lines, then the first table line is a horizontal table line, and the second table line in the vertical direction can be determined based on the first horizontal table line.

[0092] Furthermore, after determining the first and second table lines, these lines can be drawn as cells and then entered into the client in cell format. In the client, the cells in the entered table file can be further edited, including but not limited to editing by deleting or moving table lines, entering text content into the cells, or editing the text content in already identified cells. It is understood that the editable table file can be a half-border table identical to the table in the input image, or a full-border table determined based on the input image.

[0093] It is understood that after supplementing the default second table line, the table can be further processed to obtain an editable table, including but not limited to rule-based algorithms and graph neural network algorithms. This embodiment does not limit the algorithm used to perform the final restoration operation. Further, after determining the first and second table lines, they can be drawn as cells and then entered into the client in cell form. In the client, the cells in the entered table file can be further edited, including but not limited to editing by deleting or moving table lines, filling in text content in the cells, or editing the text content in already identified cells. It is understood that the editable table file can be a half-border table identical to the table in the input image, or a full-border table determined based on the input image. The editable state refers to the ability to edit the table, such as entering and modifying text content, inserting images, and adding attachments.

[0094] Combination Figure 3The diagram shown illustrates the method for creating a table-based image segmentation diagram corresponding to the input image. For example... Figure 3 Figure (a) shows an input image to be recognized received by the client. The image includes a table with only horizontal lines. After performing image segmentation on the input image, the result is as follows: Figure 3 The table segmentation diagram shown in Figure (b) is as follows. Figure 3 As shown in Figure (b), the text information in the original table has been hidden, and only the horizontal table lines from the original input image are retained. Meanwhile, due to... Figure 3 Image (b) is obtained from the original input image through image segmentation. However, due to the angle of the original input image, the table lines are distorted. Therefore, the horizontal table lines in the segmented image, as indicated by the arrow, also exhibit line distortion. By further processing the above segmented image and filling the table with the text information from the original input image, the following can be obtained: Figure 3 The restored table shown in Figure (c) is as follows: Figure 3 As shown in Figure (c), through the above steps S204 to S206, the distorted horizontal table lines are restored to horizontal table lines, and appropriate vertical table lines are added at the same time.

[0095] In this embodiment of the invention, a table segmentation image corresponding to an input image is obtained, wherein the input image contains a half-border table to be restored, and the half-border table is a table with default table lines; a first table line displayed on the half-border table is identified from the table segmentation image; a second table line is determined based on the first table line, wherein the second table line is used to supplement the default table lines in the half-border table; and an editable table is generated based on the first and second table lines. This achieves automatic and accurate restoration of the table in the input image using a low-cost method when the table has missing or incomplete lines, avoiding the problem of low restoration efficiency of tables with missing or incomplete lines using traditional methods, and achieving the technical effect of improving table recognition efficiency and accuracy.

[0096] As an optional implementation, determining the second table line based on the first table line includes:

[0097] S1, Supplement the detection lines between the two adjacent first table lines, wherein the detection lines will form a closed border with the two adjacent first table lines, and each detection line is assigned a number.

[0098] S2, determine the second table line from the probe line;

[0099] The following is Figure 4 Two optional implementations of the above method are described in detail. For example... Figure 4 As shown, Figure 4Figure (b) in the image is a table segmentation diagram of a table with half borders, as shown below. Figure 4 Figures (a) and (c) in the figure are shown as follows Figure 4 Figure (b) is a magnified view of a portion of the image after the addition of the second table line.

[0100] In one alternative approach, such as Figure 4 In Figure (a), four first table lines are shown. Probe lines can be added between adjacent first table lines, such as between the first and second lines, between the second and third lines, and between the third and fourth lines. As shown in the figure, eight probe lines are added between each pair of adjacent first table lines, for a total of 24 probe lines, to form a closed border between adjacent first table lines. The second table lines are then determined from these 24 added probe lines.

[0101] In another alternative approach, as shown in figure (c), four first table lines are displayed. In this approach, probe lines are added directly between the first and fourth lines that are furthest apart, resulting in a total of seven probe lines. These seven probe lines form a closed border between adjacent first table lines. Further, second table lines are determined from these seven added probe lines.

[0102] In another alternative approach, if the first table line already includes the outer border table line, a probe line can be added between the two adjacent endpoints of the outer border line to form a closed border between two adjacent first table lines, and then the second table line can be determined from the probe lines determined based on the outer border line.

[0103] This implementation method involves supplementing detection lines between two adjacent first table lines. These detection lines form closed borders with the two adjacent first table lines. Each detection line is assigned a number, and a second table line is determined from these detection lines. This achieves the effect of supplementing detection lines based on existing table lines and further determining suitable second table lines from the supplemented detection lines. Consequently, the table with completed lines obtained in the initial stage better matches the display effect of the table in the input image, thereby improving the accuracy of table restoration.

[0104] In this context, "adjacent" refers to the closest table line in terms of distance, or the farthest table line in terms of distance, or a table line adjacent to the outer border. Detector lines are used to draw multiple line segments (i.e., detector lines) intersecting the first table line at equal or unequal intervals, based on the line direction of the first table line. These multiple line segments are arranged in parallel. In an optional embodiment of the invention, detector lines are drawn at equal intervals of 7 pixels each on the first table line. "Number" refers to a marker used to identify the detector lines. The initial number of each detector line can be the same, for example, all can be 1; the initial number of each detector line can also increase by 1 sequentially in ascending order along the horizontal or vertical direction, for example, the initial number of the first detector line is 1, the initial number of the second detector line is 2, the initial number of the third detector line is 3, and so on.

[0105] As an optional implementation, the above-mentioned supplementary detection line between two adjacent first table lines includes:

[0106] S1, obtain the reference slope from the two adjacent first table lines to supplement the default table line;

[0107] S2, draw a probe line between two adjacent first table lines according to the reference slope.

[0108] Understandably, the above methods for obtaining the reference slope can specifically be: calculating the slope of a certain segment of the first table line and using that slope as the first slope; calculating the slope of the entire first table line and using that slope as the first slope; or dividing the first table line into multiple segments, calculating the slope of each segment separately, taking the average of the various slopes, and using that average as the first slope.

[0109] Taking the calculation of the slope of the complete first table line as an example, the specific calculation method is as follows: obtain the coordinate values ​​(X1, Y1) of the starting point of the first table line and the coordinate values ​​(X2, Y2) of the ending point of the first table line. Then, use the calculation formula |Y2-Y1| / |X2-X1| to obtain the first slope.

[0110] Furthermore, after obtaining the first slope using the above method, a reference slope associated with the first slope is determined. It is important to understand that the reference slope is used to determine the slope of the probe line that is perpendicular to the first table line and lies between the current first table line and the next first table line. Therefore, assuming the first slope value obtained using the above method is k1, then the reference slope corresponding to the first slope is... This allows us to determine the reference slope k2 of the probe line associated with the current first table line.

[0111] In another alternative approach, the aforementioned first slope can also be calculated by obtaining the coordinates of the starting and ending points of the first table line, using the coordinate information of the starting and ending points to calculate the slope of the straight line between the two points, and using this slope as the first slope of the first table line. It is understood that after obtaining the reference slope using the above method, probe lines can be drawn between adjacent first table lines at equal intervals. In another embodiment, after obtaining the reference slope, probe lines can be drawn according to actual needs. For example, a fixed number of probe lines can be drawn between adjacent first table lines according to actual needs, or probe lines can be drawn between adjacent first table lines at non-equal intervals. The specific method of drawing the probe lines is not limited here. The following uses... Figure 4 , Figure 5 The above implementation methods will be described in detail. For example... Figure 4 As shown, Figure 4 Figure (b) in the image is a table segmentation diagram of a table with half borders, as shown below. Figure 4 Figure (a) in the middle is shown as Figure 4 Figure (b) is a magnified view of the area after adding the probe lines. Figure 4 Taking the first table line in Figure (a) as an example, the first table line is first divided into two segments (divided by the inflection point position), the slope of each segment is obtained, and the average value of the two segments is calculated. The formula is (slope of the first segment + slope of the second segment) / 2. The calculation result is used as the first slope.

[0112] Understandably, due to Figure 4 Figure (a) is a table segmentation diagram, so each point here can be a pixel on the first table line;

[0113] Once the first slope corresponding to the first table line mentioned above is determined, a reference slope value is determined based on the negative reciprocal of the first slope, which is the slope value of the probe line associated with the first table line of the current table.

[0114] Next, starting from the leftmost coordinate point of the first table line, probe lines are drawn at equal intervals between the first and second table lines based on the reference slope value. One probe line is drawn at equal intervals, thus obtaining all probe lines between the first and second table lines. Following this method, probe lines corresponding to the second table line are drawn, resulting in... Figure 4 The table segmentation diagram after the supplementary probe line shown in Figure (a) is shown in the figure.

[0115] Optionally, if Figure 4The table segmentation image is a 768 resolution image. With the first table line width being 3 pixels, the interval between the aforementioned detection lines can be set to 7 pixels. It can be understood that the relationship between the line width and the detection line interval length can be set according to actual needs. Figure 4 The relationship between line width and probe line spacing shown in Figure (a) is merely an example and does not impose any limitations on the above methods of this scheme.

[0116] In another alternative approach, once all the probe lines corresponding to each first table line have been determined, the probe lines may not be drawn on the table segmentation diagram. Instead, the candidate segments may be stored as pixel value groups in the pixel array of each first table line to facilitate subsequent numerical calculations.

[0117] In this embodiment of the invention, by obtaining the reference slope for supplementing the default table line from two adjacent first table lines, and drawing a probe line between the two adjacent first table lines according to the reference slope, the probe line is automatically supplemented, thus avoiding the method of manually creating a new table and achieving the technical effect of improving the table restoration efficiency.

[0118] As an optional implementation, determining the second table line from the detection line includes:

[0119] S1, determines the text box containing the text content in the half-border table;

[0120] S2, obtain candidate table lines in the probe line that do not intersect with the text box;

[0121] S3, select at least one from the candidate table lines as the second table line.

[0122] It is understandable that the above text box is a pixel-level virtual border circumscribed to the text content, such as... Figure 5 As shown, when only the text "Locate Conditions" is displayed in the input image, the text box corresponding to the "Locate Conditions" text content is as follows: Figure 5 The border shown in the right image.

[0123] like Figure 6 As shown in Figure (a), in Figure 6 Figure (a) shows the text boxes between the probe lines and the table lines. As shown, the first probe line 601 intersects with the text box 602, therefore the first probe line 601 will not be identified as a candidate table line. Similarly, each probe line is checked for intersection with a text box to ultimately determine the candidate table line. Figure 6 The retained probe lines shown in Figure (b) are candidate table lines.

[0124] After identifying the candidate table lines, at least one is selected as the second table line. Alternatively, only the probe lines intersecting the start and end points of the first table line can be identified as candidate table lines. This allows a table with full borders to be formed by combining the supplementary candidate table lines with the original first table line, which can then be saved as an editable file for storage and editing on a computer.

[0125] In this embodiment, by determining the text box containing the text content in the half-border table, and then obtaining candidate table lines that do not intersect with the text box from the probe lines, at least one of the candidate table lines is selected as the second table line, thereby realizing the automatic selection of the second table line, avoiding manual table reconstruction, and improving the efficiency of table restoration.

[0126] As an optional implementation, the candidate table lines that do not intersect with the text box in the above-mentioned detection lines include:

[0127] S1, sequentially obtain the intersection state between each probe line and each edge of the text box;

[0128] S2, if the probe line intersects with at least one edge of the text box, delete the probe line;

[0129] S3, retain the probe line if it does not intersect with any of the edges of the text box;

[0130] S4, the retained probe lines are identified as candidate table lines.

[0131] Specifically, the method for obtaining candidate table lines that do not intersect with the text box from the aforementioned probe lines can be as follows: after determining the edge vectors corresponding to the probe lines and the text box, determine whether the probe lines intersect with the text box based on the cross product of the edge vectors of the probe lines and the text box. In an optional embodiment, a cross-test method can be used for judgment, that is, after giving two specific vectors, the result of the cross product and the positional relationship between the two vectors are combined to determine whether the two line segments represented by the two vectors intersect.

[0132] The following combination Figure 6 The above methods will be explained, such as Figure 6 As shown, in Figure 6Figure (a) shows text boxes interspersed between probe lines and table lines. Taking the first probe line 601 and the first text box 602 (indicated by the arrow) as an example, a first vector group is determined based on the position information of the start and end pixels of the first probe line 601, and a second vector group is determined based on the position information of the start and end pixels of the top edge of the first text box 602. Based on the cross product of the first and second vector groups, it can be determined that the first probe line 601 intersects with the top edge of the first text box 602, and thus the probe line is deleted. Following the above method, each probe line is traversed. If it is determined that the table border line segment intersects with the text box line segment, the corresponding probe line is deleted; if it is determined that the probe line does not intersect with the text box line segment, the probe line is retained and used as a candidate table line. This leads to the following... Figure 6 The table segmentation diagram shown in Figure (b) only retains probe lines that do not intersect with any text boxes. It is understandable that the algorithm described above, which iterates through the text boxes to sequentially determine whether each probe line intersects with a text box, can have its computational complexity reduced by introducing a pruning algorithm, thereby improving its efficiency. No specific pruning algorithm is specified here.

[0133] The method for determining the intersection between probe lines and text boxes can be performed either by deleting or retaining the probe line immediately after the intersection check, or by checking the intersection between each probe line and all text boxes before deleting or retaining each probe line. The specific execution order is not restricted by this method.

[0134] In this embodiment, the intersection status between each probe line and each edge of the text box is obtained sequentially; if the probe line intersects with at least one edge of the text box, the probe line is deleted; if the probe line does not intersect with any edge of the text box, the probe line is retained; the retained probe lines are identified as candidate table lines, thus avoiding the addition of unnecessary probe lines intersecting with the text during the half-border restoration process. This method reduces the cost of table restoration and achieves the technical effect of improving the accuracy of table restoration.

[0135] In one alternative approach, selecting at least one candidate table line as the second table line includes:

[0136] S1, determine the number of each candidate table line configuration;

[0137] S2, identify multiple candidate table lines with consecutive numbers as a group of table line segments;

[0138] S3, determine a candidate table line from each group of table line segments as the second table line.

[0139] Combination Figure 6 The above plan will be explained. For example... Figure 6 As shown in Figure (a), there are a total of 8 probe lines between the first and second table lines, numbered from left to right, for example, 1-8. Similarly, the probe lines between the second and third table lines, and between the third and fourth table lines, can be numbered. Figure 6 As shown in Figure (b), after deleting the probe lines intersecting with the text boxes to obtain candidate table lines, for the candidate table line segments between the first and second first table line segments, the three middle candidate table line segments, namely candidate table lines 4, 5, and 6, can be divided into the first group of table line segments, and the rightmost candidate table line segment, namely table line 8, can be divided into the second group of table line segments; for the candidate table line segments between the second and third first table line segments, the two middle consecutive candidate table line segments, namely candidate table lines 5 and 6, can be divided into the third group of table line segments; for the candidate table line segments between the third and fourth first table line segments, the two middle consecutive candidate table line segments, namely candidate table lines 4 and 5, can be divided into the fourth group of table line segments.

[0140] Furthermore, in this embodiment, after determining multiple sets of table line segments, a candidate table line is determined from each set of table line segments as the second table line, thereby automatically determining the supplementary second table line and improving the efficiency of table restoration.

[0141] The numbering of candidate table lines can follow the initial numbering of the corresponding probe lines. Numbering continuity means that candidate table lines belonging to the same two first table lines have adjacent numbers. For example, if a candidate table line is numbered 2, then the numbers consecutive to that candidate table line are 1 and 3, and so on. Further details are omitted.

[0142] Furthermore, the above-mentioned determination of multiple consecutively numbered candidate table lines into a group of table line segments includes: controlling the first pointer and the second pointer to move at a first speed in the target direction respectively; when the first pointer and the second pointer detect the first candidate table line that does not intersect with the text box, controlling the second pointer to stop moving, and controlling the first pointer to move at a second speed; when the first pointer detects a reference table line, determining the first candidate table line that does not intersect with the text box and the reference table line into a group of table line segments.

[0143] In this system, the first and second pointers each form a line segment. The line segment extends in the same direction as the second table line, and moves between every two adjacent first table lines. The target direction is consistent with the direction of the first table line. For example, if the first table line is horizontal, the target direction is also horizontal; if the first table line is vertical, the target direction is also vertical. The first speed can be a user-defined speed or a system default speed, such as 3 pixels / second or 6 pixels / second. It should be noted that the second speed is greater than or equal to the first speed.

[0144] by Figure 6 The above method will be explained using an example. Figure 6 As shown in Figure (b), starting from the initial positions of the first and second table lines, a first pointer and a second pointer are positioned between the first and second table lines. The first and second pointers move between the first and second table lines. The initial movement speed of the first and second pointers is a first speed, meaning their initial speeds are the same. Based on the cross product of their own pointers with the text boxes, the first and second pointers determine whether they intersect with the text boxes between the first and second table lines. When the first and second pointers detect the first candidate table line between the first and second table lines that does not intersect with the text box, the second pointer is controlled to stop at this first candidate table line, thus marking the first candidate table line that does not intersect with the text box, and the first pointer is controlled to move at a second speed.

[0145] When the first pointer detects a reference table line, the first candidate table line that does not intersect with the text box and the reference table line are identified as a group of table line segments. The reference table line is the last candidate table line that does not intersect with the text box, consecutive in number from the first candidate table line that does not intersect with the text box. This last candidate table line that does not intersect with the text box is obtained as follows: after the first pointer passes the first candidate table line that does not intersect with the text box, if it detects a candidate table line that intersects with the text box again, the previous candidate table line of that second intersecting candidate table line is taken as the reference table line. The previous line refers to the candidate table line that the first pointer passed before "detecting the candidate table line that intersects with the text box again".

[0146] After a set of table line segments is identified, the first and second pointers take the positions where candidate table lines intersect with the text box as their respective starting positions and continue to repeat the deletion detection steps to identify a new set of table line segments until the first and second pointers move to the end positions of the first and second table lines, at which point the detection ends.

[0147] As an optional approach, the relevant information of the aforementioned candidate table lines and the first table line is stored in the background as an array.

[0148] Continue with Figure 6 The above method will be explained using an example. Figure 6 As shown in Figure (b), firstly, the first and second pointers are controlled to move between the first and second table lines from their starting positions. When the first and second pointers reach the candidate table line with index "4", the second pointer stops at the candidate table line with index "4". Then, the first pointer traverses the subsequent table lines sequentially. When it reaches the candidate table line with index "7", since the candidate table line with index "7" is the first candidate table line that intersects with the text box after the candidate table line with index "4" (the first candidate table line that does not intersect with the text box), the candidate table line with index "6" is determined as the reference table line. The candidate table lines with index "4" to index "6" are defined as a group of table line segments.

[0149] Then, repeat the above process. Move the second pointer to the candidate table line with the number "7". From the position of the candidate table line with the number "7", the first and second pointers move at the first speed. When the first candidate table line that does not intersect with the text box is detected, that is, the candidate table line with the number "8", the second pointer stops moving and stays at the position of the candidate table line with the number "8". The first pointer continues to move at the second speed until the first pointer moves to the end position of the first and second table lines. No new candidate table lines that do not intersect with the text box are detected. Therefore, the candidate table line with the number "8" is identified as a group of table line segments.

[0150] Furthermore, it can be determined that table segments "5" and "6" in the candidate table segments between the second and third first table lines form a group of line segments. It can also be determined that table segments "4" and "5" in the candidate table segments between the third and fourth first table lines form a group of line segments.

[0151] The above process of determining a candidate table line as the second table line from each group of table line segments includes: traversing the table line segments; determining the weight of the candidate table line from each table line segment; and selecting the candidate table line with the larger weight as the second table line.

[0152] Continue with Figure 6 Let's take an example to illustrate the above method. Specifically, the second table line to be retained can be determined through voting. For example... Figure 6 As shown in Figure (b), for the candidate table line segment between the first table line and the second table line, there are four candidate table line segments with serial numbers "4", "5", "6", and "8". Therefore, after the first round of voting, each of the serial numbers "4", "5", "6", and "8" gets one vote.

[0153] For the candidate table segments between the second and third table segments, there are two candidate table segments with serial numbers "5" and "6". Then, cast a vote for each of the table segments with serial numbers "5" and "6".

[0154] For the candidate table segments between the third and fourth table segments, there are two candidate table segments with serial numbers "4" and "5". Then, cast a vote for each of the table segments with serial numbers "4" and "5".

[0155] At this point, candidate table segment "5" received the most votes, and since there is a "5" table segment between each row, they can form a continuous vertical table segment. Therefore, the vertical table segment formed by connecting the three candidate table segments "5" is confirmed as the second table line, as shown below. Figure 6 As shown in Figure (c).

[0156] Understandably, when there are multiple lines with the same number of votes that can be connected vertically to form a second line that runs through the first and fourth table lines, one of them can be selected as the second table line as needed. For example, the leftmost line in a group of adjacent vertical table lines of the same length can be selected as the second table line, or the central line in a group of adjacent vertical table lines of the same length can be selected as the second table line. Alternatively, the same group of vertical table lines can be retained and subsequently deleted as needed.

[0157] Through the above embodiments of this application, after employing pointer allocation and vote counting methods, the vertical table line with the highest number of votes is determined, thereby completing the supplementation of the vertical table line and achieving automatic alignment of table line segments between rows, resulting in a full-border table. In other words, according to the above embodiments of this application, accurate table reconstruction is achieved with minimal computational cost, realizing the technical effect of improving table reconstruction efficiency and accuracy.

[0158] In one selected implementation, after determining the second table line based on the first table line, the method further includes:

[0159] S1, obtain the display pattern of the first table line and the second table line;

[0160] S2, if the display form of the first table line and the second table line is not a table line that meets the display conditions, the image carrying the first table line and the second table line is input into the calculation module to obtain the calculation result;

[0161] S3, Based on the calculation results, reconstruct the first and second table lines that meet the display conditions.

[0162] It is necessary to understand that, such as Figure 6 As shown in Figure (c), the table file obtained in the above manner only adds a second table line to the first table line. However, the table formed by the first and second table lines is still not composed of horizontal or vertical lines; that is, the first table line is neither horizontal nor vertical, and the second table line is neither vertical nor horizontal. Figure 6 (c) shows that the four first table lines are distorted, therefore the second table lines corresponding to the first table lines are also deviated from the vertical direction. That is to say, the first and second table lines determined by the above method are table lines corresponding to their positional relationship with each other, but they do not necessarily meet the condition of matching the horizontal or vertical direction. Therefore, it is necessary to redraw the first and second table lines that meet the display conditions based on the original relationship between the first and second table lines.

[0163] Furthermore, after identification Figure 6 Following Figure (c), the display patterns of the first and second table lines are further obtained. It is understood that the aforementioned display patterns indicate the degree of alignment of the table lines with the horizontal or vertical direction.

[0164] If it is determined that the first and second table lines do not meet the above display conditions, the image containing the first and second table lines is input into the calculation module to obtain table lines that match the horizontal or vertical direction. It can be understood that the display conditions of the lines here indicate the absence of deviation between the lines and the horizontal or vertical direction.

[0165] Optionally, the above-mentioned image carrying the first and second table lines is input into the calculation module to obtain the calculation result. Based on the calculation result, the reconstruction of the first and second table lines that meet the display conditions includes:

[0166] S1, In the calculation module, based on the connected component between the first table line and the second table line, calculate the coordinate information of the original cell formed by the first table line and the second table line. The coordinate information includes: the starting coordinates of the original cell, the centroid coordinates of the original cell, and the ending coordinates of the original cell.

[0167] S2, determine the edge lines of each cell in the original cell based on the coordinate information, and delete the edge lines of each cell;

[0168] S3, draws a new cell that meets the display conditions based on coordinate information.

[0169] As an alternative approach, a deep learning segmentation model can be used to segment the row and column lines of a curved table, and the intersection of the row and column lines can be used as potential cell vertices. Cells can be searched according to a preset search method to complete the cell detection of the table. The distance between all the row and column lines that can form cells can be counted, and the curved table can be corrected based on the relative distance. Finally, the text can be mapped to the corrected table using relative positions to complete the table reconstruction.

[0170] The following describes a specific implementation method of the above approach.

[0171] S1, as Figure 12 As shown, a deep learning model is used to segment the row lines and column lines of the curved table.

[0172] S2, as Figure 13 As shown, the curved table lines obtained in step S1 are denoised, and shorter line segments are removed. The pixels of each table line are numbered using connected components.

[0173] S3, as Figure 14 As shown, traverse the row and column graphs to find pixels that belong to both row and column lines as potential cell vertices. Number all potential vertices in the format of (row connectivity index, column connectivity index).

[0174] S4, within the set of cell vertices in S3, searches for all possible cells according to a pre-defined search strategy to obtain the table structure. The search strategy is as follows: search in the order of top left, top right, bottom right, and bottom left. After the search, the found cells are as follows: Figure 15 As shown:

[0175] S5 matches the detected text with the cells. It calculates whether the center of the text falls within the area of ​​a given cell to match the text with the cell.

[0176] S6 corrects the curved table lines and adjusts the text position, combining the two to obtain the final result, such as... Figure 16As shown.

[0177] In this embodiment, the coordinate information of the original cell formed by the first and second table lines is calculated in the calculation module based on the connected component between the first and second table lines. The coordinate information includes the starting coordinates, centroid coordinates, and ending coordinates of the original cell. The cell edges of the original cell are determined based on the coordinate information, and the cell edges are deleted. A new cell that meets the display conditions is drawn based on the coordinate information. This achieves the reconstruction of the table with distorted table lines, avoiding the need to manually create a new table and fill it with text content, thereby improving the efficiency of table reconstruction.

[0178] In an optional implementation, after identifying the first table line displayed on the half-border table from the table segmentation diagram, the method further includes:

[0179] S1, determine the first table line of the first length as the reference table line;

[0180] S2, determine the second length of other first table lines besides the reference table lines, and adjust the second length of the other first table lines to be consistent with the first length.

[0181] Understandably, according to the above method, after obtaining the table segmentation map, if there are first table lines of varying lengths in the weak table segmentation map, the longest (i.e., the longest) first table line can be used as a reference to fill in the other first table lines to the same length.

[0182] In addition to this method, the first length can be specified as the length of the first table line with the largest number of lengths, and the second length of the other first table lines can be adjusted to the first length. Adjustment can be understood as lengthening or shortening the length of the first table line.

[0183] In this embodiment, the longest first table line is determined as a reference table line, and then the lengths of the other first table lines are supplemented according to the length of the reference table line to obtain the updated first table lines, thereby achieving the technical effect of restoring an incomplete table image.

[0184] In an optional embodiment, the above text content is filled into the position of the above text box to restore the table in the edit state. After filling the above text content into the above text box to obtain the restored table, the method further includes: hiding the table segments that are still in the display state among the above multiple candidate table segments.

[0185] Understandably, after supplementing the first and second table lines in the table segmentation diagram using the above method and filling them with text content, editing options can be provided to allow users to hide or edit the supplemented table lines according to their actual needs.

[0186] This embodiment provides editing operations for table lines after table filling is completed, thereby enabling free selection and secondary editing of the filled table lines to more accurately restore the table and improve the accuracy of table restoration.

[0187] The following combination Figures 7 to 11 The specific embodiments shown and Figure 2 The flowchart shown illustrates the specific implementation of this application.

[0188] like Figure 2 As shown, execute step S202, and then execute step S204;

[0189] like Figure 7 As shown, the input image displays a half-bordered table excluding vertical table lines. After image segmentation and binarization of the input image, the result is as follows: Figure 8 The binarized image shown. In, as... Figure 8 The image shown illustrates the three horizontal table lines already included in the original input image, and the equally spaced vertical candidate table line segments corresponding to the slopes of the three horizontal table lines. Figure 8 Taking the 768 resolution image as an example, the three horizontal table lines are 3 pixels wide, and the spacing between the vertical lines is set to a fixed value of 7 pixels. Meanwhile, Figure 8 The text also shows the corresponding... Figure 7 The text content in the text box consists of several text box segments.

[0190] Then proceed to step S206;

[0191] like Figure 9 As shown, by constructing two vectors from the two endpoints of each vertical candidate table line segment and the two endpoints of each side of the text box, and using methods such as cross product determination, it can be determined whether the line segment intersects the text box, and vertical candidate table line segments that intersect the text box can be deleted, resulting in the following: Figure 9 The binary image shown.

[0192] Then proceed as in step S208;

[0193] Understandably, fast and slow pointers (i.e., the first and second pointers mentioned above) can be used here to find consecutive candidate table segments. Simultaneously, the columns containing these retained vertical lines can be counted; for each additional segment, a vote is cast for its column. Each consecutive segment will have a column with the highest number of votes, and the candidate table segments for that column are retained. At this point, the vertical table segments added between rows are automatically aligned to achieve the desired result. Figure 10 The binary image shown.

[0194] Finally, fill the text content into the text box to restore the table to edit mode.

[0195] After adding the vertical table lines mentioned above, the result can be obtained using rule-based algorithms or graph neural networks, as shown below. Figure 11 The final restoration result corresponds to, for example: Figure 7 The input image shown is a full-bordered table. Finally, the added vertical table lines can be hidden or shown as needed.

[0196] The above steps involve synchronously adjusting the closure of the virtual animal's eyes based on the adjusted monocular closure feature values. A mesh can be constructed using the obtained anchor object and virtual animal face keypoints, and the keypoint data can be used as texture coordinates for graphics rendering. Then, the offset is calculated using the positions of keypoints on the anchor's face in previous and subsequent frames. Next, the keypoint positions on the pet's face are updated, and the updated keypoint data is used as vertex coordinates for graphics rendering. Finally, a multimedia programming interface, such as the DirectX or OpenGL API, is called to generate the rendered image.

[0197] In this embodiment of the invention, by obtaining a table segmentation image corresponding to the input image, the first table line displayed on the half-border table and the text box containing the text content displayed in the cell of the half-border table are identified from the table segmentation image. Then, from multiple candidate table line segments drawn based on the first table line, line segment fragments that do not intersect with the text box are obtained. Then, using the target table line segment selected from the line segment fragments, the second table line is determined to restore the default table line in the half-border table. Finally, the text content is filled into the position of the text box to restore the table in the edit state. This achieves accurate restoration of the table in the image in the case of missing or incomplete table lines in the input image using a low-cost method, avoiding the problem of unreliable restoration output of missing or incomplete table lines using traditional methods. This achieves the technical effect of improving the accuracy of table recognition, and thus solves the technical problems of low accuracy and low efficiency of table restoration in the existing technology.

[0198] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the present invention is not limited to the described order of actions, because according to the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to the present invention.

[0199] According to another aspect of the present invention, a table restoration apparatus for implementing the above-described table restoration method is also provided. For example... Figure 17 As shown, the device includes:

[0200] The acquisition unit 1202 is used to acquire a table segmentation image corresponding to the input image, wherein the input image contains a half-border table to be restored, and the half-border table is a table with default table lines.

[0201] The recognition unit 1204 is used to identify the first table line displayed on the half-border table from the table segmentation diagram;

[0202] The determining unit 1206 is used to determine a second table line based on the first table line, wherein the second table line is used to supplement the default table line in the half-border table;

[0203] The restore unit 1208 is used to generate a table in the edit state based on the first table line and the second table line.

[0204] As an optional approach, the aforementioned determining unit includes:

[0205] The supplementary module is used to add detection lines between two adjacent first table lines. The detection lines will form a closed border with the two adjacent first table lines, and each detection line is configured with a number.

[0206] The determination module is used to identify the second table line from the probe line.

[0207] As an optional approach, the above supplementary modules also include:

[0208] The first supplementary submodule is used to obtain the reference slope for supplementing the default table line from two adjacent first table lines;

[0209] The second supplementary submodule is used to draw a probe line between two adjacent first table lines according to a reference slope.

[0210] As an optional approach, the above-mentioned determining module may also include:

[0211] The first determination submodule is used to determine the text box containing the text content in the half-border table;

[0212] The second determination submodule is used to obtain candidate table lines that do not intersect with the text box in the probe line;

[0213] The third determination submodule is used to select at least one candidate table line as the second table line.

[0214] As an optional approach, the second determining submodule described above is also used for:

[0215] Sequentially obtain the intersection status between each probe line and each edge of the text box;

[0216] Delete the probe line if it intersects with at least one edge of the text box;

[0217] The probe line is retained if it does not intersect with any of the edges of the text box;

[0218] The retained probe lines were identified as candidate table lines.

[0219] As an optional approach, the aforementioned determining module is also used for:

[0220] Determine the number for each candidate table line configuration;

[0221] Multiple candidate table lines with consecutive numbers are identified as a group of table line segments;

[0222] From each set of table line segments, identify one candidate table line as the second table line.

[0223] As an optional approach, the aforementioned determining module is also used for:

[0224] The first and second pointers are controlled to move at a first speed in the target direction, respectively; when the first and second pointers detect the first candidate table line that does not intersect with the text box, the second pointer is controlled to stop moving, and the first pointer is controlled to move at a second speed; when the first pointer detects a reference table line, the first candidate table line that does not intersect with the text box and the reference table line are identified as a set of table line segments.

[0225] As an optional approach, the aforementioned determining module is also used for:

[0226] Traverse the table line segments; determine the weights of the candidate table lines for each segment, and select the candidate table line with the larger weight as the second table line.

[0227] As an optional measure, the above-mentioned table restoration device further includes:

[0228] The second acquisition unit is used to acquire the display form of the first table line and the second table line;

[0229] The calculation unit is used to input an image carrying the first and second table lines into the calculation module to obtain the calculation result when the display form of the first table line and the second table line is not a table line that meets the display conditions.

[0230] The reconstruction unit is used to reconstruct the first and second table lines that meet the display conditions based on the calculation results.

[0231] As an optional approach, the aforementioned computing unit further includes:

[0232] The calculation module is used to calculate the coordinate information of the original cell formed between the first table line and the second table line based on the connected component between the first table line and the second table line. The coordinate information includes: the starting coordinates of the original cell, the centroid coordinates of the original cell, and the ending coordinates of the original cell.

[0233] The delete module is used to determine the edges of each cell in the original cell based on the coordinate information and delete the edges of each cell.

[0234] The display module is used to draw new cells that meet display conditions based on coordinate information.

[0235] As an optional approach, the aforementioned identification unit is also used for:

[0236] Determine the first table line of the first length as the reference table line;

[0237] Determine the second length of the other first table lines besides the reference table line, and adjust the second length of the other first table lines to be consistent with the first length.

[0238] Optionally, in this embodiment, the implementation of each of the above-mentioned unit modules can be referred to the above-mentioned method embodiments, which will not be repeated here.

[0239] According to another aspect of the present invention, an electronic device for implementing the above-described table restoration method is also provided. This electronic device may be... Figure 1 The terminal device or server shown. This embodiment uses this electronic device as an example for illustration. Figure 18 As shown, the electronic device includes a display 1302, a transmission device 1306, a processor 1304, and a memory 1310. The memory 1310 stores a computer program, and the processor 1304 is configured to execute the steps in the above-described table restoration method embodiment through the computer program.

[0240] Optionally, in this embodiment, the aforementioned electronic device may be located in at least one of a plurality of network devices in a computer network.

[0241] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:

[0242] S1, obtain the table segmentation image corresponding to the input image, wherein the input image contains a half-border table to be restored, and the half-border table is a table with default table lines;

[0243] S2, Identify the first table line displayed on the half-border table from the table segmentation diagram;

[0244] S3, determine the second table line based on the first table line, wherein the second table line is used to supplement the default table line in the half-border table;

[0245] S4, Generate a table in edit mode based on the first table line and the second table line.

[0246] Alternatively, as those skilled in the art will understand, Figure 18 The structure shown is for illustrative purposes only. Electronic devices can also be smartphones (such as Android phones, iOS phones, etc.), tablets, PDAs, mobile internet devices (MIDs), PADs, and other terminal devices. Figure 18 This does not limit the structure of the aforementioned electronic devices. For example, the electronic device may also include components that are more... Figure 18 The more or fewer components shown (such as network interfaces, etc.), or having the same Figure 18 The different configurations shown.

[0247] The memory 1310 can be used to store software programs and modules, such as the program instructions / modules corresponding to the table restoration method and apparatus in this embodiment of the invention. The processor 1304 executes various functional applications and data processing by running the software programs and modules stored in the memory 1310, thereby realizing the aforementioned table restoration method. The memory 1310 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 1310 may further include memory remotely located relative to the processor 1304, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. As an example, such as Figure 18 As shown, the memory 1310 may include, but is not limited to, the acquisition unit 1202, identification unit 1204, determination unit 1206, and restoration unit 1208 in the table restoration device. Furthermore, it may include, but is not limited to, other module units in the table restoration device, which will not be described further in this example.

[0248] Optionally, the transmission device 1306 described above is used to receive or send data via a network. Specific examples of the network described above may include wired networks and wireless networks. In one example, the transmission device 1306 includes a Network Interface Controller (NIC), which can be connected to other network devices and a router via a network cable to communicate with the Internet or a local area network. In another example, the transmission device 1306 is a Radio Frequency (RF) module, used for wireless communication with the Internet.

[0249] In addition, the aforementioned electronic device also includes: a display 1302 for displaying an input image and a table showing the completed reconstruction, wherein the target image displays the face of a virtual animal object; and a connection bus 1308 for connecting the various module components in the aforementioned electronic device.

[0250] In other embodiments, the aforementioned terminal device or server can be a node in a distributed system, wherein the distributed system can be a blockchain system, which is a distributed system formed by connecting multiple nodes through network communication. The nodes can form a peer-to-peer (P2P) network, and any form of computing device, such as a server, terminal, or other electronic device, can become a node in the blockchain system by joining this peer-to-peer network.

[0251] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0252] According to one aspect of this application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to perform the steps of a table restoration method at runtime. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and executes the computer instructions, causing the computer device to perform the aforementioned table restoration method.

[0253] Optionally, in this embodiment, those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0254] If the integrated units in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in the aforementioned computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.

[0255] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0256] In the several embodiments provided in this application, it should be understood that the disclosed client can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection between units or modules, and may be electrical or other forms.

[0257] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0258] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0259] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A form restoration method characterized by, The method is applied to a picture, and the method comprises: performing image segmentation processing and binarization processing on a table image in an input picture to obtain a table segmentation graph, wherein the table segmentation graph is used to highlight image contours and lines; the input picture contains a half-frame table to be restored, and the half-frame table is a table with default table lines missing; identifying first table lines displayed on the half-frame table from the table segmentation graph; acquiring reference slopes for supplementing default table lines from two adjacent first table lines; drawing a detection line between the two adjacent first table lines according to the reference slopes, wherein the detection line forms a closed frame with the two adjacent first table lines; determining a text box of text content in the half-frame table; acquiring candidate table lines in the detection line that are not intersected with the text box; selecting at least one candidate table line as a second table line from the candidate table lines, wherein the second table line is used to supplement default table lines in the half-frame table; generating an edited state of the table according to the first table lines and the second table line.

2. The method of claim 1, wherein, comprise: each detection line is respectively configured with a number.

3. The method of claim 1, wherein, The acquiring of the candidate table lines in the detection line that are not intersected with the text box comprises: sequentially acquiring intersection states between each detection line and each side of the text box; in the case where the detection line intersects with at least one side of the text box, deleting the detection line; in the case where the detection line does not intersect with each side of the text box, retaining the detection line; determining the retained detection line as the candidate table line.

4. The method of claim 1, wherein, The selecting of at least one candidate table line as the second table line from the candidate table lines comprises: determining numbers configured for each candidate table line; determining a plurality of candidate table lines with consecutive numbers as a group of table line segments; determining one candidate table line as the second table line from each group of table line segments.

5. The method of claim 4, wherein, The determining of a plurality of candidate table lines with consecutive numbers as a group of table line segments comprises: controlling a first pointer and a second pointer to move at a first speed in a target direction respectively; in the case where the first pointer and the second pointer detect a first candidate table line that is not intersected with the text box, controlling the second pointer to stop moving, and controlling the first pointer to move at a second speed; in the case where the first pointer detects a reference table line, determining the first candidate table line that is not intersected with the text box and the reference table line as a group of table line segments.

6. The method of claim 4, wherein, The determining of one candidate table line as the second table line from each group of table line segments comprises: traversing the table line segments; determining weights of candidate table lines of the table line segments, and taking a candidate table line with a large weight as the second table line.

7. The method of claim 1, wherein, After selecting at least one candidate table line as the second table line from the candidate table lines, the method further comprises: acquiring display forms of the first table lines and the second table line; In a case where the display forms of the first table line and the second table line do not satisfy the display condition, an image carrying the first table line and the second table line is input into a calculation module to obtain a calculation result; According to the calculation result, the first table line and the second table line satisfying the display condition are reconstructed.

8. The method of claim 7, wherein, The calculation module is configured to calculate coordinate information of a primitive cell formed between the first table line and the second table line according to a connected domain between the first table line and the second table line, wherein the coordinate information includes a start point coordinate of the primitive cell, a barycenter coordinate of the primitive cell, and an end point coordinate of the primitive cell. According to the coordinate information, each cell edge line of the primitive cell is determined and deleted. Based on the coordinate information, a new cell satisfying the display condition is drawn. After the first table line displayed on the half-frame table is identified from the table segmentation image, the method further includes:

9. The method according to any one of claims 1 to 8, characterized in that, A first table line with a first length is determined as a reference table line. A second length of other first table lines except the reference table line is determined and adjusted to be consistent with the first length. The method includes:

10. A table reconstruction apparatus characterized by comprising: An acquisition unit performs image segmentation processing and binarization processing on a table image in an input picture to obtain a table segmentation image, wherein the table segmentation image is used to highlight image contours and lines; the input picture contains a half-frame table to be restored, and the half-frame table is a table with missing table lines; An identification unit identifies a first table line displayed on the half-frame table from the table segmentation image; A determination unit acquires a reference slope for supplementing missing table lines from two adjacent first table lines, draws a detection line between the two adjacent first table lines according to the reference slope, wherein the detection line forms a closed frame with the two adjacent first table lines, determines a text box of text content in the half-frame table, acquires a candidate table line in the detection line that does not intersect with the text box, and selects at least one candidate table line as a second table line, wherein the second table line is used to supplement missing table lines in the half-frame table; A restoration unit generates the table in an editing state according to the first table line and the second table line. The computer-readable storage medium stores a computer program, wherein the computer program is configured to execute the method described in any one of claims 1 to 9 when running.

11. A computer readable storage medium, characterized in that, The memory stores a computer program, and the processor is configured to execute the method described in any one of claims 1 to 9 through the computer program.

12. An electronic device comprising a memory and a processor, characterized in that ​

Citation Information

Patent Citations

  • Extracting method and device for table data without outer frame and storage medium

    CN110598196A