CN111368638A - Spreadsheet creation method and device, computer equipment and storage medium - Google Patents

Spreadsheet creation method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN111368638A
CN111368638A CN202010084618.6A CN202010084618A CN111368638A CN 111368638 A CN111368638 A CN 111368638A CN 202010084618 A CN202010084618 A CN 202010084618A CN 111368638 A CN111368638 A CN 111368638A
Authority
CN
China
Prior art keywords
image
boundary line
structure information
actual cell
form image
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
Application number
CN202010084618.6A
Other languages
Chinese (zh)
Inventor
夏晓玲
万爽
陆昱
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Zhuiyi Technology Co Ltd
Original Assignee
Shenzhen Zhuiyi Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Shenzhen Zhuiyi Technology Co Ltd filed Critical Shenzhen Zhuiyi Technology Co Ltd
Priority to CN202010084618.6A priority Critical patent/CN111368638A/en
Publication of CN111368638A publication Critical patent/CN111368638A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/40Document-oriented image-based pattern recognition
    • G06V30/41Analysis of document content
    • G06V30/412Layout analysis of documents structured with printed lines or input boxes, e.g. business forms or tables
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/20Image enhancement or restoration by the use of local operators
    • G06T5/30Erosion or dilatation, e.g. thinning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/22Image preprocessing by selection of a specific region containing or referencing a pattern; Locating or processing of specific regions to guide the detection or recognition
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/26Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion
    • G06V10/267Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion by performing operations on regions, e.g. growing, shrinking or watersheds

Abstract

The application relates to a method and a device for creating a spreadsheet, a computer device and a storage medium. The method comprises the following steps: acquiring a form image to be input; performing image processing on the form image to obtain form structure information corresponding to the form image; the table structure information includes the size and location of each actual cell; performing character recognition on the form image to obtain character information corresponding to the form image; the text information comprises the text of each actual cell; and creating an electronic form based on the form structure information and the text information. The method is suitable for the forms with complex structures when the form images are converted into the electronic forms.

Description

Spreadsheet creation method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of image processing technologies, and in particular, to a method and an apparatus for creating a spreadsheet, a computer device, and a storage medium.
Background
With the development of science and technology, the document storage is often performed on paper forms in a manner of manual transcription into electronic forms. However, the manual form transcription is very heavy, and therefore, an automatic form transcription technology appears, which provides great help for people.
In the related art, the automatic transcription table technique generally inputs a table image into a neural network model, outputs a table recognition result, and then reconstructs an electronic table according to the table recognition result.
However, the neural network model is adopted for table recognition, a large amount of training data is needed, and manually marked training data is not easy to obtain; moreover, for a table with a complex structure, for example, when the table has split cells, merge cells, and the like, the training difficulty of the neural network model is increased.
Disclosure of Invention
In view of the above, it is necessary to provide a method, an apparatus, a computer device, and a storage medium for creating an electronic form that can be applied to a form having a complex structure.
A method of spreadsheet creation, the method comprising:
acquiring a form image to be input;
performing image processing on the table image to obtain table structure information corresponding to the table image; the table structure information includes the size and location of each actual cell;
carrying out character recognition on the form image to obtain character information corresponding to the form image; the character information comprises characters of each actual cell;
based on the table structure information and the text information, a spreadsheet is created.
In one embodiment, the performing image processing on the table image to obtain the table structure information corresponding to the table image includes:
carrying out binarization processing on the table image to obtain a binarized image;
carrying out image processing on the binary image to obtain a boundary line of a minimum-granularity cell;
analyzing a connected region of the binary image to obtain a boundary line of an actual cell;
and obtaining table structure information according to the boundary line of the minimum granularity cell and the boundary line of the actual cell.
In one embodiment, the image processing on the binarized image to obtain the boundary line of the minimum-granularity cell includes:
performing expansion processing and corrosion processing on the binary image to obtain intersection points of horizontal lines and vertical lines in the binary image;
projecting the intersection points in the horizontal direction to obtain the boundary line of the minimum granularity unit grid in the horizontal direction;
and projecting the intersection points in the vertical direction to obtain the boundary line of the minimum granularity unit grid in the vertical direction.
In one embodiment, the obtaining of the table structure information according to the boundary line of the minimum-granularity cell and the boundary line of the actual cell includes:
determining the number of rows and columns of the minimum granularity unit cells according to the boundary line of the minimum granularity unit cells;
and determining the number and the position of the minimum granularity cells occupied by each actual cell according to the boundary line of the actual cell to obtain the table structure information.
In one embodiment, the performing text recognition on the table image to obtain text information corresponding to the table image includes:
segmenting the table image according to the boundary line of the actual cell to obtain a plurality of segmented images;
and respectively inputting each segmented image into a pre-trained character recognition model to obtain characters corresponding to each actual cell.
In one embodiment, before performing the image processing on the form image to obtain the form structure information corresponding to the form image, the method further includes:
performing linear detection on the table image to obtain a plurality of straight lines in the table image and an included angle between each straight line and a reference coordinate axis;
calculating a target rotation angle according to the plurality of included angles;
and carrying out rotation processing on the form image according to the target rotation angle to obtain a corrected form image.
In one embodiment, the creating an electronic form based on the form structure information and the text information includes:
drawing a table frame according to the size and the position of each actual cell in the table structure information;
and filling according to the characters of each actual cell in the character information to obtain the electronic form.
An apparatus for creating a spreadsheet, the apparatus comprising:
the form image acquisition module is used for acquiring a form image to be recorded;
the table structure information acquisition module is used for carrying out image processing on the table image to obtain the table structure information corresponding to the table image; the table structure information includes the size and location of each actual cell;
the character information acquisition module is used for carrying out character recognition on the form image to obtain character information corresponding to the form image; the character information comprises characters of each actual cell;
and the electronic form creating module is used for creating the electronic form based on the form structure information and the character information.
In one embodiment, the table structure information obtaining module is specifically configured to perform binarization processing on the table image to obtain a binarized image; carrying out image processing on the binary image to obtain a boundary line of a minimum-granularity cell; analyzing a connected region of the binary image to obtain a boundary line of an actual cell; and obtaining table structure information according to the boundary line of the minimum granularity cell and the boundary line of the actual cell.
In one embodiment, the table structure information obtaining module is specifically configured to perform expansion processing and corrosion processing on the binary image to obtain intersection points of horizontal lines and vertical lines in the binary image; projecting the intersection points in the horizontal direction to obtain the boundary line of the minimum granularity unit grid in the horizontal direction; and projecting the intersection points in the vertical direction to obtain the boundary line of the minimum granularity unit grid in the vertical direction.
In one embodiment, the table structure information obtaining module is specifically configured to determine, according to a boundary line of the minimum-granularity cell, a number of rows and a number of columns of the minimum-granularity cell; and determining the number and the position of the minimum granularity cells occupied by each actual cell according to the boundary line of the actual cell to obtain the table structure information.
In one embodiment, the text information obtaining module is specifically configured to segment the form image according to the boundary line of the actual cell to obtain a plurality of segmented images; and respectively inputting each segmented image into a pre-trained character recognition model to obtain characters corresponding to each actual cell.
In one embodiment, the apparatus further comprises:
the correction module is used for carrying out linear detection on the form image to obtain a plurality of straight lines in the form image and an included angle between each straight line and a reference coordinate axis; calculating a target rotation angle according to the plurality of included angles; and carrying out rotation processing on the form image according to the target rotation angle to obtain a corrected form image.
In one embodiment, the spreadsheet creation module is specifically configured to draw a table border according to the size and position of each actual cell in the table structure information; and filling according to the characters of each actual cell in the character information to obtain the electronic form.
A computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
acquiring a form image to be input;
performing image processing on the table image to obtain table structure information corresponding to the table image; the table structure information includes the size and location of each actual cell;
carrying out character recognition on the form image to obtain character information corresponding to the form image; the character information comprises characters of each actual cell;
based on the table structure information and the text information, a spreadsheet is created.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
acquiring a form image to be input;
performing image processing on the table image to obtain table structure information corresponding to the table image; the table structure information includes the size and location of each actual cell;
carrying out character recognition on the form image to obtain character information corresponding to the form image; the character information comprises characters of each actual cell;
based on the table structure information and the text information, a spreadsheet is created.
The spreadsheet creating method, the spreadsheet creating device, the computer equipment and the storage medium acquire a spreadsheet image to be recorded; then, carrying out image processing on the table image to obtain table structure information corresponding to the table image; then, carrying out character recognition on the form image to obtain character information corresponding to the form image; finally, an electronic form is created based on the form structure information and the text information. According to the embodiment of the application, the table structure information is extracted from the table image, and the image processing is adopted, so that the method is suitable for tables with complex structures such as split cells and combined cells; the character information is extracted from the table image without a complex neural network model, so that the training difficulty of the neural network model is reduced.
Drawings
FIG. 1 is a diagram of an application environment of a method of creating a spreadsheet in one embodiment;
FIG. 2 is a flowchart illustrating a method of creating a spreadsheet according to one embodiment;
FIG. 3 is a flowchart illustrating the step of obtaining form structure information corresponding to a form image in one embodiment;
FIG. 4a is one of the schematic structural diagrams of a table in an embodiment;
FIG. 4b is a second exemplary table structure;
FIG. 4c is a third exemplary diagram of a table structure according to an embodiment;
FIG. 5 is a flowchart showing a spreadsheet creation method in another embodiment;
FIG. 6 is a block diagram showing the construction of an apparatus for creating an electronic form according to an embodiment;
FIG. 7 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The spreadsheet creation method provided by the application can be applied to the application environment shown in FIG. 1. The application environment may include a terminal 102, and the terminal 102 acquires a form image to be entered and creates a spreadsheet. The application environment may also include a server 104, where the server 104 obtains the form image to be entered and creates the spreadsheet. The application environment may also include a terminal 102 and a server 104, the terminal 102 and the server 104 communicating over a network, the terminal 102 determining a form image to be entered, the server 104 creating a spreadsheet. The terminal 102 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices, and the server 104 may be implemented by an independent server or a server cluster formed by a plurality of servers.
In one embodiment, as shown in fig. 2, a method for creating a spreadsheet is provided, which is exemplified by the application of the method to the server in fig. 1, and includes the following steps:
step 201, obtaining a form image to be recorded.
In the embodiment of the application, the paper form document can be converted into the form image to be recorded in a scanning or shooting mode and the like, and the form image contains the form to be created. The server acquiring the form image to be entered may specifically include: the method comprises the steps that a plurality of form images are stored in a terminal in advance, the terminal sends a form image to be recorded selected by a user to a server, and the server receives the form image to be recorded sent by the terminal; or, a plurality of form images are stored in the server in advance, the user selects the form image to be input through the terminal, and the server acquires the locally stored form image to be input according to the selection operation of the user. The embodiment of the present application does not specifically limit the acquisition manner, and may be set according to actual conditions.
Step 202, performing image processing on the form image to obtain form structure information corresponding to the form image; the table structure information includes the size and location of each actual cell.
In the embodiment of the application, the table in the table image contains lines and characters, and the characters comprise various characters such as Chinese characters, numbers and the like. After the form image is acquired, the form image may be subjected to image processing to remove characters in the form and only retain lines in the form. The image processing may adopt binarization processing, expansion processing, erosion processing, and the like, which is not limited in detail in the embodiment of the present application and may be set according to actual situations. After the lines in the table are obtained, the size and the position of each actual cell in the table image can be determined according to the coordinate positions of the lines, so that the table structure information corresponding to the table image is obtained.
Step 203, performing character recognition on the form image to obtain character information corresponding to the form image; the text information includes text for each actual cell.
In the embodiment of the application, after the form image is acquired, character recognition is performed on the form image. Specifically, the form image is divided according to the size and the position of the actual cell, and character recognition is performed on each divided actual cell to obtain characters of each actual cell, so that character information corresponding to the form image is obtained.
The character recognition is carried out on each actual cell, images of each actual cell can be input into the character recognition model trained in advance, and therefore the character recognition model does not need to recognize lines in the form images, the recognition speed can be improved, and the training difficulty of the character recognition model can be reduced.
Step 204, creating an electronic form based on the form structure information and the text information.
In the embodiment of the application, after the table structure information and the character information corresponding to the table image are obtained, a table frame is created according to the table structure information, and then character filling is performed according to the character information, so that the electronic table corresponding to the table image is obtained.
In the method for creating the electronic form, a form image to be recorded is obtained firstly; then, carrying out image processing on the table image to obtain table structure information corresponding to the table image; then, carrying out character recognition on the form image to obtain character information corresponding to the form image; finally, an electronic form is created based on the form structure information and the text information. According to the embodiment of the application, the table structure information is extracted from the table image, and the image processing is adopted, so that the method is suitable for tables with complex structures such as split cells and combined cells; the character information is extracted from the table image without a complex neural network model, so that the training difficulty of the neural network model is reduced.
In an embodiment, as shown in fig. 3, the step of performing image processing on the table image to obtain the table structure information corresponding to the table image may specifically include the following steps:
and 301, performing binarization processing on the table image to obtain a binarized image.
In this embodiment of the application, the binarization processing may be performed on the table image by using a global threshold, that is, the same threshold is used for the binarization processing on the table image, if the pixel value is greater than the threshold, the pixel value is set to a first value, if the pixel value is not greater than the threshold, the pixel value is set to a second value, and the binarized image is obtained according to the reset pixel value. Optionally, the global threshold is a mean of pixel values in the table image, the first value corresponds to black, and the second value corresponds to white. The embodiment of the present application does not limit this in detail, and can be set according to actual situations.
However, if the illumination is uneven, the binary image obtained by using the global threshold value has poor effect. Therefore, an adaptive threshold value can be adopted, that is, when the binarization processing is performed on the table image, the threshold value adopted by each pixel point is different, if the pixel value is greater than the threshold value corresponding to the pixel point, the pixel value is set to be a first value, if the pixel value is less than the threshold value corresponding to the pixel point, the pixel value is set to be a second value, and finally, the binarization image is obtained according to the reset pixel value. The threshold value for comparing each pixel point is determined according to the pixel value of the pixel point and the pixel value of the adjacent pixel point.
And step 302, carrying out image processing on the binary image to obtain the boundary line of the minimum-granularity unit cell.
In the embodiment of the present application, the minimum-granularity cell refers to a unit cell in the spreadsheet to be created. The image processing of the binarized image may include: performing expansion processing and corrosion processing on the binary image to obtain intersection points of horizontal lines and vertical lines in the binary image; projecting the intersection points in the horizontal direction to obtain the boundary line of the minimum granularity unit grid in the horizontal direction; and projecting the intersection points in the vertical direction to obtain the boundary line of the minimum granularity unit grid in the vertical direction.
Specifically, the binarized image includes lines in a table, and the lines are expanded, so that lines in the same horizontal line are connected with each other to obtain horizontal lines in the binarized image, and lines in the same vertical line are connected with each other to obtain vertical lines in the binarized image. And then, carrying out corrosion treatment on the expanded binary image to corrode characters in the table and only keep lines in the table. At this time, the intersection of the horizontal line and the vertical line in the binarized image can be obtained, referring to the table shown in fig. 4 a. Then, dividing the minimum granularity unit grids according to the intersection points, namely performing horizontal projection on each intersection point to obtain a boundary line of the minimum granularity unit grids in the horizontal direction; and projecting each intersection point in the vertical direction to obtain the boundary line of the minimum granularity unit grid in the vertical direction. .
The intersection points in the form image are obtained, the minimum granularity cells are divided according to the intersection points, original lines in the form image are not relied on, and the frame of the spreadsheet to be created can be smoother and more standard.
And 303, analyzing the connected region of the binary image to obtain the boundary line of the actual cell.
In the embodiment of the application, split cells or merged cells may exist in the form image, and therefore, the boundary line of the actual cell may not overlap with the boundary line of the minimum-granularity cell. And analyzing the connected region of the binary image, and detecting the connected region in the binary image so as to obtain the boundary line of the actual cell.
The Connected Component refers to an image area (Blob) formed by foreground pixels having the same pixel value and adjacent positions in the image. And the analysis of the connected region of the binary image is to find out the white connected region in the binary image and mark the white connected region. The connected region analysis can adopt a Two-Pass scanning (Two-Pass) method or a Seed-Filling (Seed-Filling) method, which is not limited in detail in the embodiment of the application and can be selected according to the actual situation.
And step 304, obtaining table structure information according to the boundary line of the minimum granularity cell and the boundary line of the actual cell.
In the embodiment of the application, after the boundary line of the minimum-granularity cell and the boundary line of the actual cell are obtained, the row number and the column number of the minimum-granularity cell are determined according to the boundary line of the minimum-granularity cell, and each minimum-granularity cell can be numbered by referring to the table shown in fig. 4 b; determining the number and the position of the minimum granularity cells occupied by each actual cell according to the boundary line of the actual cells, and referring to the table shown in fig. 4 c; and finally, obtaining the table structure information.
For example, as shown in fig. 4c, the number of rows of the minimum-granularity cells is determined to be 3 rows and the number of columns is determined to be 5 columns according to the boundary lines of the minimum-granularity cells; and determining that the first actual cell occupies the first column and the second column in the first row of the minimum-granularity cells and the first column and the second column in the second row of the minimum-granularity cells according to the boundary line of the actual cells, wherein the rest actual cells all occupy one minimum-granularity cell. Thus, table structure information corresponding to the table image can be obtained.
In the step of performing image processing on the form image to obtain the form structure information corresponding to the form image, performing binarization processing on the form image to obtain a binarization image; carrying out image processing on the binary image to obtain a boundary line of a minimum-granularity cell; analyzing a connected region of the binary image to obtain a boundary line of an actual cell; and obtaining table structure information according to the boundary line of the minimum granularity cell and the boundary line of the actual cell. According to the embodiment of the application, the form structure information is extracted from the form image in an image processing mode, a complex neural network model does not need to be trained, and the time and labor for manual marking are saved; and also to tables of complex structure.
In one embodiment, as shown in fig. 5, on the basis of the above embodiment, the method for creating a spreadsheet may further include the following steps:
step 401, obtaining a form image to be recorded.
Step 402, performing straight line detection on the form image to obtain a plurality of straight lines in the form image and an included angle between each straight line and a reference coordinate axis; calculating a target rotation angle according to the plurality of included angles; and carrying out rotation processing on the form image according to the target rotation angle to obtain a corrected form image.
In the embodiment of the application, the paper form document is converted into the form image through scanning or shooting and the like, and in the conversion process, part of lines in the paper form document may rotate at a certain angle. Therefore, before the binarization processing is performed on the table image, the angle correction needs to be performed on the table image.
Specifically, performing straight line detection on the form image to obtain a plurality of straight lines in the form image; and calculating the included angle between each straight line and the reference coordinate axis according to the preset reference coordinate axis. For example, it is detected that the horizontal line 1 in the form image has an angle of 10 ° with the x-axis in the horizontal direction. The line detection can adopt a Hough (Hough) detection algorithm, and the embodiment of the application does not limit the line detection in detail and can be set according to actual conditions.
And after the included angles between all the straight lines and the reference coordinate axis are obtained, counting the included angles with the largest number, and determining the target rotation angle of the table image rotation according to the included angles with the largest number. For example, the largest number of included angles is counted as 10 °, and the target rotation angle of the form image is determined to be rotated counterclockwise by 10 °.
And after the target rotation angle is determined, performing rotation processing on the table image according to the target rotation angle to obtain a corrected table image.
Step 403, performing binarization processing on the table image to obtain a binarized image; carrying out image processing on the binary image to obtain a boundary line of a minimum-granularity cell; analyzing a connected region of the binary image to obtain a boundary line of an actual cell; and obtaining table structure information according to the boundary line of the minimum granularity cell and the boundary line of the actual cell.
In the embodiment of the application, the corrected form image is subjected to self-adaptive binarization processing to obtain a binarized image, then the boundary line of the minimum granularity cell and the boundary line of the actual cell are obtained according to the binarized image, and finally the form structure information is obtained according to the boundary line of the minimum granularity cell and the boundary line of the actual cell.
In one embodiment, the binary image is subjected to expansion processing and corrosion processing to obtain intersection points of horizontal lines and vertical lines in the binary image; projecting the intersection points in the horizontal direction to obtain the boundary line of the minimum granularity unit grid in the horizontal direction; and projecting the intersection points in the vertical direction to obtain the boundary line of the minimum granularity unit grid in the vertical direction.
In one embodiment, the number of rows and the number of columns of the minimum-granularity unit cells are determined according to the boundary line of the minimum-granularity unit cells; and determining the number and the position of the minimum granularity cells occupied by each actual cell according to the boundary line of the actual cell to obtain the table structure information.
Step 404, segmenting the form image according to the boundary lines of the actual cells to obtain a plurality of segmented images; and respectively inputting each segmented image into a pre-trained character recognition model to obtain characters corresponding to each actual cell.
In the embodiment of the application, after the boundary line of the actual cell is obtained, the form image is segmented according to the boundary line of the actual cell, and the segmented image corresponding to each actual cell is obtained. Then, each piece of the divided image data is put into a character recognition model trained in advance, and the character recognition model outputs characters corresponding to each actual cell.
Step 405, drawing a table frame according to the size and the position of each actual cell in the table structure information; and filling according to the characters of each actual cell in the character information to obtain the electronic form.
In the embodiment of the application, after the boundary line of each actual cell is obtained, the table frame is drawn according to the size and the position of each actual cell. And then filling the corresponding characters of each real cell into the corresponding real cells, thereby obtaining the electronic table.
In the method for creating the electronic form, the form image to be recorded is obtained first, and then the form image is subjected to angle correction; then, carrying out image processing and connected region detection on the table image after the angle correction to obtain table structure information corresponding to the table image; then, carrying out character recognition on the table image after the angle correction to obtain character information corresponding to the table image; and finally, creating the electronic form according to the form structure information and the character information. According to the embodiment of the application, in the process of converting the form image into the electronic form, a complex neural network model does not need to be created, so that the time and the labor for manual labeling can be saved, and the method is also suitable for the form with a complex structure.
It should be understood that although the various steps in the flowcharts of fig. 2-5 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2-5 may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed in turn or alternately with other steps or at least some of the other steps or stages.
In one embodiment, as shown in fig. 6, there is provided an apparatus for creating a spreadsheet, including:
a form image obtaining module 501, configured to obtain a form image to be entered;
a table structure information obtaining module 502, configured to perform image processing on the table image to obtain table structure information corresponding to the table image; the table structure information includes the size and location of each actual cell;
a text information obtaining module 503, configured to perform text recognition on the form image to obtain text information corresponding to the form image; the character information comprises characters of each actual cell;
a spreadsheet creation module 504 for creating a spreadsheet based on the table structure information and the textual information.
In one embodiment, the table structure information obtaining module 502 is specifically configured to perform binarization processing on the table image to obtain a binarized image; carrying out image processing on the binary image to obtain a boundary line of a minimum-granularity cell; analyzing a connected region of the binary image to obtain a boundary line of an actual cell; and obtaining table structure information according to the boundary line of the minimum granularity cell and the boundary line of the actual cell.
In one embodiment, the table structure information obtaining module 502 is specifically configured to perform expansion processing and corrosion processing on the binarized image to obtain intersection points of horizontal lines and vertical lines in the binarized image; projecting the intersection points in the horizontal direction to obtain the boundary line of the minimum granularity unit grid in the horizontal direction; and projecting the intersection points in the vertical direction to obtain the boundary line of the minimum granularity unit grid in the vertical direction.
In one embodiment, the table structure information obtaining module 502 is specifically configured to determine the number of rows and the number of columns of the minimum-granularity cell according to the boundary line of the minimum-granularity cell; and determining the number and the position of the minimum granularity cells occupied by each actual cell according to the boundary line of the actual cell to obtain the table structure information.
In one embodiment, the text information obtaining module 503 is specifically configured to segment the form image according to the boundary line of the actual cell to obtain a plurality of segmented images; and respectively inputting each segmented image into a pre-trained character recognition model to obtain characters corresponding to each actual cell.
In one embodiment, the apparatus further comprises:
the correction module is used for carrying out linear detection on the form image to obtain a plurality of straight lines in the form image and an included angle between each straight line and a reference coordinate axis; calculating a target rotation angle according to the plurality of included angles; and carrying out rotation processing on the form image according to the target rotation angle to obtain a corrected form image.
In one embodiment, the spreadsheet creating module 504 is specifically configured to draw a table frame according to the size and position of each actual cell in the table structure information; and filling according to the characters of each actual cell in the character information to obtain the electronic form.
For specific limitations of the device for creating the electronic form, reference may be made to the above limitations of the method for creating the electronic form, which are not described herein again. The respective modules in the above-described spreadsheet creation apparatus may be wholly or partially implemented by software, hardware, and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 7. The computer device includes a processor, a memory, and a network interface 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 comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used for storing the creation data of the spreadsheet. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a spreadsheet creation method.
Those skilled in the art will appreciate that the architecture shown in fig. 7 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
acquiring a form image to be input;
performing image processing on the table image to obtain table structure information corresponding to the table image; the table structure information includes the size and location of each actual cell;
carrying out character recognition on the form image to obtain character information corresponding to the form image; the character information comprises characters of each actual cell;
based on the table structure information and the text information, a spreadsheet is created.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
carrying out binarization processing on the table image to obtain a binarized image;
carrying out image processing on the binary image to obtain a boundary line of a minimum-granularity cell;
analyzing a connected region of the binary image to obtain a boundary line of an actual cell;
and obtaining table structure information according to the boundary line of the minimum granularity cell and the boundary line of the actual cell.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
performing expansion processing and corrosion processing on the binary image to obtain intersection points of horizontal lines and vertical lines in the binary image;
projecting the intersection points in the horizontal direction to obtain the boundary line of the minimum granularity unit grid in the horizontal direction;
and projecting the intersection points in the vertical direction to obtain the boundary line of the minimum granularity unit grid in the vertical direction.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
determining the number of rows and columns of the minimum granularity unit cells according to the boundary line of the minimum granularity unit cells;
and determining the number and the position of the minimum granularity cells occupied by each actual cell according to the boundary line of the actual cell to obtain the table structure information.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
segmenting the table image according to the boundary line of the actual cell to obtain a plurality of segmented images;
and respectively inputting each segmented image into a pre-trained character recognition model to obtain characters corresponding to each actual cell.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
performing linear detection on the table image to obtain a plurality of straight lines in the table image and an included angle between each straight line and a reference coordinate axis;
calculating a target rotation angle according to the plurality of included angles;
and carrying out rotation processing on the form image according to the target rotation angle to obtain a corrected form image.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
drawing a table frame according to the size and the position of each actual cell in the table structure information;
and filling according to the characters of each actual cell in the character information to obtain the electronic form.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
acquiring a form image to be input;
performing image processing on the table image to obtain table structure information corresponding to the table image; the table structure information includes the size and location of each actual cell;
carrying out character recognition on the form image to obtain character information corresponding to the form image; the character information comprises characters of each actual cell;
based on the table structure information and the text information, a spreadsheet is created.
In one embodiment, the computer program when executed by the processor further performs the steps of:
carrying out binarization processing on the table image to obtain a binarized image;
carrying out image processing on the binary image to obtain a boundary line of a minimum-granularity cell;
analyzing a connected region of the binary image to obtain a boundary line of an actual cell;
and obtaining table structure information according to the boundary line of the minimum granularity cell and the boundary line of the actual cell.
In one embodiment, the computer program when executed by the processor further performs the steps of:
performing expansion processing and corrosion processing on the binary image to obtain intersection points of horizontal lines and vertical lines in the binary image;
projecting the intersection points in the horizontal direction to obtain the boundary line of the minimum granularity unit grid in the horizontal direction;
and projecting the intersection points in the vertical direction to obtain the boundary line of the minimum granularity unit grid in the vertical direction.
In one embodiment, the computer program when executed by the processor further performs the steps of:
determining the number of rows and columns of the minimum granularity unit cells according to the boundary line of the minimum granularity unit cells;
and determining the number and the position of the minimum granularity cells occupied by each actual cell according to the boundary line of the actual cell to obtain the table structure information.
In one embodiment, the computer program when executed by the processor further performs the steps of:
segmenting the table image according to the boundary line of the actual cell to obtain a plurality of segmented images;
and respectively inputting each segmented image into a pre-trained character recognition model to obtain characters corresponding to each actual cell.
In one embodiment, the computer program when executed by the processor further performs the steps of:
performing linear detection on the table image to obtain a plurality of straight lines in the table image and an included angle between each straight line and a reference coordinate axis;
calculating a target rotation angle according to the plurality of included angles;
and carrying out rotation processing on the form image according to the target rotation angle to obtain a corrected form image.
In one embodiment, the computer program when executed by the processor further performs the steps of:
drawing a table frame according to the size and the position of each actual cell in the table structure information;
and filling according to the characters of each actual cell in the character information to obtain the electronic form.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database or other medium used in the embodiments provided herein can include at least one of non-volatile and volatile memory. Non-volatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical storage, or the like. Volatile Memory can include Random Access Memory (RAM) or external cache Memory. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A method of spreadsheet creation, said method comprising:
acquiring a form image to be input;
performing image processing on the form image to obtain form structure information corresponding to the form image; the table structure information includes the size and location of each actual cell;
performing character recognition on the form image to obtain character information corresponding to the form image; the text information comprises the text of each actual cell;
and creating an electronic form based on the form structure information and the text information.
2. The method of claim 1, wherein the image processing the form image to obtain form structure information corresponding to the form image comprises:
carrying out binarization processing on the form image to obtain a binarization image;
carrying out image processing on the binary image to obtain a boundary line of a minimum-granularity unit cell;
analyzing a connected region of the binary image to obtain a boundary line of an actual cell;
and obtaining the table structure information according to the boundary line of the minimum granularity cell and the boundary line of the actual cell.
3. The method according to claim 2, wherein said image processing said binarized image to obtain boundary lines of minimum-granularity cells comprises:
performing expansion processing and corrosion processing on the binary image to obtain intersection points of horizontal lines and vertical lines in the binary image;
projecting the intersection points in the horizontal direction to obtain the boundary line of the minimum granularity unit grid in the horizontal direction;
and projecting the intersection points in the vertical direction to obtain the boundary line of the minimum granularity unit grid in the vertical direction.
4. The method according to claim 3, wherein obtaining the table structure information according to the boundary line of the minimum-granularity cell and the boundary line of the actual cell comprises:
determining the number of rows and the number of columns of the minimum granularity unit cells according to the boundary line of the minimum granularity unit cells;
and determining the number and the position of the minimum granularity cells occupied by each actual cell according to the boundary line of the actual cell to obtain the table structure information.
5. The method of claim 2, wherein the performing text recognition on the form image to obtain text information corresponding to the form image comprises:
segmenting the form image according to the boundary line of the actual cell to obtain a plurality of segmented images;
and respectively inputting each segmented image into a pre-trained character recognition model to obtain characters corresponding to each actual cell.
6. The method of claim 1, wherein prior to said image processing the form image to obtain form structure information corresponding to the form image, the method further comprises:
performing linear detection on the form image to obtain a plurality of straight lines in the form image and an included angle between each straight line and a reference coordinate axis;
calculating a target rotation angle according to the included angles;
and carrying out rotation processing on the form image according to the target rotation angle to obtain a corrected form image.
7. The method of any of claims 1-6, wherein creating a spreadsheet based on the table structure information and the textual information comprises:
drawing a table frame according to the size and the position of each actual cell in the table structure information;
and filling according to the characters of each actual cell in the character information to obtain the electronic form.
8. An apparatus for creating a spreadsheet, the apparatus comprising:
the form image acquisition module is used for acquiring a form image to be recorded;
the table structure information acquisition module is used for carrying out image processing on the table image to obtain the table structure information corresponding to the table image; the table structure information includes the size and location of each actual cell;
the character information obtaining module is used for carrying out character recognition on the form image to obtain character information corresponding to the form image; the text information comprises the text of each actual cell;
and the electronic form creating module is used for creating an electronic form based on the form structure information and the character information.
9. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of the method of any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN202010084618.6A 2020-02-10 2020-02-10 Spreadsheet creation method and device, computer equipment and storage medium Pending CN111368638A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010084618.6A CN111368638A (en) 2020-02-10 2020-02-10 Spreadsheet creation method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010084618.6A CN111368638A (en) 2020-02-10 2020-02-10 Spreadsheet creation method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN111368638A true CN111368638A (en) 2020-07-03

Family

ID=71208009

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010084618.6A Pending CN111368638A (en) 2020-02-10 2020-02-10 Spreadsheet creation method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111368638A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111985506A (en) * 2020-08-21 2020-11-24 广东电网有限责任公司清远供电局 Chart information extraction method and device and storage medium
CN112036365A (en) * 2020-09-15 2020-12-04 中国工商银行股份有限公司 Information importing method and device, and image processing method and device
CN112149506A (en) * 2020-08-25 2020-12-29 北京来也网络科技有限公司 Table generation method, apparatus and storage medium in image combining RPA and AI
CN112241730A (en) * 2020-11-21 2021-01-19 杭州投知信息技术有限公司 Form extraction method and system based on machine learning
CN112733518A (en) * 2021-01-14 2021-04-30 卫宁健康科技集团股份有限公司 Table template generation method, device, equipment and storage medium
CN113688795A (en) * 2021-09-27 2021-11-23 上海合合信息科技股份有限公司 Method and device for converting table in image into electronic table
CN114627482A (en) * 2022-05-16 2022-06-14 四川升拓检测技术股份有限公司 Method and system for realizing table digital processing based on image processing and character recognition

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109726643A (en) * 2018-12-13 2019-05-07 北京金山数字娱乐科技有限公司 The recognition methods of form data, device, electronic equipment and storage medium in image
CN110334585A (en) * 2019-05-22 2019-10-15 平安科技(深圳)有限公司 Table recognition method, apparatus, computer equipment and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109726643A (en) * 2018-12-13 2019-05-07 北京金山数字娱乐科技有限公司 The recognition methods of form data, device, electronic equipment and storage medium in image
CN110334585A (en) * 2019-05-22 2019-10-15 平安科技(深圳)有限公司 Table recognition method, apparatus, computer equipment and storage medium

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111985506A (en) * 2020-08-21 2020-11-24 广东电网有限责任公司清远供电局 Chart information extraction method and device and storage medium
WO2022036997A1 (en) * 2020-08-21 2022-02-24 广东电网有限责任公司清远供电局 Chart information extraction method and apparatus, and storage medium
CN112149506A (en) * 2020-08-25 2020-12-29 北京来也网络科技有限公司 Table generation method, apparatus and storage medium in image combining RPA and AI
CN112036365A (en) * 2020-09-15 2020-12-04 中国工商银行股份有限公司 Information importing method and device, and image processing method and device
CN112241730A (en) * 2020-11-21 2021-01-19 杭州投知信息技术有限公司 Form extraction method and system based on machine learning
CN112733518A (en) * 2021-01-14 2021-04-30 卫宁健康科技集团股份有限公司 Table template generation method, device, equipment and storage medium
CN113688795A (en) * 2021-09-27 2021-11-23 上海合合信息科技股份有限公司 Method and device for converting table in image into electronic table
CN114627482A (en) * 2022-05-16 2022-06-14 四川升拓检测技术股份有限公司 Method and system for realizing table digital processing based on image processing and character recognition
CN114627482B (en) * 2022-05-16 2022-08-12 四川升拓检测技术股份有限公司 Method and system for realizing table digital processing based on image processing and character recognition

