CN116246293A - Table identification method and device, storage medium and electronic equipment - Google Patents
Table identification method and device, storage medium and electronic equipment Download PDFInfo
- Publication number
- CN116246293A CN116246293A CN202310251922.9A CN202310251922A CN116246293A CN 116246293 A CN116246293 A CN 116246293A CN 202310251922 A CN202310251922 A CN 202310251922A CN 116246293 A CN116246293 A CN 116246293A
- Authority
- CN
- China
- Prior art keywords
- picture
- intersection point
- determining
- information set
- line
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V30/00—Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
- G06V30/40—Document-oriented image-based pattern recognition
- G06V30/41—Analysis of document content
- G06V30/414—Extracting the geometrical structure, e.g. layout tree; Block segmentation, e.g. bounding boxes for graphics or text
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Computer Graphics (AREA)
- Geometry (AREA)
- Artificial Intelligence (AREA)
- General Physics & Mathematics (AREA)
- Multimedia (AREA)
- Theoretical Computer Science (AREA)
- Image Analysis (AREA)
Abstract
The invention relates to the technical field of image processing, and discloses a method and a device for identifying a form, a storage medium and electronic equipment, wherein the method comprises the following steps: obtaining a form picture to be identified, wherein the picture comprises: a table and an image outside the table; extracting form type features and all transverse line and longitudinal line information in the picture, and determining transverse line and longitudinal line threshold standards of the form in the picture according to the form type features; determining the transverse line and longitudinal line information of the table according to the transverse line and longitudinal line threshold standards; determining an intersection point information set of a table according to the horizontal line information and the vertical line information; and determining the vertex information set of the outer frame of the table according to the intersection point information set of the table, and extracting the table from the picture based on the vertex information set of the outer frame of the table. By the method, the table in the picture can be quickly and accurately identified.
Description
Technical Field
The present invention relates to the field of image processing technologies, and in particular, to a method and apparatus for identifying a table, a storage medium, and an electronic device.
Background
Pictures have been used in various industries as a way of information storage. Among some pictures, some are presented with information in the form of tables. Such as corporate ledger information, personnel information, hospital test report, etc. And, most of this information is very valuable and needs to be extracted from the picture. With the development of Optical Character Recognition (OCR) technology, the extraction of data from pictures has become more and more convenient.
However, the use of OCR to recognize data of a form on a picture is not very accurate. On the one hand, the positioning of the form is not very accurate. For example, data outside the table is often extracted, but this part of the data is not needed. On the other hand, the problem of misplacement serial often occurs when extracting data in a table. For example, multiple lines of text of the same cell may be divided into different cells. Alternatively, text from adjacent cells may be incorrectly stitched together. Therefore, a technical solution is needed to solve the above technical problems, and thus, the data of the table in the picture can be quickly and accurately identified.
Disclosure of Invention
The invention provides a method and a device for identifying a form, a storage medium and electronic equipment, and aims to solve the technical problems of low accuracy and low efficiency of form identification in a picture in the prior art.
In a first aspect, a method for identifying a table is provided, including:
obtaining a form picture to be identified, wherein the picture comprises: a table and an image outside the table;
extracting form type features and all transverse line and longitudinal line information in the picture, and determining transverse line and longitudinal line threshold standards of the form in the picture according to the form type features;
determining the transverse line and longitudinal line information of the table according to the transverse line and longitudinal line threshold standards;
determining an intersection point information set of a table according to the horizontal line information and the vertical line information;
and determining the vertex information set of the outer frame of the table according to the intersection point information set of the table, and extracting the table from the picture based on the vertex information set of the outer frame of the table.
In a second aspect, there is provided an identification device for a form, including:
a table picture acquisition module: the method comprises the steps of obtaining a form picture to be identified, wherein the picture comprises the following steps: a table and an image outside the table;
a table transverse and longitudinal line threshold value determining module: the method comprises the steps of extracting form type features and all transverse line and longitudinal line information in the picture, and determining transverse line and longitudinal line threshold standards of forms in the picture according to the form type features;
a table transverse and longitudinal line determining module: the method comprises the steps of determining transverse line information and longitudinal line information of a table according to the transverse line threshold standard and the longitudinal line threshold standard;
a table intersection point information determining module: the intersection point information set is used for determining a table according to the transverse line information and the longitudinal line information;
a table extraction module; and the method is used for determining the vertex information set of the outer frame of the table according to the intersection point information set of the table, and extracting the table from the picture based on the vertex information set of the outer frame of the table.
In a third aspect, a computer readable storage medium is provided, the computer readable storage medium storing a computer program which, when executed by a processor, implements the steps of the above table identification method.
In a fourth aspect, an electronic device is provided comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor executing the steps of the method for identifying a table as described above.
According to the method, the device, the storage medium and the electronic equipment for identifying the table, the table picture to be identified is obtained, table type characteristics and all transverse line and longitudinal line information are extracted from the picture, and transverse line and longitudinal line threshold standards of the table in the picture are determined according to the table type characteristics; then, according to the transversal and longitudinal threshold criteria, determining transversal and longitudinal information of the table, and determining an intersection point information set of the table based on the transversal and longitudinal information of the table; and finally, determining the vertex information set of the outer frame of the table from the intersection point information set of the table, and extracting the table from the picture according to the vertex information of the outer frame of the table, so that the table in the picture can be quickly and accurately identified.
In a huge number of form pictures, some identical features will be found between the forms. For example, the lengths of the horizontal lines and/or the vertical lines of the table are within a numerical range. Compared with the prior art, the method and the device have the advantages that the table in the picture can be accurately positioned according to the transverse line and longitudinal line threshold standards of the table corresponding to the predefined table type, further, data outside the table are prevented from being extracted as much as possible, and the table in the picture is further identified rapidly and accurately.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the description of the embodiments of the present invention will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic view of an application environment of a method for identifying a table in an embodiment of the present invention;
FIG. 2 is a flow chart of a method for identifying a table in an embodiment of the invention;
FIG. 3 is a schematic diagram of an interface of a table picture in an embodiment of the present invention;
FIG. 4 is a flowchart illustrating the step S20 in FIG. 2;
FIG. 5 is a flowchart illustrating the step S50 in FIG. 2;
FIG. 6 is a schematic diagram of a table identification device in an embodiment of the invention;
FIG. 7 is a schematic view of a table identification device in another embodiment of the invention;
FIG. 8 is a schematic diagram of a computer device according to an embodiment of the invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The method for identifying the table provided by the embodiment of the invention can be applied to an application environment shown in fig. 1. Firstly, a form picture to be identified is acquired through a client side and transmitted to a server side. Then, extracting form type features and all transverse line and longitudinal line information in the picture at a server, and determining transverse line and longitudinal line threshold standards of the form in the picture according to the form type features; secondly, determining the transverse line information and the longitudinal line information of the table according to the transverse line threshold value standard and the longitudinal line threshold value standard, and determining an intersection point information set of the table based on the transverse line information and the longitudinal line information of the table; and finally, determining the vertex information set of the outer frame of the table according to the intersection point information set of the table, and extracting the table from the picture based on the vertex information set of the outer frame of the table.
According to the embodiment of the invention, the table is extracted from the table picture according to the transverse line and longitudinal line threshold standards of the table corresponding to the predefined table type, and the table in the picture can be accurately positioned, so that the table in the picture can be rapidly and accurately identified. The clients may be, but are not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices. The server may be implemented by a stand-alone server or a server cluster formed by a plurality of servers. The present invention will be described in detail with reference to specific examples.
Referring to fig. 2, fig. 2 is a flow chart illustrating a table identification method according to an embodiment of the invention, which includes the following steps:
s10: obtaining a form picture to be identified, wherein the picture comprises: table and images outside the table.
The table picture in the embodiment of the application comprises: table and images outside the table. Wherein the contents of the form relate primarily to corporate asset aspects. The applicant is a company engaged in financing and renting business, and in the field of financing and renting business, the company asset information of the client needs to be checked so as to determine whether to agree with the client. The customer's corporate asset information is typically presented in form of a tabular picture. Referring to fig. 3, fig. 3 is a schematic diagram illustrating an interface of a table picture according to an embodiment of the invention. The off-table images are primarily those of the financial organization, time of inquiry, and assets of FIG. 3, and these literal data do not belong to the data within the table.
S20: and extracting form type characteristics and all transverse line and longitudinal line information in the picture, and determining transverse line and longitudinal line threshold standards of the form in the picture according to the form type characteristics.
In one embodiment, the form type feature may be a company name, with different company names corresponding to different types of forms, and thus different horizontal and vertical threshold criteria. Since the ledger form of each company basically has a fixed format, the type of the form can be judged according to the name of the company. Referring to fig. 4, fig. 4 is a flowchart of a specific embodiment of step S20 in fig. 2, where the table types include at least two types, and specifically includes the following steps:
s21, extracting form type characteristics in the picture, judging whether a form in the picture is a first type form, and if so, determining that the horizontal line and vertical line thresholds of the form in the picture are first type form standards;
and S22, if not, judging the type of the table in the picture in sequence until the horizontal line and vertical line threshold standards of the table in the picture are determined.
For example, 100 companies' asset information in the financing rental business database needs to be checked. If the form types are different for each company, there are 100 types of forms in total. Also, the horizontal and vertical thresholds in each type of table are different. For example, the first type of form has a transverse line length in the interval of 15 to 16 centimeters and a longitudinal line length in the interval of 10 to 11 centimeters; the second type of table has a transverse line length in the interval of 13 to 14 cm and a longitudinal line length in the interval of 9 to 10 cm.
S30: and determining the transverse line and longitudinal line information of the table according to the transverse line and longitudinal line threshold standards.
After the cross-line and longitudinal-line threshold criteria of the form are determined, the cross-line and/or longitudinal-line information of the form may be identified. Such as the cross line at the ellipse in fig. 3, is not the cross line of the table because the length of the cross line does not meet the corresponding threshold criteria.
S40: and determining an intersection point information set of the table according to the horizontal line information and the vertical line information.
For example, the table in fig. 3 is 11 rows and 4 columns, and there are 12 horizontal lines and 5 vertical lines, and there are 5 intersecting points on each horizontal line, and the number of intersecting points of the table is 60.
S50: and determining the vertex information set of the outer frame of the table according to the intersection point information set of the table, and extracting the table from the picture based on the vertex information set of the outer frame of the table.
In one embodiment, the intersection information includes: referring to fig. 5, fig. 5 is a flowchart of a specific embodiment of step S50 in fig. 2, which includes the following steps:
s51, judging whether the horizontal coordinate value and the vertical coordinate value of the intersection point in the intersection point information set are minimum values in sequence, and if so, determining that the intersection point is a first vertex of an outer frame of the table;
s52, judging whether the abscissa value of the intersection point in the intersection point information set is the minimum value and whether the ordinate value of the intersection point is the maximum value in sequence, if so, determining that the intersection point is a second vertex of the outer frame of the table;
s53, judging whether the abscissa value of the intersection point in the intersection point information set is the maximum value and whether the ordinate value of the intersection point is the minimum value in sequence, if so, determining that the intersection point is a third vertex of the outer frame of the table;
s54, judging whether the horizontal coordinate value and the vertical coordinate value of the intersection point in the intersection point information set are the maximum values in sequence, and if so, determining that the intersection point is a fourth vertex of the outer frame of the table;
and S55, extracting a table from the picture according to the first, second, third and fourth vertexes.
For example, the table outer frame in fig. 3 has four vertices in total. Wherein the abscissa and ordinate values of the upper left vertex of the outer frame are the minimum values among all the intersections. Similarly, in all the intersection points, the abscissa value of the lower left vertex of the outer frame is the minimum value, and the ordinate value is the maximum value; the abscissa value of the upper right vertex of the outer frame is the maximum value, and the ordinate value is the minimum value; the horizontal coordinate value and the vertical coordinate value of the lower right vertex of the outer frame are both maximum values. Through the method, the vertex information set of the outer frame of the table is determined, and then the table is extracted from the picture according to the vertex information set.
In the embodiment of the application, the table in the picture is extracted according to the transverse line and longitudinal line threshold standards of the table corresponding to the predefined table type, so that the accurate positioning of the table can be realized, and the identification accuracy of the table in the picture is further improved.
In one embodiment, after step S50, the method further includes a table reconstruction method, which mainly includes the following steps:
a1: determining an intersection point information set of an upper frame and a lower frame of the table according to the intersection point information set of the table;
a2: cutting the table according to the intersection point information set of the upper frame and the lower frame of the table to form a plurality of columns of sub-tables;
a3: and sequentially extracting a plurality of cell information in each column of sub-table, and generating a reconstructed table file according to the cell information.
In the prior art, if the data in the whole table is extracted, the problem of misplaced serial is often caused. According to the embodiment of the application, the table is segmented into a plurality of columns, the data in each column of the table are respectively extracted, and then the extracted data are spliced to generate the reconstructed table file, so that the occurrence probability of dislocation serial can be greatly reduced. For example, in the table in fig. 3, the table may be divided into 4 columns according to the 5 intersection information of the upper border of the table and the 5 intersection information of the lower border of the table.
In one embodiment, the cell information includes: the text and text coordinate values of the cell, step A3 includes the following:
b1: sequentially extracting texts and text coordinate values of a plurality of cells in each column of sub-table, and determining a reference column sub-table in the plurality of columns of sub-tables according to the number of texts of the plurality of cells in each column of sub-table;
b2: and generating a reconstructed table file according to the text coordinate values of the cells in the reference column sub-table.
For example, in the table in fig. 3, the first column of sub-table has text in 11 cells, and the number of text is 11; by analogy, the text is also contained in 11 cells of the second, third and fifth columns of sub-tables, and then the number of the text is 11; only 9 cells in the fourth column of the sub-table have texts, and the number of texts is 9. Then, the sub-table of any one of the first, second, third, and fifth columns may be determined as the reference column sub-table. For example, the first column of sub-tables may be determined to be reference column sub-tables. And then sequentially acquiring text coordinate values of 11 cells in the first column of sub-table, and sequentially comparing the text coordinate values of a plurality of cells in other columns of sub-tables with the text coordinate values of 11 cells in the first column of sub-table. In one embodiment, the text coordinate values of the plurality of cells include the abscissa values of the four vertices of the text. For example, the text "serial number" may have a coordinate value of { (x) 0, y 0 );(x 1, y 0 );(x 0, y 1 );(x 1, y 1 ) Combinations of }. If the text of a cell in the other column of the sub-table and the text 'number' belong to the same row, the ordinate value of the text of the cell in the other column of the sub-table is a value which tends to be close to the ordinate value of the text 'number'. For example, the ordinate value of the text "fixed asset name" is a close value to the ordinate value of the text "serial number". By comparing the ordinate values of the text of a plurality of cells in the sub-table, the text data of the same line can be determined, and finallyAnd generating a reconstructed table file.
In the embodiment of the invention, the data in each column of the table is extracted by dividing the table into a plurality of columns, and then the extracted data is spliced to generate the reconstructed table file. In the prior art, when reconstructing a new table file, it is necessary to compare the horizontal coordinate values of the texts of a plurality of cells in the sub-table, that is, not only the vertical coordinate values of the texts of the cells, but also the horizontal coordinate values of the texts of the cells. However, in the embodiment of the invention, after the table is segmented into a plurality of columns, when a new table file is reconstructed, only the ordinate values of texts of a plurality of cells in the sub-table are compared, so that the efficiency and the accuracy of identifying the table data in the picture can be improved.
In one embodiment, after the table is reconstructed, the method for comparing the table is further included, and mainly includes the following steps:
c1: obtaining a comparison table file;
c2: and comparing the comparison table file with the reconstructed table file according to the unique code in the comparison table file, and outputting a comparison result.
In the financing and renting business of the applicant, besides the data in the form is required to be extracted from the ledger picture submitted by the customer, the ledger form file submitted by the customer is required to be compared with the data in the ledger picture, and the data are judged to be the same and different. That is, the ledger form file submitted by the customer at this time is a comparison form file. However, the ledger form file format submitted by the customer sometimes does not agree with the ledger picture form format. For example, "GDYYBG001" in the ledger-sheet of fig. 3 corresponds to a number; corresponding to the asset number may be in the ledger form file. I.e. the two are named differently. In the embodiment of the application, the comparison table file is compared with the reconstructed table file through the unique code in the comparison table file, so that the accuracy of the comparison result can be ensured. For example, in the ledger table file corresponding to the ledger picture in fig. 3, "GDYYBG001 to GDYYBG010" are all unique codes, and other data corresponding to the same line of the unique codes are compared with the table data in the ledger picture, and the comparison result is output.
In one embodiment, after the form picture to be identified is acquired, the method further comprises preprocessing the form picture to extract a form from the preprocessed form picture, wherein the preprocessing comprises at least one of binarization, inclination angle adjustment and background color adjustment.
Image binarization is a process of setting the gray value of a pixel point on an image to 0 or 255, that is, displaying a clear black-and-white effect on the whole image. Binarization of the image can greatly reduce the data amount in the image, so that the outline of the object can be highlighted. The inclination angle adjustment is to adjust the rotation angle of the form picture to be identified to be horizontal, the background color adjustment is to adjust the gradual change color of the form picture to be identified to be a color, or remove the watermark, and the accuracy of the form data identification in the picture can be further improved.
It can be seen that, in the embodiment of the present application, by acquiring a form picture to be identified, extracting form type features and all horizontal line and vertical line information from the picture, and determining horizontal line and vertical line threshold standards of a form in the picture according to the form type features; then, according to the transversal and longitudinal threshold criteria, determining transversal and longitudinal information of the table, and determining an intersection point information set of the table based on the transversal and longitudinal information of the table; and finally, determining the vertex information set of the outer frame of the table from the intersection point information set of the table, and extracting the table from the picture according to the vertex information of the outer frame of the table, so that the table in the picture can be further rapidly and accurately identified. Meanwhile, in the embodiment of the application, the data in each column of table is respectively extracted by dividing the table into a plurality of columns, then the reconstructed table file is generated by comparing the text ordinate values of a plurality of cells in the plurality of columns of sub-tables, finally the comparison table file is obtained, and the comparison table file and the reconstructed table file are compared according to the unique codes in the comparison table file, so that the efficiency and the accuracy of the table data identification in the picture and the accuracy of the comparison result can be improved.
It should be understood that the sequence number of each step in the foregoing embodiment does not mean that the execution sequence of each process should be determined by the function and the internal logic, and should not limit the implementation process of the embodiment of the present invention. Furthermore, the terms "include" and variations thereof are to be interpreted as open-ended terms that include, but are not limited to.
In an embodiment, a table identification device is provided, where the identification device corresponds to the table identification method in the above embodiment one by one. As shown in fig. 6, the identification device includes: a table picture acquisition module 201, a table horizontal and vertical line threshold determination module 202, a table horizontal and vertical line determination module 203, a table intersection information determination module 204, and a table extraction module 205. The functional modules are described in detail as follows:
form picture acquisition module 201: the method comprises the steps of obtaining a form picture to be identified, wherein the picture comprises the following steps: table and images outside the table.
Table horizontal-vertical line threshold determination module 202: and the method is used for extracting the form type characteristics and all the transverse line and longitudinal line information in the picture, and determining the transverse line and longitudinal line threshold standards of the form in the picture according to the form type characteristics.
Table horizontal and vertical line determination module 203: and the method is used for determining the transverse line and longitudinal line information of the table according to the transverse line and longitudinal line threshold standards.
Table intersection information determination module 204: and the intersection point information set is used for determining the table according to the transverse line information and the longitudinal line information.
The table extraction module 205: and the method is used for determining the vertex information set of the outer frame of the table according to the intersection point information set of the table, and extracting the table from the picture based on the vertex information set of the outer frame of the table.
In this embodiment, as shown in fig. 7, the identifying apparatus of fig. 6 may further include a table reconstruction module 301, a table comparison module 302, and a table picture preprocessing module 303, where the table reconstruction module 301 is configured to:
determining an intersection point information set of an upper frame and a lower frame of the table according to the intersection point information set of the table;
cutting the table according to the intersection point information set of the upper frame and the lower frame of the table to form a plurality of columns of sub-tables;
and sequentially extracting a plurality of cell information in each column of sub-table, and generating a reconstructed table file according to the cell information.
The table comparison module 302 is used for:
obtaining a comparison table file;
and comparing the comparison table file with the reconstructed table file according to the unique code in the comparison table file, and outputting a comparison result.
A table picture preprocessing module 303, configured to:
and preprocessing the picture, wherein the preprocessing comprises at least one of binarization, inclination angle adjustment and background color adjustment.
In the embodiment of the present application, a possible implementation manner is provided, where the table types include at least two types, and the table transverse and longitudinal line threshold determining module 202 is further configured to:
extracting form type characteristics in the picture, judging whether a form in the picture is a first type form, and if so, determining a transverse line threshold and a longitudinal line threshold of the form in the picture as a first type form standard;
otherwise, judging the types of the tables in the pictures in sequence until the horizontal line and vertical line threshold standards of the tables in the pictures are determined.
In an embodiment of the present application, a possible implementation manner is provided, where the intersection information includes: the table extraction module 205 is further configured to:
sequentially judging whether the horizontal coordinate value and the vertical coordinate value of the intersection point in the intersection point information set are minimum values, if so, determining that the intersection point is a first vertex of a table outer frame;
sequentially judging whether the abscissa value of the intersection point in the intersection point information set is the minimum value and whether the ordinate value of the intersection point is the maximum value, if so, determining that the intersection point is a second vertex of the outer frame of the table;
sequentially judging whether the abscissa value of the intersection point in the intersection point information set is the maximum value and whether the ordinate value of the intersection point is the minimum value, if so, determining that the intersection point is a third vertex of the outer frame of the table;
sequentially judging whether the horizontal coordinate value and the vertical coordinate value of the intersection point in the intersection point information set are the maximum values, and if so, determining that the intersection point is a fourth vertex of the outer frame of the table;
and extracting a table from the picture according to the first, second, third and fourth vertexes.
In an embodiment of the present application, a possible implementation manner is provided, where the cell information includes: the table rebuilding module 301 is further configured to:
sequentially extracting texts and text coordinate values of a plurality of cells in each column of sub-table, and determining a reference column sub-table in the plurality of columns of sub-tables according to the number of texts of the plurality of cells in each column of sub-table;
and generating a reconstructed table file according to the text coordinate values of the cells in the reference column sub-table.
The invention provides a recognition device of a form, which is characterized in that a form picture to be recognized is obtained, form type characteristics and all transverse line and longitudinal line information are extracted from the picture, and transverse line and longitudinal line threshold standards of the form in the picture are determined according to the form type characteristics; then, according to the transversal and longitudinal threshold criteria, determining transversal and longitudinal information of the table, and determining an intersection point information set of the table based on the transversal and longitudinal information of the table; and finally, determining the vertex information set of the outer frame of the table from the intersection point information set of the table, and extracting the table from the picture according to the vertex information of the outer frame of the table, so that the table in the picture can be further rapidly and accurately identified. Meanwhile, in the embodiment of the application, the data in each column of table is respectively extracted by dividing the table into a plurality of columns, then the reconstructed table file is generated by comparing the text ordinate values of a plurality of cells in the plurality of columns of sub-tables, finally the comparison table file is obtained, and the comparison table file and the reconstructed table file are compared according to the unique codes in the comparison table file, so that the efficiency and the accuracy of the table data identification in the picture and the accuracy of the comparison result can be improved.
For specific limitations of the identification means of the form, reference may be made to the above limitations of the identification method of the form, and no further description is given here. The respective modules in the identification means of the above-described table may be implemented in whole or in part by software, hardware, and a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, the internal structure of which may be as shown in FIG. 8. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface of the computer device is for communicating with an external server via a network connection. The computer program is executed by a processor to perform the functions or steps of a method of identifying a form.
In one embodiment, a computer device is provided comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the steps of when executing the computer program:
obtaining a form picture to be identified, wherein the picture comprises: a table and an image outside the table;
extracting form type features and all transverse line and longitudinal line information in the picture, and determining transverse line and longitudinal line threshold standards of the form in the picture according to the form type features;
determining the transverse line and longitudinal line information of the table according to the transverse line and longitudinal line threshold standards;
determining an intersection point information set of a table according to the horizontal line information and the vertical line information;
and determining the vertex information set of the outer frame of the table according to the intersection point information set of the table, and extracting the table from the picture based on the vertex information set of the outer frame of the table.
In one embodiment, a computer readable storage medium is provided, storing a computer program which when executed by a processor performs the steps of:
obtaining a form picture to be identified, wherein the picture comprises: a table and an image outside the table;
extracting form type features and all transverse line and longitudinal line information in the picture, and determining transverse line and longitudinal line threshold standards of the form in the picture according to the form type features;
determining the transverse line and longitudinal line information of the table according to the transverse line and longitudinal line threshold standards;
determining an intersection point information set of a table according to the horizontal line information and the vertical line information;
and determining the vertex information set of the outer frame of the table according to the intersection point information set of the table, and extracting the table from the picture based on the vertex information set of the outer frame of the table.
It should be noted that, the functions or steps that can be implemented by the computer readable storage medium or the computer device may correspond to the relevant descriptions in the foregoing method embodiments, and are not described herein for avoiding repetition.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the various embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), memory bus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions.
The above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention, and are intended to be included in the scope of the present invention.
Claims (10)
1. A method for identifying a form, comprising:
obtaining a form picture to be identified, wherein the picture comprises: a table and an image outside the table;
extracting form type features and all transverse line and longitudinal line information in the picture, and determining transverse line and longitudinal line threshold standards of the form in the picture according to the form type features;
determining the transverse line and longitudinal line information of the table according to the transverse line and longitudinal line threshold standards;
determining an intersection point information set of a table according to the horizontal line information and the vertical line information;
and determining the vertex information set of the outer frame of the table according to the intersection point information set of the table, and extracting the table from the picture based on the vertex information set of the outer frame of the table.
2. The method of claim 1, wherein the table type includes at least two types, wherein the extracting table type features and all horizontal and vertical line information in the picture, and determining horizontal and vertical line threshold criteria of a table in the picture according to the table type features, comprises:
extracting form type characteristics in the picture, judging whether a form in the picture is a first type form, and if so, determining a transverse line threshold and a longitudinal line threshold of the form in the picture as a first type form standard;
otherwise, judging the types of the tables in the pictures in sequence until the horizontal line and vertical line threshold standards of the tables in the pictures are determined.
3. The method of claim 1, wherein the intersection information comprises: and the abscissa and the ordinate of the intersection point, determining the vertex information set of the outer frame of the table according to the intersection point information set of the table, and extracting the table from the picture based on the vertex information set of the outer frame of the table, wherein the method comprises the following steps:
sequentially judging whether the horizontal coordinate value and the vertical coordinate value of the intersection point in the intersection point information set are minimum values, if so, determining that the intersection point is a first vertex of a table outer frame;
sequentially judging whether the abscissa value of the intersection point in the intersection point information set is the minimum value and whether the ordinate value of the intersection point is the maximum value, if so, determining that the intersection point is a second vertex of the outer frame of the table;
sequentially judging whether the abscissa value of the intersection point in the intersection point information set is the maximum value and whether the ordinate value of the intersection point is the minimum value, if so, determining that the intersection point is a third vertex of the outer frame of the table;
sequentially judging whether the horizontal coordinate value and the vertical coordinate value of the intersection point in the intersection point information set are the maximum values, and if so, determining that the intersection point is a fourth vertex of the outer frame of the table;
and extracting a table from the picture according to the first, second, third and fourth vertexes.
4. The method according to claim 1, wherein after determining the vertex information set of the table outline according to the intersection information set of the table, and extracting the table from the picture based on the vertex information set of the table outline, further comprises:
determining an intersection point information set of an upper frame and a lower frame of the table according to the intersection point information set of the table;
cutting the table according to the intersection point information set of the upper frame and the lower frame of the table to form a plurality of columns of sub-tables;
and sequentially extracting a plurality of cell information in each column of sub-table, and generating a reconstructed table file according to the cell information.
5. The method of claim 4, wherein the cell information comprises: the text and text coordinate values of the cells, extracting a plurality of cell information in each column of sub-tables in turn, and generating a reconstructed table file according to the cell information, including:
sequentially extracting texts and text coordinate values of a plurality of cells in each column of sub-table, and determining a reference column sub-table in the plurality of columns of sub-tables according to the number of texts of the plurality of cells in each column of sub-table;
and generating a reconstructed table file according to the text coordinate values of the cells in the reference column sub-table.
6. The method of claim 5, wherein after generating the reconstructed table file according to the text coordinate values of the plurality of cells in the reference column sub-table, further comprising:
obtaining a comparison table file;
and comparing the comparison table file with the reconstructed table file according to the unique code in the comparison table file, and outputting a comparison result.
7. The method according to any one of claims 1 to 6, further comprising, after the obtaining the form picture to be identified:
and preprocessing the picture, wherein the preprocessing comprises at least one of binarization, inclination angle adjustment and background color adjustment.
8. A form identification device, comprising:
a table picture acquisition module: the method comprises the steps of obtaining a form picture to be identified, wherein the picture comprises the following steps: a table and an image outside the table;
a table transverse and longitudinal line threshold value determining module: the method comprises the steps of extracting form type features and all transverse line and longitudinal line information in the picture, and determining transverse line and longitudinal line threshold standards of forms in the picture according to the form type features;
a table transverse and longitudinal line determining module: the method comprises the steps of determining transverse line information and longitudinal line information of a table according to the transverse line threshold standard and the longitudinal line threshold standard;
a table intersection point information determining module: the intersection point information set is used for determining a table according to the transverse line information and the longitudinal line information;
a table extraction module; and the method is used for determining the vertex information set of the outer frame of the table according to the intersection point information set of the table, and extracting the table from the picture based on the vertex information set of the outer frame of the table.
9. A storage medium having a computer program stored therein, wherein the computer program is configured to perform the method of any of claims 1 to 7 when run.
10. An electronic device comprising a processor and a memory, wherein the memory has stored therein a computer program, the processor being configured to run the computer program to perform the method of any of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310251922.9A CN116246293A (en) | 2023-03-15 | 2023-03-15 | Table identification method and device, storage medium and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310251922.9A CN116246293A (en) | 2023-03-15 | 2023-03-15 | Table identification method and device, storage medium and electronic equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116246293A true CN116246293A (en) | 2023-06-09 |
Family
ID=86627708
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310251922.9A Pending CN116246293A (en) | 2023-03-15 | 2023-03-15 | Table identification method and device, storage medium and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116246293A (en) |
-
2023
- 2023-03-15 CN CN202310251922.9A patent/CN116246293A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109492643B (en) | Certificate identification method and device based on OCR, computer equipment and storage medium | |
CN110059687B (en) | Picture information identification method, device, computer equipment and storage medium | |
US9892114B2 (en) | Methods and systems for efficient automated symbol recognition | |
US9633256B2 (en) | Methods and systems for efficient automated symbol recognition using multiple clusters of symbol patterns | |
CN113837151B (en) | Table image processing method and device, computer equipment and readable storage medium | |
US11106908B2 (en) | Techniques to determine document recognition errors | |
CN112417899A (en) | Character translation method, device, computer equipment and storage medium | |
CN111914805A (en) | Table structuring method and device, electronic equipment and storage medium | |
CN110647885A (en) | Test paper splitting method, device, equipment and medium based on picture identification | |
CN112418813A (en) | AEO qualification intelligent rating management system and method based on intelligent analysis and identification and storage medium | |
CN114049646B (en) | Bank card identification method and device, computer equipment and storage medium | |
CN116644729A (en) | Table file processing method, apparatus, computer device and storage medium | |
CN114332883A (en) | Invoice information identification method and device, computer equipment and storage medium | |
CN115131803A (en) | Document word size identification method and device, computer equipment and storage medium | |
CN114495146A (en) | Image text detection method and device, computer equipment and storage medium | |
CN116246293A (en) | Table identification method and device, storage medium and electronic equipment | |
CN114581923A (en) | Table image and corresponding annotation information generation method, device and storage medium | |
CN113868411A (en) | Contract comparison method and device, storage medium and computer equipment | |
US20220224801A1 (en) | Data embedding and data extraction in image | |
CN114170029A (en) | Data processing method and device, computer equipment and storage medium | |
CN110751140A (en) | Character batch recognition method and device and computer equipment | |
CN117314546B (en) | E-commerce product analysis method, system, medium and computer based on artificial intelligence | |
CN112749294B (en) | Page hidden text recognition method, device, computer equipment and storage medium | |
CN117648905B (en) | Method and related device for analyzing label instruction of thermal printer | |
CN115116060B (en) | Key value file processing method, device, equipment and medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |