Table character recognition method, device, medium and electronic equipment

By performing frame line recognition, cutting, and scaling on table images, the problem of character adhesion in OCR technology is solved, achieving more accurate text recognition and an improved user experience.

CN116259056BActive Publication Date: 2026-07-24SHANGHAI HONGJI INFORMATION TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHANGHAI HONGJI INFORMATION TECH CO LTD
Filing Date
2023-03-14
Publication Date
2026-07-24

AI Technical Summary

Technical Problem

Existing OCR technology is prone to causing characters to stick together when recognizing characters in compact tables, which affects the accuracy of text information and the user's reading experience.

Method used

The original table image is processed by recognizing the table borders, cutting it into cell images, scaling the cell images to generate a new table image to increase the character spacing, and then performing OCR recognition.

Benefits of technology

It effectively prevents characters from sticking together, improving the accuracy of text information and the user's reading experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116259056B_ABST
    Figure CN116259056B_ABST
Patent Text Reader

Abstract

The application relates to a table character recognition method, which comprises the following steps: performing table frame line recognition on an original table image; cutting the original table image according to the recognized table frame line coordinates, and extracting a first cell image; performing scaling on the first cell image, and obtaining a second cell image; and placing the second cell image back to the original position, and obtaining a new table image. The original table image can be subjected to table frame line recognition, then the region (subgraph) of each table cell is locally reduced by a certain scaling factor to generate a new image of the current page, and the spacing between texts is significantly widened. Then, OCR recognition is performed on the basis of the new image to obtain the recognition result of the new image, so that the adhesion phenomenon of the OCR character recognition is well prevented, the recognized text information is more accurate, the character adhesion does not occur during user reading, the text information disorder is avoided, and the user readability is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of document processing technology, and in particular to a method, apparatus, computer storage medium, and electronic device for recognizing table characters. Background Technology

[0002] In intelligent document understanding scenarios, there are many types of documents, such as orders, long documents, and emails, many of which contain tables. For users to fully understand the document content, they need to accurately comprehend the table structure and the text within the tables.

[0003] Text recognition requires the use of OCR (Optical Character Recognition) technology. However, when the text between cells is very close together, OCR algorithms often recognize two strings as one, resulting in a "sticky" problem in table character recognition. This sticky character problem can cause subsequent information extraction tasks to fail. Consequently, the resulting text information and content often suffer from poor readability due to characters being too close together in two cells, making it difficult for users to read and understand the text, thus leading to a very poor reading experience.

[0004] Therefore, in the face of the above-mentioned problems in character recognition, it is necessary to adopt more optimized methods to avoid character overlap during recognition. Summary of the Invention

[0005] To address the aforementioned problems, this application proposes a method, apparatus, computer storage medium, and electronic device for recognizing table characters.

[0006] This application proposes a method for recognizing table characters, including the following steps:

[0007] Perform table border recognition on the original table image;

[0008] The original table image is cut according to the identified table frame coordinates to extract the first cell image;

[0009] The first cell image is scaled to obtain the second cell image;

[0010] Replace the second cell image in its original position to obtain a new table image.

[0011] As an optional implementation of this application, the step of recognizing table borders on the original table image may include:

[0012] Identify the table regions in the original table image;

[0013] Based on the table area, identify the horizontal and vertical lines of the table area;

[0014] The cells of the table area are determined based on the intersection of the horizontal and vertical lines;

[0015] The coordinates of the table border are determined based on the cells in the table area.

[0016] As an optional implementation of this application, optionally, scaling the first cell image to obtain the second cell image includes:

[0017] Preset scaling ratio k;

[0018] Multiply the scaling ratio k by the size of the first cell image, and then reduce or enlarge the first cell image according to the size of the multiplier to obtain the second cell image.

[0019] As an optional implementation of this application, optionally, the step of returning the second cell image to its original position to obtain a new image table includes:

[0020] Calculate the center of the first cell image and the second cell image respectively;

[0021] Place the second cell image back onto the original table image, and make the centers of the second cell image and the first cell image coincide;

