CN114862753A - Automatic high-precision table correction method and system - Google Patents

Automatic high-precision table correction method and system Download PDF

Info

Publication number
CN114862753A
CN114862753A CN202210264861.5A CN202210264861A CN114862753A CN 114862753 A CN114862753 A CN 114862753A CN 202210264861 A CN202210264861 A CN 202210264861A CN 114862753 A CN114862753 A CN 114862753A
Authority
CN
China
Prior art keywords
binary image
rectangular
rectangular frame
intersection points
frame
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
CN202210264861.5A
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.)
Beijing Mengcheng Technology Co ltd
Original Assignee
Beijing Mengcheng 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 Beijing Mengcheng Technology Co ltd filed Critical Beijing Mengcheng Technology Co ltd
Priority to CN202210264861.5A priority Critical patent/CN114862753A/en
Publication of CN114862753A publication Critical patent/CN114862753A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • 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
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30176Document
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Abstract

The invention provides an automatic high-precision table correction method and system. The method comprises the following steps: and positioning the intersection points generated by the grid lines of the table in a precise line finding mode, and defining the intersection points as corner points. And the projection transformation is carried out by taking the reference point as the reference point to correct the form deformation. According to the scheme provided by the invention, when a large table is identified, the cell identification dislocation can be caused by slight deformation of the table, and adverse effects are caused on subsequent information arrangement and analysis. The invention can automatically correct the form deformation in a pixel level, and the time consumption is little, and the pictures of 4000 x 4000 can be controlled within 200 ms. And can be normally identified and corrected if the grid lines have slight curves. Meanwhile, the method has good effect on incomplete tables.

Description

Automatic high-precision table correction method and system
Technical Field
The invention belongs to the field of picture table identification, and particularly relates to an automatic high-precision table correction method and system.
Background
Form correction is one of the processes of picture form identification.
The picture table identification means that a picture with a table image is input into an identification system, the identification system automatically identifies cell information and character information in the cell, and the identified information is structurally output. The working process comprises the following steps:
1) reading pictures
2) Extraction grid line
3) Cutting the picture according to the grid lines, and respectively identifying the text by using a character recognition technology
4) Combining the ruled line data and the text data to form structured table data
Before extracting the ruled lines, the picture needs to be processed, and the picture is stretched into a state that the table content is horizontal and vertical, so that the negative influence caused by the inclination or deformation of the table image is eliminated. This process is called form correction. The stretching process performed on the picture is called picture transformation.
In the prior art, the adopted technology is as follows:
1) and (3) manual frame selection and correction:
on the product application level, a function of manually selecting a table by a user is added, the user prevents 4 dragging points from being placed at 4 corner points of the table in a picture, and then the picture correction module carries out conversion according to the information of the 4 dragging points.
2) Contour line extraction and correction:
and extracting contour lines from the picture, judging whether the maximum contour line conforms to the rectangular characteristics, and if so, extracting 4 corner points of the contour as reference points. And carrying out transformation operation to achieve the purpose of correction.
3) And (3) Hough line rotation correction:
and (4) applying Hough transform algorithm to extract transverse lines in the picture, and calculating the average angle of all the transverse lines. And then two-dimensional rotation correction is carried out according to the average angle.
The defects of the prior art are as follows:
1) and (3) manual frame selection and correction:
the user's operation cannot achieve higher accuracy and cannot be applied to a larger form. And the operation is time-consuming and labor-consuming, and the batch treatment cannot be realized.
2) Contour line extraction and correction:
the outline is extracted from the outermost edge of the edge line of the table in the picture, and is easily influenced by the line thickness, the completeness of the line and the like. Moreover, most forms have header, page number and other information, and if the information is close to the form, the information is also contained in the contour line, so that the corner points cannot be extracted or the position of the corner points is wrong. Meanwhile, the mode cannot identify the local part of the table and only can identify the complete table, and the application scene is limited.
3) And (3) Hough line rotation correction:
the anti-interference capability is poor, the extraction of hough lines depends on the centralized distribution of picture pixels, and if more elements exist in a picture, interference is caused, so that the deviation exists between the average angle and the actual table angle.
The perspective deformation cannot be corrected. The angular points of the table cannot be found only by Hough transform, so that only rotation correction can be carried out, and perspective deformation cannot be repaired.
Disclosure of Invention
In order to solve the above technical problems, the present invention provides a technical solution of an automatic high-precision table correction method and system, so as to solve the above technical problems.
The invention discloses an automatic high-precision table correction method in a first aspect, which comprises the following steps:
step S1, converting the original picture of the table into a binary image;
step S2, extracting frame information in the binary image by applying a projective transformation method, and fitting the frame into a rectangular frame to obtain a rectangular frame binary image;
step S3, extracting the outermost vertical line in the rectangular frame binary image by using a feature extraction method;
step S4, extracting the outermost transverse line in the rectangular frame binary image by using a feature extraction method;
step S5, calculating the intersection points of the horizontal lines on the outermost side and the vertical lines on the outermost side, and intersecting every two lines to obtain 4 intersection points which are regarded as the corner points of the table;
step S6, circularly comparing the 4 intersection points, calculating whether the difference value of the x coordinate or the y coordinate of the current point and the previous point is greater than a first preset value, and if so, determining that correction is needed;
and step S7, correcting the intersection points needing to be corrected by applying a projective transformation method.
According to the method of the first aspect of the present invention, in step S2, the applying a projective transformation method to extract the frame information in the binary image, and fitting the frame to a rectangular frame, wherein the specific method for obtaining the rectangular frame binary image includes:
s2.1, extracting frame information in the binary image by using a projection transformation method, obtaining the largest one of the frame information, and taking the largest one as a frame of the table main body;
and S2.2, fitting the frame information which is the coordinates of a group of points into a rectangular frame.
According to the method of the first aspect of the present invention, in step S2, the applying a projective transformation method to extract border information in the binary image, and fitting a border to a rectangular frame, so as to obtain a rectangular frame binary image further includes:
and S2.3, if the angle of the rectangular frame is larger than a second preset value, performing rotation operation and correcting the rotation angle.
According to the method of the first aspect of the present invention, in step S3, the specific method for extracting the outermost vertical line in the rectangular-frame binary image by using the feature extraction method includes:
s3.1, removing a transverse line in the rectangular frame binary image through transverse corrosion and expansion operation;
s3.2, finding a vertical line existing in the rectangular frame binary image without the horizontal line by using a probabilistic Hough line detection method;
and S3.3, combining the vertical lines.
Method according to the first aspect of the present invention, in step S4, the specific method for extracting the outermost horizontal line in the rectangular-frame binary image using the feature extraction method includes:
s4.1, removing vertical lines in the rectangular frame binary image through longitudinal corrosion and expansion operation;
s4.2, finding a transverse line existing in the rectangular frame binary image without the vertical line by using a probabilistic Hough line detection method;
and S4.3, combining the transverse lines.
In step S4, before finding the horizontal line existing in the rectangular frame binary image with the vertical line removed by using the probabilistic hough line detection method, the specific method for extracting the outermost horizontal line in the rectangular frame binary image by using the feature extraction method further includes:
and circularly cutting out slices with the height of a third preset value from the rectangular frame binary image without the vertical lines, wherein the slicing circulation needs to be carried out in two groups, one group is from top to bottom, and the other group is from bottom to top.
According to the method of the first aspect of the present invention, in step S7, the specific method for applying the projective transformation method to correct the intersection point needing to be corrected includes:
s7.1, acquiring a mapping relation matrix according to the coordinates of the 4 intersection points required to be corrected and the coordinates of the intersection points expected to be corrected;
and S7.2, correcting the 4 intersection points needing to be corrected according to the mapping relation matrix.
In a second aspect, the present invention discloses an automatic high-precision form correction system, comprising:
a first processing module configured to convert an original picture of a table into a binary image;
the second processing module is configured to extract frame information in the binary image by applying a projective transformation method, and fit a frame into a rectangular frame to obtain a rectangular frame binary image;
a third processing module configured to extract an outermost vertical line in the rectangular frame binary image using a feature extraction method;
a fourth processing module configured to extract an outermost lateral line in the rectangular-frame binary image using a feature extraction method;
the fifth processing module is configured to calculate intersection points of the horizontal lines on the outermost side and the vertical lines on the outermost side, and every two intersection points are intersected to obtain 4 intersection points;
the sixth processing module is configured to circularly compare the 4 intersection points, calculate whether the difference value of the x coordinate or the y coordinate between the current point and the previous point is greater than a first preset value, and if the difference value is greater than the first preset value, determine that correction is needed;
and the seventh processing module is configured to apply a projective transformation method to correct the intersection points needing to be corrected.
According to the system of the second aspect of the present invention, the second processing module is configured to apply a projective transformation method to extract border information in the binary image, obtain a largest one of the border information, and regard the largest one as a border of the table body; the frame information at this moment is the coordinates of a group of points, and the coordinates are fitted into a rectangular frame; and if the angle of the rectangular frame is larger than a second preset value, performing rotation operation first, and correcting the rotation angle.
According to the system of the second aspect of the present invention, the third processing module is configured to remove the horizontal lines in the rectangular box binary image by a horizontal erosion and dilation operation; finding a vertical line existing in the rectangular frame binary image without the horizontal line by using a probabilistic Hough line detection method; and combining the vertical lines.
According to the system of the second aspect of the present invention, the fourth processing module is configured to remove vertical lines in the rectangular frame binary image by longitudinal erosion and dilation operations; finding a horizontal line existing in the rectangular frame binary image without the vertical line by using a probabilistic Hough line detection method; and combining the transverse lines.
According to the system of the second aspect of the present invention, the fourth processing module is configured to cut out slices with a height of a third preset value from the rectangular frame binary image with vertical lines removed in a cyclic manner, and the slice cycle is performed in two groups, one group is from top to bottom, and the other group is from bottom to top.
According to the system of the second aspect of the present invention, the seventh processing module is configured to obtain a mapping relationship matrix according to the coordinates of the 4 intersection points that need to be corrected and the coordinates of the intersection points that are expected to be corrected; and correcting the 4 intersection points needing to be corrected according to the mapping relation matrix.
A third aspect of the invention discloses an electronic device. The electronic device comprises a memory storing a computer program and a processor implementing the steps of the automatic high-precision grid correction method according to any one of the first aspect of the present invention when the processor executes the computer program.
A fourth aspect of the invention discloses a computer-readable storage medium. The computer readable storage medium has stored thereon a computer program which, when executed by a processor, performs the steps of a method of automatic high-precision table correction according to any one of the first aspect of the present invention.
The scheme provided by the invention has the following beneficial effects: when a large form is identified, the slight deformation of the form can cause the identification dislocation of the cells, and the subsequent information arrangement and analysis are adversely affected. The invention can automatically correct the form deformation in a pixel level, and the time consumption is little, and the pictures of 4000 x 4000 can be controlled within 200 ms. And can be normally identified and corrected if the grid lines have slight curves. Meanwhile, the method has good effect on incomplete tables.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a flow diagram of a method for automatic high-precision grid correction according to an embodiment of the present invention;
FIG. 2 is a detailed flow diagram of a method of automatic high-precision grid correction according to an embodiment of the present invention;
FIG. 3 is an original diagram of a table according to an embodiment of the invention;
FIG. 4 is a binary map of a table according to an embodiment of the invention;
FIG. 5 is a diagram of a frame of a body of a table according to an embodiment of the present invention;
FIG. 6 is a rectangular box binary image of a table according to an embodiment of the present invention;
FIG. 7 is a schematic illustration after cross-line removal according to an embodiment of the present invention;
FIG. 8 is a schematic illustration after merging vertical lines according to an embodiment of the present invention;
FIG. 9 is a schematic illustration after vertical lines have been removed according to an embodiment of the invention;
FIG. 10 is a schematic view after a cross-line is extracted according to an embodiment of the invention;
FIG. 11 is a schematic diagram of a plurality of segments extracted according to an embodiment of the present invention;
FIG. 12 is a schematic illustration after merging cross lines in accordance with an embodiment of the present invention;
FIG. 13 is a schematic diagram of a corner point of a table according to an embodiment of the invention;
FIG. 14 is a diagram illustrating a corrected image according to an embodiment of the present invention;
FIG. 15 is a block diagram of an automatic high precision grid correction system according to an embodiment of the present invention;
fig. 16 is a block diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The invention discloses an automatic high-precision grid correction method in a first aspect. Fig. 1 is a flowchart of an automatic high-precision table correction method according to an embodiment of the present invention, as shown in fig. 1 and 2, the method including:
step S1, converting the original picture of the table into a binary image as shown in fig. 4 as shown in fig. 3;
step S2, extracting frame information in the binary image by applying a projective transformation method, and fitting the frame into a rectangular frame to obtain a rectangular frame binary image;
step S3, extracting the outermost vertical line in the rectangular frame binary image by using a feature extraction method;
step S4, extracting the outermost transverse line in the rectangular frame binary image by using a feature extraction method;
step S5, calculating intersections of the horizontal lines on the outermost side and the vertical lines on the outermost side, and intersecting each other two by two to obtain 4 intersections, which are regarded as corner points of the table, as shown in fig. 13;
step S6, circularly comparing the 4 intersection points, calculating whether the difference value of the x coordinate or the y coordinate of the current point and the previous point is more than 3, and if the difference value is more than 3, determining that the correction is needed;
and step S7, correcting the intersection points needing to be corrected by applying a projective transformation method.
In some embodiments, in step S8, all ruled lines of the corrected table are horizontal, flat and vertical, and the coordinate difference of the end point is less than 3, so as to meet the requirement of subsequent fine identification, and output the picture to a required module.
In step S2, a projective transformation method is applied to extract border information in the binary image, and a border is fitted to a rectangular frame, so as to obtain a rectangular frame binary image.
In some embodiments, in step S2, the applying a projective transformation method to extract bounding box information in the binary image, and fitting a bounding box to a rectangular box, so as to obtain a rectangular-box binary image includes:
step S2.1, applying a projective transformation method, and using a findContours function in open cv to extract border information in the binary image, and obtaining a largest one of the border information, and regarding the largest one as a border of the table body, as shown in fig. 5;
step S2.2, the frame information at this time is the coordinates of a group of points, and a minAreaRect function of cv is called to fit the frame information into a rectangular frame, as shown in FIG. 6;
and S2.3, if the angle of the rectangular frame is larger than 2, performing rotation operation first, and correcting the rotation angle.
In step S3, the outermost vertical line in the rectangular frame binary image is extracted using a feature extraction method.
In some embodiments, in step S3, the specific method for extracting the outermost vertical line in the rectangular frame binary image by using the feature extraction method includes:
s3.1, removing a transverse line in the rectangular frame binary image through transverse corrosion and expansion operation, as shown in FIG. 7;
s3.2, finding a vertical line existing in the rectangular frame binary image without the horizontal line by using a probabilistic Hough line detection method;
step S3.3, merge vertical lines, as shown in fig. 8.
In step S4, the outermost horizontal line in the rectangular-frame binary image is extracted using a feature extraction method.
In some embodiments, in step S4, the specific method for extracting the outermost horizontal line in the rectangular-box binary image by using the feature extraction method includes:
step S4.1, removing vertical lines in the rectangular frame binary image through longitudinal corrosion and expansion operations, as shown in figure 9;
s4.2, circularly cutting out a slice with the height of 200 from the rectangular frame binary image with the vertical lines removed, wherein the purpose of the circular cutting is to improve the efficiency; because Hough transform is a time-consuming operation, the size of a picture input into a Hough transform module is reduced as much as possible, two groups of slicing cycles are performed, one group is from top to bottom, the other group is from bottom to top, and each group of cycles stops after sufficient information is extracted, so that the waste of computing power is prevented; finding out a horizontal line existing in the rectangular frame binary image without the vertical line by using a probabilistic Hough line detection method, as shown in FIG. 10;
step S4.3, merging transverse lines, as shown in FIG. 12; since the lines in the frame have widths, many line segments are extracted from one line, as shown in fig. 11, and therefore a merging operation is required.
In step S7, the projective transformation method is applied to correct the intersection points that need to be corrected.
In some embodiments, in step S7, the specific method for applying the projective transformation to correct the intersection point needing to be corrected includes:
s7.1, using a getPersipfectTransform function, transmitting and acquiring coordinates of 4 intersection points needing to be corrected and coordinates of an intersection point expected to be corrected, and acquiring a mapping relation matrix;
step S7.2, using perspectiveTransform of open cv to transfer the mapping relation matrix to correct the 4 intersections that need to be corrected, as shown in fig. 14.
In conclusion, the scheme provided by the invention can lead the cell identification to be misplaced due to slight deformation of the table when a large table is identified, and can cause adverse effects on subsequent information arrangement and analysis. The invention can automatically correct the form deformation in a pixel level, and the time consumption is little, and the pictures of 4000 x 4000 can be controlled within 200 ms. And can be normally identified and corrected if the grid lines have slight curves. Meanwhile, the method has good effect on incomplete tables.
In a second aspect, an automatic high-precision grid correction system is disclosed. FIG. 15 is a block diagram of an automatic high precision grid correction system according to an embodiment of the present invention; as shown in fig. 15, the system 100 includes:
a first processing module 101 configured to convert the original picture of the table as shown in fig. 3 into a binary picture as shown in fig. 4;
the second processing module 102 is configured to extract frame information in the binary image by applying a projective transformation method, and fit a frame to a rectangular frame to obtain a rectangular frame binary image;
a third processing module 103 configured to extract an outermost vertical line in the rectangular frame binary image using a feature extraction method;
a fourth processing module 104 configured to extract an outermost horizontal line in the rectangular frame binary image using a feature extraction method;
a fifth processing module 105, configured to calculate intersections of the horizontal lines on the outermost side and the vertical lines on the outermost side, and intersect each other two by two to obtain 4 intersections, which are regarded as corner points of the table, as shown in fig. 13;
the sixth processing module 106 is configured to cyclically compare the 4 intersection points, calculate whether a difference between an x coordinate or a y coordinate of the current point and a previous point is greater than 3, and if the difference is greater than 3, determine that correction is required;
a seventh processing module 107, configured to apply a projective transformation method to correct the intersection points that need to be corrected.
According to the system of the second aspect of the present invention, the second processing module 102 is specifically configured to, the applying a projective transformation method to extract border information in the binary image, and fit a border to a rectangular frame, so as to obtain a rectangular frame binary image, where the specific method includes:
applying a projective transformation method, namely a findContours function in open cv, extracting border information in the binary image, obtaining the largest one of the border information, and regarding the largest one as a border of the table body, as shown in fig. 5;
at this time, the frame information is the coordinates of a group of points, and a minAreaRect function of cv is called to fit the frame information into a rectangular frame, as shown in FIG. 6;
and if the angle of the rectangular frame is more than 2, performing rotation operation to correct the rotation angle.
According to the system of the second aspect of the present invention, the third processing module 103 is specifically configured such that the specific method for extracting the outermost vertical line in the rectangular box binary image by using the feature extraction method includes:
removing the transverse lines in the rectangular frame binary image through transverse erosion and expansion operations, as shown in FIG. 7;
finding a vertical line existing in the rectangular frame binary image without the horizontal line by using a probabilistic Hough line detection method;
the vertical lines are merged as shown in FIG. 8.
According to the system of the second aspect of the present invention, the fourth processing module 104 is specifically configured to, the specific method for extracting the outermost horizontal line in the rectangular-box binary image by using the feature extraction method includes:
removing vertical lines in the rectangular frame binary image by longitudinal erosion and expansion operations, as shown in FIG. 9;
circularly cutting out a slice with the height of 200 from the rectangular frame binary image with the vertical lines removed, wherein the purpose of the circular cutting is to improve the efficiency; because Hough transform is a time-consuming operation, the size of a picture input into a Hough transform module is reduced as much as possible, two groups of slicing cycles are performed, one group is from top to bottom, the other group is from bottom to top, and each group of cycles stops after sufficient information is extracted, so that the waste of computing power is prevented; finding out a horizontal line existing in the rectangular frame binary image without the vertical line by using a probabilistic Hough line detection method, as shown in FIG. 10;
merge the horizontal lines, as shown in FIG. 12; since the lines in the frame have widths, many line segments are extracted from one line, as shown in fig. 11, and therefore a merging operation is required.
According to the system of the second aspect of the present invention, the seventh processing module 107 is specifically configured such that the specific method for applying the projective transformation method to correct the intersection point needing to be corrected includes:
using a getPerspectivetTransform function, transmitting and acquiring coordinates of 4 intersection points needing to be corrected and coordinates of an intersection point expected to be corrected, and acquiring a mapping relation matrix;
the 4 intersections that need to be corrected are corrected using the perspectiveTransform of open cv to import the mapping relation matrix, as shown in fig. 14.
A third aspect of the invention discloses an electronic device. The electronic device comprises a memory and a processor, the memory stores a computer program, and the processor implements the steps of the automatic high-precision grid correction method according to any one of the first aspect of the disclosure when executing the computer program.
Fig. 16 is a block diagram of an electronic device according to an embodiment of the present invention, and as shown in fig. 16, the electronic device includes a processor, a memory, a communication interface, a display screen, and an input device, which are connected by a system bus. Wherein the processor of the electronic device is configured to provide computing and control capabilities. The memory of the electronic equipment comprises a nonvolatile 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 an operating system and computer programs in the non-volatile storage medium. The communication interface of the electronic device is used for carrying out wired or wireless communication with an external terminal, and the wireless communication can be realized through WIFI, an operator network, Near Field Communication (NFC) or other technologies. The display screen of the electronic equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the electronic equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the electronic equipment, an external keyboard, a touch pad or a mouse and the like.
It will be understood by those skilled in the art that the structure shown in fig. 16 is only a partial block diagram related to the technical solution of the present disclosure, and does not constitute a limitation of the electronic device to which the solution of the present application is applied, and a specific electronic device may include more or less components than those shown in the drawings, or combine some components, or have a different arrangement of components.
A fourth aspect of the invention discloses a computer-readable storage medium. The computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the steps in an automatic high-precision table correction method according to any one of the first aspect of the present disclosure.
It should be noted that 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, however, as long as there is no contradiction between the combinations of the technical features, the scope of the present description should be considered. The above examples 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. An automatic high-precision grid correction method, the method comprising:
step S1, converting the original picture of the table into a binary image;
step S2, extracting frame information in the binary image by applying a projective transformation method, and fitting the frame into a rectangular frame to obtain a rectangular frame binary image;
step S3, extracting the outermost vertical line in the rectangular frame binary image by using a feature extraction method;
step S4, extracting the outermost transverse line in the rectangular frame binary image by using a feature extraction method;
step S5, calculating the intersection points of the horizontal lines on the outermost side and the vertical lines on the outermost side, and intersecting every two lines to obtain 4 intersection points which are regarded as the corner points of the table;
step S6, circularly comparing the 4 intersection points, calculating whether the difference value of the x coordinate or the y coordinate of the current point and the previous point is greater than a first preset value, and if so, determining that correction is needed;
and step S7, correcting the intersection points needing to be corrected by applying a projective transformation method.
2. The method according to claim 1, wherein in step S2, the applying a projective transformation method to extract bounding box information in the binary image and fitting the bounding box to a rectangular box, and the specific method for obtaining the rectangular-box binary image includes:
s2.1, extracting frame information in the binary image by using a projection transformation method, obtaining the largest one of the frame information, and taking the largest one as a frame of the table main body;
and S2.2, fitting the frame information which is the coordinates of a group of points into a rectangular frame.
3. The method according to claim 2, wherein in step S2, the applying a projective transformation method to extract bounding box information in the binary image and fitting the bounding box to a rectangular box, and the specific method for obtaining the rectangular-box binary image further includes:
and S2.3, if the angle of the rectangular frame is larger than a second preset value, performing rotation operation and correcting the rotation angle.
4. The automatic high-precision grid correction method according to claim 1, wherein in step S3, the specific method for extracting the outermost vertical line in the rectangular-frame binary image by using the feature extraction method includes:
s3.1, removing a transverse line in the rectangular frame binary image through transverse corrosion and expansion operation;
s3.2, finding a vertical line existing in the rectangular frame binary image without the horizontal line by using a probabilistic Hough line detection method;
and S3.3, combining the vertical lines.
5. The automatic high-precision grid correction method according to claim 1, wherein in step S4, the specific method for extracting the outermost horizontal line in the rectangular-frame binary image by using the feature extraction method includes:
s4.1, removing vertical lines in the rectangular frame binary image through longitudinal corrosion and expansion operation;
s4.2, finding a transverse line existing in the rectangular frame binary image without the vertical line by using a probabilistic Hough line detection method;
and S4.3, merging transverse lines.
6. The automatic high-precision grid correction method according to claim 5, wherein in step S4, before finding the horizontal line existing in the rectangular box binary image with the vertical line removed by using the probabilistic hough line detection method, the specific method for extracting the outermost horizontal line in the rectangular box binary image by using the feature extraction method further comprises:
and circularly cutting out slices with the height of a third preset value from the rectangular frame binary image without the vertical lines, wherein the slicing circulation needs to be carried out in two groups, one group is from top to bottom, and the other group is from bottom to top.
7. The automatic high-precision grid correction method according to claim 1, wherein in step S7, the specific method for applying projective transformation to correct the intersection points needing correction includes:
s7.1, acquiring a mapping relation matrix according to the coordinates of the 4 intersection points required to be corrected and the coordinates of the intersection points expected to be corrected;
and S7.2, correcting the 4 intersection points needing to be corrected according to the mapping relation matrix.
8. A system for automatic high-precision form correction, the system comprising:
a first processing module configured to convert an original picture of a table into a binary image;
the second processing module is configured to extract frame information in the binary image by applying a projective transformation method, and fit a frame into a rectangular frame to obtain a rectangular frame binary image;
a third processing module configured to extract an outermost vertical line in the rectangular frame binary image using a feature extraction method;
a fourth processing module configured to extract an outermost lateral line in the rectangular-frame binary image using a feature extraction method;
the fifth processing module is configured to calculate intersection points of the horizontal lines on the outermost side and the vertical lines on the outermost side, and every two intersection points are intersected to obtain 4 intersection points;
the sixth processing module is configured to circularly compare the 4 intersection points, calculate whether the difference value of the x coordinate or the y coordinate between the current point and the previous point is greater than a first preset value, and if the difference value is greater than the first preset value, determine that correction is needed;
and the seventh processing module is configured to apply a projective transformation method to correct the intersection points needing to be corrected.
9. An electronic device, comprising a memory storing a computer program and a processor implementing the steps of an automatic high precision table correction method according to any one of claims 1 to 7 when the computer program is executed by the processor.
10. A computer-readable storage medium, having stored thereon a computer program which, when executed by a processor, carries out the steps of an automatic high-precision lattice correction method according to any one of claims 1 to 7.
CN202210264861.5A 2022-03-17 2022-03-17 Automatic high-precision table correction method and system Pending CN114862753A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210264861.5A CN114862753A (en) 2022-03-17 2022-03-17 Automatic high-precision table correction method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210264861.5A CN114862753A (en) 2022-03-17 2022-03-17 Automatic high-precision table correction method and system