Similar Documents

Publication Publication Date Title
CN111368638A (en) Spreadsheet creation method and device, computer equipment and storage medium
CN111401371B (en) Text detection and identification method and system and computer equipment
CN109241904B (en) Character recognition model training, character recognition method, device, equipment and medium
CN108960229B (en) Multidirectional character detection method and device
CN107886082B (en) Method and device for detecting mathematical formulas in images, computer equipment and storage medium
CN110866529A (en) Character recognition method, character recognition device, electronic equipment and storage medium
CN111353489A (en) Text image processing method and device, computer equipment and storage medium
CN111814905A (en) Target detection method, target detection device, computer equipment and storage medium
CN110210480B (en) Character recognition method and device, electronic equipment and computer readable storage medium
JP2019102061A (en) Text line segmentation method
CN112926421B (en) Image processing method and device, electronic equipment and storage medium
JP2019102061A5 (en)
CN113469092B (en) Character recognition model generation method, device, computer equipment and storage medium
KR20220093187A (en) Positioning method and apparatus, electronic device, computer readable storage medium
CN110909665A (en) Multitask image processing method and device, electronic equipment and storage medium
CN111104883A (en) Job answer extraction method, device, equipment and computer readable storage medium
CN110796663B (en) Picture clipping method, device, equipment and storage medium
CN113034514A (en) Sky region segmentation method and device, computer equipment and storage medium
CN111209908A (en) Method and device for updating label box, storage medium and computer equipment
CN113537184A (en) OCR (optical character recognition) model training method and device, computer equipment and storage medium
CN112926564A (en) Picture analysis method, system, computer device and computer-readable storage medium
CN115620315A (en) Handwritten text detection method, device, server and storage medium
US11481881B2 (en) Adaptive video subsampling for energy efficient object detection
CN114005052A (en) Target detection method and device for panoramic image, computer equipment and storage medium
CN111079756B (en) Form extraction and reconstruction method and equipment in receipt image

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