[0022] Delete the first cell image to obtain the new image.

[0023] As an optional implementation of this application, optionally, the step of placing the second cell image back onto the original table image includes:

[0024] The original position of the first cell image is determined based on the coordinates of the table frame lines;

[0025] Place the second cell image back into the original position of the first cell image.

[0026] As an optional implementation of this application, after placing the second cell image back in its original position to obtain a new table image, the method further includes:

[0027] The new table image is subjected to OCR recognition to obtain OCR recognition results; wherein, the OCR recognition results include the text content and text position of each text in the new table image;

[0028] Based on the table area and scaling factor k, the OCR recognition result is adjusted to obtain the recognition result of the original table image.

[0029] As an optional embodiment of this application, the text position may optionally include the coordinates of a first rectangular frame surrounding the text;

[0030] The step of adjusting the OCR recognition result based on the table area and scaling ratio k to obtain the recognition result of the original table image includes:

[0031] Determine whether the coordinates of the first rectangle are within the range of the table frame coordinates;

[0032] If so, multiply the reciprocal of the scaling ratio 1 / k by the size of the first rectangle, and enlarge or shrink the first rectangle according to the size after multiplication to obtain the second rectangle;

[0033] Calculate the coordinates of the second rectangle when the centers of the first and second rectangles coincide;

[0034] The text content and the coordinates of the second rectangle are used as the recognition result of the original table image.

[0035] In another aspect, this application provides a table character recognition device, comprising:

[0036] The table border recognition module is used to recognize table borders in the original table image;

[0037] The table cell cutting module is used to cut the original table image according to the identified table frame coordinates and extract the first cell image.

[0038] An image scaling module is used to scale the first cell image to obtain a second cell image;

[0039] The image reset module is used to put the second cell image back in its original position to obtain a new table image.

[0040] As an alternative implementation of this application, optionally,

[0041] The table border recognition module includes: a first recognition module for recognizing the table area of ​​the original table image; a second recognition module for recognizing the horizontal and vertical lines of the table area based on the table area; a cell determination module for determining the cells of the table area based on the intersection of the horizontal and vertical lines; and a coordinate determination module for determining the coordinates of the table border based on the cells of the table area.

[0042] The image scaling module includes: a configuration module for presetting a scaling ratio k; and a scaling module for multiplying the scaling ratio k by the size of the first cell image, and scaling the first cell image down or up according to the multiplied size to obtain the second cell image.

[0043] The image reset module includes: a calculation module for calculating the center of the first cell image and the second cell image respectively; a reset module for placing the second cell image back onto the original table image and making the center of the second cell image and the first cell image coincide; and a new image acquisition module for deleting the first cell image and obtaining the new image.

[0044] The reset module includes: a first reset module, used to determine the original position of the first cell image based on the coordinates of the table frame line; and a second reset module, used to return the second cell image to the original position of the first cell image.

[0045] The image reset module further includes:

[0046] An OCR recognition module is used to perform OCR recognition on the new table image to obtain OCR recognition results; wherein, the OCR recognition results include the text content and text position of each text in the new table image; the text position includes the coordinates of a first rectangular box surrounding the text;

[0047] The text adjustment module is used to adjust the OCR recognition result according to the table area and the scaling ratio k to obtain the recognition result of the original table image, including:

[0048] Determine whether the coordinates of the first rectangle are within the range of the table frame coordinates;

[0049] If so, multiply the reciprocal of the scaling ratio 1 / k by the size of the first rectangle, and enlarge or shrink the first rectangle according to the size after multiplication to obtain the second rectangle;

[0050] Calculate the coordinates of the second rectangle when the centers of the first and second rectangles coincide;

[0051] The text content and the coordinates of the second rectangle are used as the recognition result of the original table image.

[0052] In another aspect, this application also provides a computer storage medium storing a computer program that, when executed by a processor, implements the table character recognition method.

[0053] In another aspect, this application also provides an electronic device, comprising:

[0054] processor;

[0055] Memory used to store processor-executable instructions;

[0056] The processor is configured to implement the table character recognition method when executing the executable instructions.

[0057] Technical effects of the present invention:

[0058] This application identifies table borders in an original table image; segments the original table image according to the identified table border coordinates to extract a first cell image; scales the first cell image to obtain a second cell image; and places the second cell image back in its original position to obtain a new table image. It can identify table borders in the original table image, then locally shrink the area (sub-image) containing each table cell by a certain scaling factor to generate a new image for the current page, significantly widening the spacing between text. OCR recognition is then performed on the new image to obtain the recognition result, thus effectively preventing the character sticking phenomenon in OCR recognition, making the recognized text information more accurate, and preventing text information errors caused by character sticking during user reading, thereby improving user readability.

[0059] Other features and aspects of this disclosure will become clear from the following detailed description of exemplary embodiments with reference to the accompanying drawings. Attached Figure Description

[0060] The accompanying drawings, which are included in and form part of this specification, illustrate exemplary embodiments, features, and aspects of this disclosure together with the specification and serve to explain the principles of this disclosure.

[0061] Figure 1 The diagram shown is a schematic representation of an equipment acceptance form in the background art.

[0062] Figure 2 The diagram illustrates the implementation flow of the table character recognition method of the present invention.

[0063] Figure 3 The diagram shows a scaling schematic of the first cell image of the present invention after scaling to obtain a new image;

[0064] Figure 4 The diagram shown is a schematic diagram of the application system of the electronic device of the present invention;

[0065] Figure 5 The diagram shows the application components of the device of the present invention. Detailed Implementation

[0066] Various exemplary embodiments, features, and aspects of this disclosure will now be described in detail with reference to the accompanying drawings. The same reference numerals in the drawings denote elements that have the same or similar functions. Although various aspects of the embodiments are shown in the drawings, they are not necessarily drawn to scale unless specifically indicated otherwise.

[0067] The term “exemplary” as used herein means “serving as an example, embodiment, or illustration.” Any embodiment illustrated herein as “exemplary” is not necessarily to be construed as superior to or better than other embodiments.

[0068] Furthermore, to better illustrate this disclosure, numerous specific details are set forth in the following detailed description. Those skilled in the art will understand that this disclosure can be practiced without certain specific details. In some instances, methods, means, components, and circuits well known to those skilled in the art have not been described in detail in order to highlight the main points of this disclosure.

[0069] Example 1

[0070] In this embodiment, the following terms are defined first:

[0071] 1. Table Images: Tables presented in image form, divided into original table images and new table images.

[0072] 2. Cell Image: A table image is an image created by cropping the table cells.

[0073] 2. First cell image: The cell image before scaling.

[0074] 3. Second cell image: The scaled cell image.

[0075] As attached Figure 1 The equipment acceptance form shown here contains the text "2021-10-22 20:14" and "drafting node" within the boxed section of the approval comments. This could potentially be recognized by the OCR algorithm as a single string object, "2021-10-22 20:14 drafting node," which is inappropriate. The industry refers to this issue as the "table character recognition sticking problem." This problem needs to be addressed to prevent table character sticking.

[0076] To address the aforementioned issues, this application proposes the following overall approach: First, table border recognition is performed on the first cell image A. Then, the area containing each table cell (sub-image) is locally scaled down using a certain scaling factor to generate a new image B for the current page. Finally, OCR recognition is performed on image B, thus avoiding character overlap.

[0077] like Figure 2 As shown, this application proposes a method for recognizing table characters, including the following steps:

[0078] S1. Recognize table borders in the original table image;

[0079] S2. Cut the original table image according to the identified table frame coordinates to extract the first cell image;

[0080] S3. Scale the first cell image to obtain the second cell image;

[0081] S4. Return the image of the second cell to its original position to obtain a new table image.

[0082] To address the aforementioned issues, this application proposes the following overall approach: First, table borders are identified in the original table image A. Then, the area containing each table cell (sub-image) is locally scaled down using a certain scaling factor to generate a new table image B for the current page. Finally, OCR recognition is performed on image B, thus avoiding character overlap.

[0083] The implementation scheme of steps S1-S4 of this application will be described in detail below.

[0084] like Figure 3 As shown, the first cell image of the current page consists of several table cells. The spacing d1 between the text in the table and the table frame is small. Therefore, when the OCR algorithm recognizes the text "2021-10-22 20:14" and "drafting node" in the box, it is possible that the OCR algorithm will recognize it as a string object "2021-10-22 20:14drafting node".

[0085] Therefore, this technique first performs table frame line recognition on the first cell image A to obtain the table frame line coordinates of each cell.

[0086] As an optional implementation of this application, optionally, S1, table frame line recognition is performed on the original table image, including:

[0087] Identify the table regions in the original table image;

[0088] Based on the table area, identify the horizontal and vertical lines of the table area;

[0089] The cells of the table area are determined based on the intersection of the horizontal and vertical lines;

[0090] The coordinates of the table border are determined based on the cells in the table area.

[0091] Table border recognition involves obtaining the border information and coordinates of cells in the original table image. This embodiment uses table recognition to identify the original table image, thereby obtaining the cell border information and coordinates. Specific steps include:

[0092] Step 1: Identify the table area;

[0093] Step 2: Identify horizontal lines, vertical lines, and cells.

[0094] By employing a table recognition algorithm, the table region in the first cell image can be identified, yielding information such as the table borders and coordinates for each cell. Table recognition algorithms can identify table regions and the table's horizontal and vertical lines, as well as individual cells. Examples include deep learning-based table recognition algorithms and OpenCV-based table recognition algorithms.

[0095] In this embodiment, the user may choose to use an existing table recognition algorithm to perform the above-mentioned frame lines and coordinate recognition calculations; this embodiment does not impose any limitations.

[0096] S2. Cut the original table image according to the identified table frame coordinates to extract the first cell image.

[0097] Once the coordinates of the table borders of each cell are identified, the original table image can be segmented into several first cell images. In other words, based on the coordinates of the table borders of each cell, all the segmented cell images—the first cell images—are extracted.

[0098] In this embodiment, after obtaining the coordinates of the table frame lines, each table cell can be divided according to its corresponding table frame line coordinates. Each table cell is divided based on the table frame line coordinates, so that the original table image can be cut into several first cell images.

[0099] like Figure 3 As shown, after segmentation, the cell image containing "2021-10-22 20:14" (one of the first cell images) will be segmented out. After segmentation, the original table image will consist of a set of several segmented first cell images;

[0100] Each first cell image awaits scaling.

[0101] As an optional implementation of this application, optionally, S3, scaling the first cell image to obtain the second cell image includes:

[0102] Preset scaling ratio k;

[0103] Multiply the scaling ratio k by the size of the first cell image, and then reduce or enlarge the first cell image according to the size of the multiplier to obtain the second cell image.

[0104] After obtaining the coordinates of the table border of the first cell image, in order to clearly display the spacing between the first cell images, the table border of the first cell image can be scaled by zooming in or out.

[0105] In this embodiment, in order to increase the spacing between text in the cell image, each cell image is first reduced in size according to the reduction ratio.

[0106] Users need to pre-set the scaling ratio, which is set by the user. Each first cell image is scaled according to a ratio k to obtain a scaled-down second cell image.

[0107] like Figure 3 As shown, each cell image in the first cell image set is reduced in size according to the preset scaling ratio k. After each cell image in the first cell image is reduced in size by the scaling ratio k, the first cell image of each cell is reduced in size to obtain the second cell image. At this time, the current page image is composed of several reduced first cell images, i.e., second cell images.

[0108] In order to match the placement / position of the corresponding first cell image, this embodiment needs to put the second cell image back in its original position. After each second cell image is placed in its original cell table area, the first cell image of the current page becomes a new image composed of cell images that have been reduced in size.