Publications (1)

Publication Number Publication Date
CN114862753A true CN114862753A (en) 2022-08-05

Family

ID=82627651

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210264861.5A Pending CN114862753A (en) 2022-03-17 2022-03-17 Automatic high-precision table correction method and system

Country Status (1)

Country Link
CN (1) CN114862753A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106203397A (en) * 2016-07-26 2016-12-07 江苏鸿信系统集成有限公司 Differentiate and localization method based on the form of tabular analysis technology in image
CN108171695A (en) * 2017-12-29 2018-06-15 安徽农业大学 A kind of express highway pavement detection method based on image procossing
CN109558765A (en) * 2017-09-25 2019-04-02 比亚迪股份有限公司 The detection method of automobile and lane line, device
CN111640133A (en) * 2020-06-03 2020-09-08 上海铭垚信息科技有限公司 Automatic picture table extraction method and system
CN111932483A (en) * 2020-09-28 2020-11-13 江西汉辰信息技术股份有限公司 Picture processing method and device, storage medium and computer equipment
CN112183038A (en) * 2020-09-23 2021-01-05 国信智能系统(广东)有限公司 Form identification and typing method, computer equipment and computer readable storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106203397A (en) * 2016-07-26 2016-12-07 江苏鸿信系统集成有限公司 Differentiate and localization method based on the form of tabular analysis technology in image
CN109558765A (en) * 2017-09-25 2019-04-02 比亚迪股份有限公司 The detection method of automobile and lane line, device
CN108171695A (en) * 2017-12-29 2018-06-15 安徽农业大学 A kind of express highway pavement detection method based on image procossing
CN111640133A (en) * 2020-06-03 2020-09-08 上海铭垚信息科技有限公司 Automatic picture table extraction method and system
CN112183038A (en) * 2020-09-23 2021-01-05 国信智能系统(广东)有限公司 Form identification and typing method, computer equipment and computer readable storage medium
CN111932483A (en) * 2020-09-28 2020-11-13 江西汉辰信息技术股份有限公司 Picture processing method and device, storage medium and computer equipment

Similar Documents

Publication Publication Date Title
CN112528863A (en) Identification method and device of table structure, electronic equipment and storage medium
CN101908136A (en) Table identifying and processing method and system
CN111881659B (en) Processing method and system of table picture, readable storage medium and computer equipment
CN111814905A (en) Target detection method, target detection device, computer equipment and storage medium
CN111368638A (en) Spreadsheet creation method and device, computer equipment and storage medium
CN111259854A (en) Method and device for identifying structured information of table in text image
CN110570445A (en) Image segmentation method, device, terminal and readable medium
CN116168351B (en) Inspection method and device for power equipment
CN111553334A (en) Questionnaire image recognition method, electronic device, and storage medium
CN111754536A (en) Image annotation method and device, electronic equipment and storage medium
CN110008960B (en) Method and terminal for detecting integrity of character segment
CN111428700A (en) Table identification method and device, electronic equipment and storage medium
CN112733855B (en) Table structuring method, table recovering device and device with storage function
CN114549393A (en) Image annotation method, device, equipment and computer storage medium
CN114862753A (en) Automatic high-precision table correction method and system
CN112800731A (en) Table repairing method for dealing with distorted graphs in image table extraction
CN112200822A (en) Table reconstruction method and device, computer equipment and storage medium
CN116168404A (en) Intelligent document processing method and system based on space transformation
CN111932483A (en) Picture processing method and device, storage medium and computer equipment
CN115600570A (en) Power grid equipment early warning limit value table reconstruction method, entry method and device
CN114511862A (en) Form identification method and device and electronic equipment
CN114463544A (en) Irregular object semantic segmentation quick labeling method
CN113343797A (en) Information extraction method and device, terminal equipment and computer readable storage medium
CN116128715B (en) Affine transformation method and affine transformation device for graphics
TWI809353B (en) Image recognition system and method for keyborad picture comparison and computer readable 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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20220805