[0109] As an optional implementation of this application, optionally, S4, returning the second cell image to its original position to obtain a new table image includes:

[0110] Calculate the center of the first cell image and the second cell image respectively;

[0111] Place the second cell image back onto the original table image, and make the centers of the second cell image and the first cell image coincide;

[0112] Delete the first cell image to obtain the new image.

[0113] The second cell image should ideally be placed back into the original cell table area. In this embodiment, the cell center is used as the reference point, and the reduced cell image is placed back into the original table area to obtain the new table image B for the current page.

[0114] The second cell image obtained after scaling needs to be repositioned according to the coordinate center of the original table image; that is, the center of the second cell image needs to be placed back within the original table area. Specifically, firstly, the centers of the first cell image and the second cell image are calculated. During repositioning, using the first cell image as a reference, each cell image is placed back within the original table area of ​​the first cell image. When repositioning the second cell image, using the cell center obtained above as a reference, the second cell image is placed back into the original table image, ensuring that the centers of the second cell image and the first cell image coincide.

[0115] When the second cell image is placed back and its center coincides with the center of the first cell image, the corresponding first cell image is deleted, and the image replacement is completed. At this time, the original table image is composed of several scaled second cell images.

[0116] As an optional implementation of this application, optionally, the step of placing the second cell image back onto the original table image includes:

[0117] The original position of the first cell image is determined based on the coordinates of the table frame lines;

[0118] Place the second cell image back into the original position of the first cell image.

[0119] The table borders and coordinate information have already been calculated and will not be repeated here. Place the image of the second cell back into the original position of the image of the first cell.

[0120] All second-cell images are repositioned using the cell center as a reference, resulting in a new image that is only resized without changing its center position, making it easier to calculate the spacing between cells.

[0121] As an optional implementation of this application, after placing the second cell image back in its original position to obtain a new table image, the method further includes:

[0122] The new table image is subjected to OCR recognition to obtain OCR recognition results; wherein, the OCR recognition results include the text content and text position of each text in the new table image;

[0123] Based on the table area and scaling factor k, the OCR recognition result is adjusted to obtain the recognition result of the original table image.

[0124] like Figure 3As shown, each cell of the new image is reduced in size, and the text spacing in the cell image is significantly widened, which can prevent the sticking phenomenon of OCR characters during OCR recognition.

[0125] The text spacing in the cell image is mainly determined by the scaling factor k, and the specific spacing size is determined by the user.

[0126] In this new image, the spacing between text is increased, making it easier to perform OCR recognition. The preset OCR recognition algorithm can then be used to perform text OCR recognition on each OCR object in the new image.

[0127] Table recognition and text OCR are separate processes. The main ideas of OCR text recognition algorithms are: 1) page orientation recognition; 2) identifying text objects through target detection algorithms: the text object is a continuous sequence of characters, and the character spacing can be controlled by parameters; 3) character classification algorithms to identify what kind of character each character is.

[0128] In this embodiment, the OCR recognition algorithm is not required and can be selected by the user.

[0129] For each cell of the new image, OCR text recognition is performed to obtain the text content of each new image cell. Specifically, the cell images of the new image are traversed to obtain the recognition result of each object and the OCR object category is output.

[0130] As an optional embodiment of this application, the text position may optionally include the coordinates of a first rectangular frame surrounding the text;

[0131] The step of adjusting the OCR recognition result based on the table area and scaling ratio k to obtain the recognition result of the original table image includes:

[0132] Determine whether the coordinates of the first rectangle are within the range of the table frame coordinates;

[0133] If so, multiply the reciprocal of the scaling ratio 1 / k by the size of the first rectangle, and enlarge or shrink the first rectangle according to the size after multiplication to obtain the second rectangle;

[0134] Calculate the coordinates of the second rectangle when the centers of the first and second rectangles coincide;

[0135] The text content and the coordinates of the second rectangle are used as the recognition result of the original table image.

[0136] In this embodiment, text OCR and table recognition are two separate algorithms. The OCR text recognition algorithm first identifies the page orientation, and then identifies the text object through the target detection algorithm.

[0137] The text OCR recognition process does not consider the position of table borders. Its second step is object detection, which identifies foreground images on a page that contain the text string to be recognized. The identified objects are called OCR objects. For example, normally each line is one OCR object. However, if a line of text contains punctuation marks or spaces, it may be recognized as multiple OCR objects. Whether a line is recognized as one object or multiple objects depends on a parameter that controls the spacing (k, determined by the user).

[0138] Therefore, according to the text OCR recognition described above, all the OCR objects in the new image are traversed to obtain the text information and bounding box coordinates of the OCR object (i.e., the cell image). The bounding box coordinates are the cell coordinates of the cell image where the OCR object is located. For details on the bounding box coordinate extraction / recognition algorithm, please refer to the relevant bounding box geometric calculation methods.

[0139] Once the text information and bounding box coordinates of the OCR object (i.e., the cell image) are obtained, if the OCR object is located within the table area, the bounding box coordinates are scaled relative to the cell center at a ratio of 1 / k, and the bounding box coordinates are updated.

[0140] The OCR object needs to be located within the original table area. In order to accurately detect the position of the OCR object, a detection step is also provided here to determine whether the OCR object is located within the original table area. The valid OCR object is effectively identified by judging whether the OCR object is located within the original table area.

[0141] After detection, if the OCR object is determined to be within the original table area, the coordinates of the four points of the bounding box are scaled according to a ratio of 1 / k; otherwise, adjustments are made. Automatic or manual adjustments are both acceptable.

[0142] Therefore, this application utilizes a method of cutting out and scaling table cells before performing OCR, changing the spacing between text from the original d1 to d2. The spacing is significantly widened, preventing the sticking phenomenon in OCR character recognition.

[0143] Obviously, those skilled in the art should understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above control methods.

[0144] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the control methods described above.

[0145] Example 2

[0146] like Figure 4 As shown, further, in another aspect, this application also provides an electronic device, including:

[0147] processor;

[0148] Memory used to store processor-executable instructions;

[0149] The processor is configured to implement the table character recognition method when executing the executable instructions.

[0150] This disclosure discloses an electronic device including a processor and a memory for storing processor-executable instructions. The processor is configured to implement any of the preceding table character recognition methods when executing the executable instructions.

[0151] It should be noted here that the number of processors can be one or more. Furthermore, the electronic device in this embodiment may also include input devices and output devices. The processor, memory, input devices, and output devices can be connected via a bus or other means, without specific limitations herein.

[0152] As a computer-readable storage medium, the memory can be used to store software programs, computer-executable programs, and various modules, such as the program or module corresponding to the table character recognition method in this disclosure. The processor executes various functional applications and data processing of the electronic device by running the software program or module stored in the memory.

[0153] Input devices can be used to receive input digital numbers or signals. These signals can be key signals related to user settings and function control of the device / terminal / server. Output devices can include display devices such as screens.

[0154] Example 3

[0155] In another aspect, this application provides a computer storage medium storing a computer program that, when executed by a processor, implements the table character recognition method.

[0156] The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk drive (HDD), or solid-state drive (SSD), etc.; the storage medium can also include a combination of the above types of memory.

[0157] Example 4

[0158] like Figure 5 As shown, based on the implementation principle of Embodiment 1, this application also provides a table character recognition device, comprising:

[0159] The table border recognition module is used to recognize table borders in the original table image;

[0160] The table cell cutting module is used to cut the original table image according to the identified table frame coordinates and extract the first cell image.

[0161] An image scaling module is used to scale the first cell image to obtain a second cell image;

[0162] The image reset module is used to put the second cell image back in its original position to obtain a new table image.

[0163] For details on the functions and interactive application principles of the table border recognition module, table cell cutting module, image scaling module, and image reset module, please refer to the descriptions corresponding to steps S1-S4 in Embodiment 1. These will not be repeated in this embodiment.

[0164] The functional principles and interaction principles of each module described below are similarly described in Example 1.

[0165] As an alternative implementation of this application, optionally,

[0166] The table border recognition module includes: a first recognition module for recognizing the table area of ​​the original table image; a second recognition module for recognizing the horizontal and vertical lines of the table area based on the table area; a cell determination module for determining the cells of the table area based on the intersection of the horizontal and vertical lines; and a coordinate determination module for determining the coordinates of the table border based on the cells of the table area.

[0167] The image scaling module includes: a configuration module for presetting a scaling ratio k; and a scaling module for multiplying the scaling ratio k by the size of the first cell image, and scaling the first cell image down or up according to the multiplied size to obtain the second cell image.

[0168] The image reset module includes: a calculation module for calculating the center of the first cell image and the second cell image respectively; a reset module for placing the second cell image back onto the original table image and making the center of the second cell image and the first cell image coincide; and a new image acquisition module for deleting the first cell image and obtaining the new image.

[0169] The reset module includes: a first reset module, used to determine the original position of the first cell image based on the coordinates of the table frame line; and a second reset module, used to return the second cell image to the original position of the first cell image.

[0170] The image reset module further includes:

[0171] An OCR recognition module is used to perform OCR recognition on the new table image to obtain OCR recognition results; wherein, the OCR recognition results include the text content and text position of each text in the new table image; the text position includes the coordinates of a first rectangular box surrounding the text;

[0172] The text adjustment module is used to adjust the OCR recognition result according to the table area and the scaling ratio k to obtain the recognition result of the original table image, including:

[0173] Determine whether the coordinates of the first rectangle are within the range of the table frame coordinates;

[0174] If so, multiply the reciprocal of the scaling ratio 1 / k by the size of the first rectangle, and enlarge or shrink the first rectangle according to the size after multiplication to obtain the second rectangle;

[0175] Calculate the coordinates of the second rectangle when the centers of the first and second rectangles coincide;

[0176] The text content and the coordinates of the second rectangle are used as the recognition result of the original table image.

[0177] For details on the functions of each module and the interaction principles between modules, please refer to the description in Example 1. This example will not repeat them.

[0178] The modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device, or fabricating them separately as individual integrated circuit modules, or fabricating multiple modules or steps into a single integrated circuit module. Thus, the present invention is not limited to any particular hardware and software combination.

[0179] The various embodiments of this disclosure have been described above. These descriptions are exemplary and not exhaustive, and are not limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical applications, or technical improvements to the technology in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.

Claims

1. A method for recognizing table characters, characterized in that, Includes the following steps: The original table image is subjected to table border recognition. Specifically, a deep learning-based table recognition algorithm is used to identify the table area and the horizontal lines, vertical lines, and cells of the first cell image. The original table image is cut according to the identified table frame coordinates, and the original table image is divided into several first cell images. The first cell images are extracted, and the first cell images include all the cut cell images. Scaling the first cell image to obtain the second cell image includes: a preset scaling ratio k; multiplying the scaling ratio k by the size of the first cell image, and scaling the first cell image down or up according to the multiplied size to obtain the second cell image; specifically: each cell image in the first cell image set is scaled down according to the preset scaling ratio k, and after each cell image in the first cell image is scaled down by the scaling ratio k, the first cell image containing each cell is scaled down to obtain the second cell image; The process of returning the second cell image to its original position to obtain a new table image includes: calculating the centers of the first cell image and the second cell image respectively; returning the second cell image to the original table image, ensuring that the centers of the second cell image and the first cell image coincide; deleting the first cell image to obtain a new image; the second cell image obtained through scaling needs to be repositioned according to the coordinate center of the original table image, that is, the center of the second cell image needs to be returned to the original table area. Specifically, firstly, the centers of the first cell image and the second cell image are calculated. When returning, each cell image is returned to the original table area of ​​the first cell image, using the first cell image as a reference. When repositioning the second cell image, the cell center obtained above is used as a reference, and the second cell image is returned to the original table image, ensuring that the centers of the second cell image and the first cell image coincide. When the second cell image is returned and coincides with the center of the first cell image, the corresponding first cell image is deleted, completing the image replacement. At this time, the original table image consists of several scaled second cell images. The new table image is subjected to OCR recognition to obtain OCR recognition results; wherein, the OCR recognition results include the text content and text position of each text in the new table image; the OCR recognition results are adjusted according to the table area and the scaling ratio k to obtain the recognition results of the original table image.

2. The table character recognition method according to claim 1, characterized in that, The step of recognizing table borders in the original table image includes: Identify the table regions in the original table image; Based on the table area, identify the horizontal and vertical lines of the table area; The cells of the table area are determined based on the intersection of the horizontal and vertical lines; The coordinates of the table border are determined based on the cells in the table area.

3. The table character recognition method according to claim 1, characterized in that, The step of placing the second cell image back onto the original table image includes: The original position of the first cell image is determined based on the coordinates of the table frame lines; Place the second cell image back into the original position of the first cell image.

4. The table character recognition method according to claim 1, characterized in that, The text location includes the coordinates of a first rectangle surrounding the text; The step of adjusting the OCR recognition result based on the table area and scaling ratio k to obtain the recognition result of the original table image includes: Determine whether the coordinates of the first rectangle are within the range of the table frame coordinates; If so, multiply the reciprocal of the scaling ratio 1 / k by the size of the first rectangle, and enlarge or shrink the first rectangle according to the size after multiplication to obtain the second rectangle; Calculate the coordinates of the second rectangle when the centers of the first and second rectangles coincide; The text content and the coordinates of the second rectangle are used as the recognition result of the original table image.

5. A table character recognition device, characterized in that, include: The table frame recognition module is used to recognize the table frame in the original table image. Specifically, it uses a deep learning-based table recognition algorithm to identify the table area and the horizontal lines, vertical lines, and cells in the first cell image. The table cell cutting module is used to cut the original table image according to the identified table frame coordinates, divide the original table image into several first cell images, and extract the first cell images. The first cell images include all the cut cell images. An image scaling module is used to scale the first cell image to obtain a second cell image, including: a preset scaling ratio k; multiplying the scaling ratio k by the size of the first cell image, and scaling the first cell image down or up according to the multiplied size to obtain the second cell image; specifically: each cell image in the first cell image set is scaled down according to the preset scaling ratio k, and after each cell image in the first cell image is scaled down by the scaling ratio k, the first cell image containing each cell is scaled down to obtain the second cell image; The image reset module is used to return the second cell image to its original position to obtain a new table image. This includes: calculating the centers of the first cell image and the second cell image respectively; placing the second cell image back into the original table image, ensuring the centers of the second cell image and the first cell image coincide; deleting the first cell image to obtain a new image. The scaled second cell image needs to be repositioned according to the coordinate center of the original table image, that is, the center of the second cell image needs to be placed back within the original table area. Specifically, firstly, the centers of the first cell image and the second cell image are calculated. During the repositioning, using the first cell image as a reference, each cell image is placed back into the original table area of ​​the first cell image. Within the grid area; when the second cell image is returned to its original position, the second cell image is placed back onto the original table image based on the cell center obtained above, so that the center of the second cell image coincides with the center of the first cell image; when the second cell image is returned and coincides with the center of the first cell image, the corresponding first cell image is deleted, completing the image replacement. At this time, the original table image is composed of several scaled second cell images; OCR recognition is performed on the new table image to obtain the OCR recognition result; wherein, the OCR recognition result includes the text content and text position of each text in the new table image; according to the table area and the scaling ratio k, the OCR recognition result is adjusted to obtain the recognition result of the original table image.

6. A computer storage medium, characterized in that, The computer storage medium stores a computer program, which, when executed by a processor, implements the table character recognition method according to any one of claims 1-4.

7. An electronic device, characterized in that, include: processor; Memory used to store processor-executable instructions; The processor is configured to implement the table character recognition method according to any one of claims 1-4 when executing the executable instructions.