A table comparison method and system based on image matching

Through the table comparison method based on image matching, the problem of low accuracy and efficiency of paper interlocking tables and electronic interlocking tables is solved, and efficient and accurate comparisons are achieved, with a wide range of applications and suitable for various fonts and table formats.

CN119399777BActive Publication Date: 2025-03-28CRSC RESEARCH & DESIGN INSTITUTE GROUP CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510005892.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-03
Publication Date
2025-03-28
Estimated Expiration
2045-01-03

AI Technical Summary

Technical Problem

The prior art is difficult to efficiently and accurately compare paper interlocking tables and electronic interlocking tables, resulting in low recognition accuracy and low efficiency.

Method used

A table comparison method based on image matching is adopted. By obtaining the spreadsheet export picture and paper table scanning picture, vector information of image elements is extracted, character image slices are obtained, and character matching is performed in paper images to output matching results.

Benefits of technology

It realizes efficient and accurate table comparison, with an accuracy rate of 98%, reduces the content of manual verification, improves efficiency, and has a wide range of applications, and is not affected by factors such as font, character spacing, and font thickness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119399777B_ABST
    Figure CN119399777B_ABST
Patent Text Reader

Abstract

The present invention provides a table comparison method and system based on image matching, the method comprising: obtaining a first picture, the first picture being an electronic table export describing a first object; obtaining a second picture, the second picture being a paper table scanned image describing the first object; obtaining a first file, the first file containing vector information of image elements corresponding to the first picture; obtaining a character image slice at a specified position according to the first picture and the first file; using the character image slice as a template, performing character matching at a position corresponding to the character image slice in the second picture, and outputting a matching result. The comparison method and system provided by the present invention can efficiently determine inconsistent parts with high accuracy by performing image segmentation and comparison on the electronic table export and the paper table scanned image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of image processing, and in particular relates to a table comparison method and system based on image matching. Background Art

[0002] Interlocking is an important signaling device to ensure the safety of train operation and shunting operations at railway stations. Interlocking data testing is a test in which testers use interlocking tables as the basis to check whether the interlocking data configuration is correct. With the development of automated testing tools, interlocking automatic testing tools have been put into use, which has improved the testing efficiency. Interlocking automatic testing requires electronic interlocking tables as input. However, at present, the interlocking tables given by design institutes in the industry are still in paper version as the final version, and the electronic interlocking table files in DWG (DraWinG, AutoCAD graphic file) format are not guaranteed to be the final version. For example, there may be traces of manual modification on the paper version of the interlocking table that have not been synchronized to the electronic version. Therefore, testers need to manually check the consistency between the electronic interlocking table and the paper version of the interlocking table, and use CAD (Computer Aided Design) tools to export the DWG format file into an EXCEL file as the input of the interlocking test tool. Due to the large and complex content of the interlocking table, manual verification is inefficient and has a low accuracy rate.

[0003] There are attempts in the industry to perform character recognition on paper interlocking tables through image recognition algorithms, but there are the following problems:

[0004] 1. Character recognition accuracy cannot meet requirements

[0005] 1. Due to differences in fonts, character spacing, font thickness, etc., the trained neural network has a low recognition accuracy on the new interlocking table, with the recognition accuracy only reaching 80%;

[0006] 2. There are many cases where handwritten characters cannot be recognized;

[0007] 3. When the paper interlocking table is blurred, the recognition accuracy is low;

[0008] 2. Low efficiency

[0009] Since the accuracy of character recognition is not high, a lot of content needs to be manually verified, which is inefficient.

[0010] Therefore, how to identify the efficient and accurate comparison between paper interlocking tables and electronic interlocking tables has become a technical problem that needs to be solved urgently in this field. Summary of the invention

[0011] In view of the above problems, the present invention provides a table comparison method based on image matching, comprising:

[0012] Obtaining a first picture, where the first picture is a spreadsheet export image describing a first object;

[0013] Acquire a second image, where the second image is a scanned image of a paper form describing the first object;

[0014] Acquire a first file, where the first file includes vector information of image elements corresponding to the first picture;

[0015] Acquire a character image slice at a specified position according to the first picture and the first file;

[0016] Using the character image slice as a template, character matching is performed at a position corresponding to the character image slice in the second image, and the matching result is output.

[0017] Furthermore, the method further comprises:

[0018] The second image is scaled to the same size as the first image and the scaling factor is determined.

[0019] Further, acquiring a character image slice at a specified position according to the first picture and the first file includes:

[0020] Using the first file, obtaining line segment elements corresponding to the elements in the first picture, and classifying them into horizontal line elements and vertical line elements;

[0021] Get the intersection of the horizontal line element and the vertical line element;

[0022] Determine the position information of the grid in the table according to the intersection of the horizontal line element and the vertical line element;

[0023] The position information of the grid is stored in the grid structure.

[0024] Further, acquiring a character image slice at a specified position according to the first picture and the first file includes:

[0025] Using the first file, obtaining character elements corresponding to elements in the first picture;

[0026] Determine the grid to which the character element belongs according to the position information of the character element;

[0027] The text of the character is stored in the grid structure corresponding to the grid to which it belongs.

[0028] Furthermore, after scaling the grid size according to the scaling factor, the grid is aligned with the first image and the second image, and the aligned position is stored in a corresponding grid structure.

[0029] Further, acquiring a character image slice at a specified position according to the first picture and the first file includes:

[0030] In each grid corresponding to the first image, segment the character area to form a character image slice containing a single character;

[0031] Save the relative position of the character image slices in the grid in the character structure;

[0032] Associate the character structure with the grid structure of the corresponding grid.

[0033] Furthermore, the method further comprises:

[0034] According to the correspondence between the position of the character element in the lattice structure and the position of the character image slice, the text of the character element is saved in the corresponding character structure.

[0035] Furthermore, using the character image slice as a template, performing character matching at a position corresponding to the character image slice in the second image includes:

[0036] Whether the image at the corresponding position in the second picture matches the character image slice is determined by calculating the pixel matching rate.

[0037] Furthermore, calculating the pixel matching rate includes:

[0038] Iterate over the pixel values ​​in the character image slice;

[0039] When the pixel value in the character image slice is a first pixel value, if the value of the pixel at the corresponding position in the second image is equal to or less than the first pixel value within a specified range, then the counter is incremented;

[0040] When the pixel value in the character image slice is the second pixel value, if the value of the pixel at the corresponding position in the second image is equal to or greater than the second pixel value within a specified range, then the counter is incremented;

[0041] The matching rate is determined according to the value of the accumulated counter obtained after traversal.

[0042] Further, the method comprises:

[0043] Output the results whose matching rate is lower than the matching rate threshold for matching verification;

[0044] Obtaining a matching verification result, if the character image slice matches the character at a position corresponding to the character image slice in the second picture, obtaining an image slice of the character in the second picture as a verification character image slice;

[0045] The verified character image slice is used as a template and based on the lattice structure, a second image region having other positions of the same character is re-matched.

[0046] Further, the method comprises:

[0047] The character image slice matching calculation is performed in the grid unit, and the results below the matching rate threshold are checked from low to high according to the matching rate to obtain the results;

[0048] According to the checking result, if a specified number of consecutive grids are all matched, the matching rate threshold is adjusted to the lowest character matching rate of the last grid.

[0049] Further, the method comprises:

[0050] The checked characters are output to the file in order according to the division of the grids, with the grids as the unit; and the character modification log in the obtained check result is output.

[0051] Furthermore, the visual matching results are output, where:

[0052] Characters with a matching rate higher than the specified threshold are rendered in a specified color to reduce the visibility.

[0053] Further, the electronic interlocking table is derived as a first picture;

[0054] Use a scan of the paper interlocking table as the second image.

[0055] The present invention also provides a table comparison system based on image matching, comprising:

[0056] A file acquisition module is used to: acquire a first picture, the first picture is an electronic table export image describing a first object; acquire a second picture, the second picture is a paper table scan image describing the first object; acquire a first file, the first file contains vector information of image elements corresponding to the first picture;

[0057] A slice acquisition module, used for acquiring a character image slice at a specified position according to the first picture and the first file;

[0058] The matching module is used to use the character image slice as a template, perform character matching at a position corresponding to the character image slice in the second image, and output a matching result.

[0059] Furthermore, the slice acquisition module is also used for:

[0060] The second image is scaled to the same size as the first image and the scaling factor is determined.

[0061] Furthermore, the slicing module is used to:

[0062] Using the first file, obtaining line segment elements corresponding to the elements in the first picture, and classifying them into horizontal line elements and vertical line elements;

[0063] Get the intersection of the horizontal line element and the vertical line element;

[0064] Determine the position information of the grid in the table according to the intersection of the horizontal line element and the vertical line element;

[0065] According to the position information of the grid, the grid is stored in the grid structure;

[0066] After scaling the grid size according to the scaling factor, the grid is aligned with the first image and the second image, and the alignment position is stored in the corresponding grid structure.

[0067] Furthermore, the slicing module is used to:

[0068] Using the first file, obtaining character elements corresponding to elements in the first picture;

[0069] Determine the grid to which the character element belongs according to the position information of the character element;

[0070] The text of the character is stored in the grid structure corresponding to the grid to which it belongs.

[0071] Furthermore, the slicing module is used to:

[0072] In each grid corresponding to the first image, segment the character area to form a character image slice containing a single character;

[0073] Save the relative position of the character image slices in the grid in the character structure;

[0074] Associate the character structure with the grid structure of the corresponding grid;

[0075] According to the correspondence between the position of the character element in the lattice structure and the position of the character image slice, the text of the character element is saved in the corresponding character structure.

[0076] Furthermore, the matching module is used to:

[0077] Whether the image at the corresponding position in the second picture matches the character image slice is determined by calculating the pixel matching rate.

[0078] Furthermore, the matching module is used to:

[0079] Output the results whose matching rate is lower than the matching rate threshold for matching verification;

[0080] Obtaining a matching verification result, if the character image slice matches the character at a position corresponding to the character image slice in the second picture, obtaining an image slice of the character in the second picture as a verification character image slice;

[0081] The verified character image slice is used as a template and based on the lattice structure, a second image region having other positions of the same character is re-matched.

[0082] Furthermore, a display module is included for visualizing the matching results, wherein:

[0083] Characters with a matching rate higher than the specified threshold are rendered in a specified color to reduce the visibility.

[0084] Further, the electronic interlocking table is derived as a first picture;

[0085] Use a scan of the paper interlocking table as the second image.

[0086] The table comparison method and system based on image matching provided by the present invention can efficiently determine the inconsistent parts by segmenting and comparing the electronic table export image and the paper table scan image, and it is convenient to ignore the consistent parts, and only the inconsistent parts are handed over to manual verification and modification, with high accuracy (up to 98%) and high efficiency. Moreover, this method is not affected by factors such as font, character spacing, and font thickness, has a wide range of applications, requires less manual verification, and improves efficiency.

[0087] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0088] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0089] Figure 1 The overall flow chart of the table comparison method based on image matching according to an embodiment of the present invention is shown;

[0090] Figure 2 A flowchart of a checking process of a table comparison method based on image matching according to an embodiment of the present invention is shown;

[0091] Figure 3 A structural schematic diagram of a table comparison system based on image matching according to an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0092] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0093] An embodiment of the present invention provides a table comparison method based on image matching, the method comprising: obtaining a first image, the first image being an electronic table export image describing a first object; obtaining a second image, the second image being a scanned image of a paper table describing the first object; obtaining a first file, the first file containing vector information of image elements corresponding to the first image; obtaining a character image slice at a specified position based on the first image and the first file; using the character image slice as a template, performing character matching at a position corresponding to the character image slice in the second image, and outputting a matching result.

[0094] The comparison method of the embodiment of the present invention can be used to automatically compare paper tables and electronic tables of the same object to find out the inconsistent parts. The first object can be any data that can be described in a table. Without loss of generality, the comparison method of the embodiment of the present invention compares the table of the interlocking table. Exemplarily, the interlocking table is shown in Table 1. It should be noted that the interlocking table example in the embodiment of the present invention is only used to illustrate the general format of the interlocking table, and not the interlocking business logic expressed by the text content in the interlocking table, so the content thereof is not explained.

[0095] Table 1 Interlocking table

[0096]

[0097] Wherein, the first object is an interlocking table. Wherein, the first picture is an electronic table export diagram. The electronic table of the embodiment of the present invention refers to a standardized table produced by computer software. Without loss of generality, the first picture is an electronic interlocking table export diagram in DWG format. The second picture is a paper table export diagram. Without loss of generality, the second picture is a paper interlocking table scanned diagram. The first file contains vector information of image elements corresponding to the first picture, such as line segment vector description information, character position information and character text information, etc. When the first picture adopts a DWG format picture, the first file adopts a dxf file (AutoCAD drawing exchange file) exemplarily, which is an electronic interlocking table export dxf file.

[0098] The following takes interlocking table comparison as an example to illustrate the table comparison method based on image matching according to the embodiment of the present invention, but the comparison method according to the embodiment of the present invention is not limited to application in interlocking tables.

[0099] like Figure 1 As shown, during the comparison method, the input includes: a scanned image of the paper interlocking table (the second image), an exported image of the electronic interlocking table in DWG format (the first image), and an exported dxf file of the electronic interlocking table in DWG format (the first file).

[0100] The second image is preprocessed, including tilt correction and image scaling.

[0101] Use a quadrilateral frame to select the table area of ​​the second image, and overlap the quadrilateral with the four vertices of the table; perform tilt correction on the paper interlocking table image according to the tilt angles of the upper left point and the upper right point, and perform the same tilt correction on the quadrilateral frame; scale the second image with the corrected quadrilateral frame size so that the size of the second image is the same as that of the first image, and calculate the scaling factor.

[0102] Extracting tables and characters: using the first file, obtaining line segment elements (referred to as line segments) corresponding to elements in the first image, and classifying them into horizontal line elements (referred to as horizontal lines) and vertical line elements (referred to as vertical lines); obtaining the intersection of the horizontal line elements and the vertical line elements; determining the position information of the grid in the table according to the intersection of the horizontal line elements and the vertical line elements; storing the position information of the grid in the grid structure. In the embodiment of the present invention, the grid refers to the cell of the table or the graphic information corresponding to the cell. The structure is a structural data composed of a batch of data.

[0103] Furthermore, the first file is used to obtain character elements corresponding to the elements in the first image; the grid to which the character elements belong is determined based on the position information of the character elements; and the text of the character is stored in a grid structure corresponding to the grid to which it belongs.

[0104] Exemplarily, tables and characters are extracted by preprocessing the dxf file. The line segments in the electronic interlocking table dxf file are read using the dxf reading library, and classified according to horizontal and vertical lines; the characters in the electronic interlocking table dxf file are read using the dxf reading library, and the grid to which they belong is located by position, and the characters are written into the corresponding grid structure.

[0105] Calculate and align the table: align the grid size with the first image and the second image after scaling the grid size according to the scaling factor, and store the alignment position in the corresponding grid structure. Exemplarily, the grid position is calculated by finding the intersection of the horizontal line element and the vertical line element, and the upper, lower, left and right boundaries are saved in the grid structure. After multiplying the grid size by the scaling factor, align it with the electronic interlocking table export diagram and the paper interlocking table scan diagram, and save the alignment position in the grid structure.

[0106] Character segmentation: In each grid corresponding to the first image, the character area is segmented to form a character image slice containing a single character; the relative position of the character image slice in the grid is saved in the character structure; the character structure is associated with the grid structure of the corresponding grid, and illustratively, the ID of the grid structure of the grid in which it is located is saved in the character structure. According to the correspondence between the position of the character element in the grid structure and the position of the character image slice, the text of the character element is saved in the corresponding character structure.

[0107] Exemplarily, in each grid in the electronic interlocking table image, the character area is sequentially divided into rows and columns to form a single character image slice, and the relative position of the character image slice in the grid is saved in the character structure. The characters in the grid structure are matched with the positions of the segmented character image slices, and the characters are saved in the corresponding character structure.

[0108] Template matching: Determine whether the image at the corresponding position in the second image matches the character image slice by calculating the pixel matching rate. Specifically, traverse the pixel values ​​in the character image slice; when the pixel value in the character image slice is the first pixel value, if the value of the pixel at the corresponding position in the second image is equal to or less than the first pixel value within a specified range, then accumulate the counter; when the pixel value in the character image slice is the second pixel value, if the value of the pixel at the corresponding position in the second image is equal to or greater than the second pixel value within a specified range, then accumulate the counter; determine the matching rate based on the value of the accumulated counter obtained after traversal. Among them, the first pixel value is greater than the second pixel value.

[0109] Exemplarily, a single character template matching algorithm is used, with the electronic interlocking table character image slice as the template, and in the same table of the paper interlocking table image, the character image slice position is used as the matching initial position, and image matching is performed within a certain threshold range to find the position with the maximum matching rate. The matching rate calculation method is as follows:

[0110] When the pixel value of the electronic interlocking table character is 255, the matching counter increases by one when the corresponding pixel of the paper interlocking table character at the corresponding position is > 250, and the matching counter increases by zero for other values;

[0111] When the pixel value of the electronic interlocking table character is 0, the matching counter increases by one when the corresponding pixel of the paper interlocking table character at the corresponding position is <10, and the matching counter increases by zero for other values;

[0112] After traversing the pixels of the character slice of the electronic interlocking table, the matching rate is calculated by dividing the matching counter by the total number of pixels in the slice.

[0113] Verification and confirmation: Output the results with a matching rate lower than the matching rate threshold for matching verification; obtain the matching verification result, and if the character image slice matches the character at the position corresponding to the character image slice in the second picture, obtain the image slice of the character in the second picture as the verification character image slice; use the verification character image slice as a template, and re-match the second picture area with the same character (character text is stored in the character structure) at other positions based on the lattice structure. By re-matching based on the second picture slice template, the overall matching accuracy of the second picture can be adaptively improved.

[0114] In an embodiment of the present invention, character image slice matching calculations are performed within a grid in units of grids, and the results that are lower than the matching rate threshold are checked from low to high according to the matching rates. Based on the checking results, if a specified number of consecutive grids are matched, the matching rate threshold is adjusted to the lowest character matching rate of the last grid.

[0115] Among them, the matching confirmation can be performed by manual verification (manual confirmation) or machine learning. In the embodiment of the present invention, manual verification is taken as an example for explanation.

[0116] like Figure 2 As shown, the grids with characters below the matching rate threshold are handed over to human beings for checking, and the grids are handed over to human beings for checking in order from low to high matching rates of the lowest characters in the grids. The matching rate threshold can be set by initialization.

[0117] When the manual verification is consistent: the character slice of the paper interlocking table corresponding to this character is used as a new matching template, and all this character is matched twice to improve the matching rate of this character.

[0118] When manual verification is inconsistent: modify the character content corresponding to the electronic interlocking table according to the content of the paper interlocking table.

[0119] When n grids are manually checked and all are correct, the matching threshold can be adjusted down to the lowest character matching rate of the nth grid.

[0120] Result output: Characters above the specified matching rate threshold are rendered in the specified color to reduce the display degree.

[0121] For example, after there are no characters below the matching rate threshold that need to be checked, the visual matching results are output: the black pixel parts of the characters above the matching rate threshold are painted gray / white to reduce the display degree; the characters below the matching rate threshold are retained. The user can check whether there are black characters. If there are black characters: the character content corresponding to this electronic interlocking table needs to be modified according to the content of the paper interlocking table; if there are no black characters: the verification is completed.

[0122] In addition, the checked characters are written into Excel (such as an xlsx file) in order according to the division of the grids, and a character modification log in the obtained verification result is output, such as a manual modification log (such as modification log.xlsx).

[0123] Compared with the traditional text recognition solution, the method of the embodiment of the present invention has a high matching accuracy rate and strong adaptability, and is not affected by factors such as font, character spacing, and font thickness. It requires less manual operation and does not require the establishment of a training image library.

[0124] Based on the same inventive concept, the embodiment of the present invention also provides a table comparison system based on image matching, such as Figure 3 As shown, the system includes a file acquisition module, a slice acquisition module, and a matching module. Each module can be connected to data according to the processing logic requirements.

[0125] The file acquisition module is used to acquire a first picture, which is an electronic table export image describing a first object; acquire a second picture, which is a paper table scan image describing the first object; and acquire a first file, which contains vector information of image elements corresponding to the first picture.

[0126] The slice acquisition module is used to acquire a character image slice at a specified position according to the first picture and the first file;

[0127] The matching module is used to use the character image slice as a template, perform character matching at a position corresponding to the character image slice in the second image, and output a matching result.

[0128] The slice acquisition module is also used to scale the second image to the same size as the first image and determine the scaling factor. Using the first file, line segment elements corresponding to the elements in the first image are acquired and classified into horizontal line elements and vertical line elements; the intersection of the horizontal line elements and the vertical line elements is acquired; the position information of the grid in the table is determined according to the intersection; the position information of the grid is stored in the grid structure; after scaling the grid size according to the scaling factor, the grid is aligned with the first image and the second image, and the alignment position is stored in the corresponding grid structure.

[0129] The slicing module is also used to use the first file to obtain character elements corresponding to the elements in the first image; determine the belonging grid of the character elements according to the position information of the character elements; and store the text of the character in the grid structure corresponding to the belonging grid.

[0130] The slicing module is used to segment the character area in each grid corresponding to the first image to form a character image slice containing a single character; save the relative position of the character image slice in the grid in the character structure; associate the character structure with the grid structure of the corresponding grid; and save the text of the character element in the corresponding character structure based on the correspondence between the position of the character element in the grid structure and the position of the character image slice.

[0131] The matching module is used to determine whether the image at the corresponding position in the second picture matches the character image slice by calculating the pixel matching rate. The result with a matching rate lower than the matching rate threshold is output for matching verification; the matching verification result is obtained, and if the character image slice matches the character at the position corresponding to the character image slice in the second picture, the image slice of the character in the second picture is obtained as the verification character image slice; the verification character image slice is used as a template, and based on the lattice structure, the second picture area with other positions of the same character is re-matched.

[0132] Furthermore, the system also includes a display module for visualizing the matching results, wherein characters above a specified matching rate threshold are rendered in a specified color to reduce the display degree.

[0133] Without loss of generality, the system of the embodiment of the present invention can compare the electronic interlocking table export diagram as the first image and the paper interlocking table scan diagram as the second image to efficiently confirm the inconsistent character texts therein. It should be noted that the detailed implementation steps of each module of the system of the embodiment of the present invention can be obtained according to the comparison method of the embodiment of the present invention, and will not be repeated.

[0134] Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent substitutions for some of the technical features therein; and these modifications or substitutions do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A table comparison method based on image matching, characterized in that: include: Obtaining a first picture, where the first picture is a spreadsheet export image describing a first object; Acquire a second image, where the second image is a scanned image of a paper form describing the first object; Acquire a first file, where the first file includes vector information of image elements corresponding to the first picture; Acquire a character image slice at a specified position according to the first picture and the first file; Using the character image slice as a template, matching characters at positions corresponding to the character image slice in the second image, and outputting matching results; scaling the second image to the same size as the first image and determining a scaling factor; Acquiring a character image slice at a specified position according to the first picture and the first file includes: Using the first file, obtaining line segment elements corresponding to the elements in the first picture, and classifying them into horizontal line elements and vertical line elements; Get the intersection of the horizontal line element and the vertical line element; Determine the position information of the grid in the table according to the intersection of the horizontal line element and the vertical line element; According to the position information of the grid, the grid is stored in the grid structure; Acquiring a character image slice at a specified position according to the first picture and the first file includes: Using the first file, obtaining character elements corresponding to elements in the first picture; Determine the grid to which the character element belongs according to the position information of the character element; Store the text of the character in the grid structure corresponding to the grid; Acquiring a character image slice at a specified position according to the first picture and the first file includes: In each grid corresponding to the first image, segment the character area to form a character image slice containing a single character; Save the relative position of the character image slices in the grid in the character structure; Associate the character structure with the grid structure of the corresponding grid.

2. The table comparison method based on image matching according to claim 1, characterized in that: After scaling the grid size according to the scaling factor, the grid is aligned with the first image and the second image, and the alignment position is stored in the corresponding grid structure.

3. The table comparison method based on image matching according to claim 2, characterized in that: Also includes: According to the correspondence between the position of the character element in the lattice structure and the position of the character image slice, the text of the character element is saved in the corresponding character structure.

4. The table comparison method based on image matching according to claim 1, characterized in that: Using the character image slice as a template, matching characters at a position corresponding to the character image slice in the second image includes: Whether the image at the corresponding position in the second picture matches the character image slice is determined by calculating the pixel matching rate.

5. The table comparison method based on image matching according to claim 4, characterized in that: Calculating pixel matching rate includes: Iterate over the pixel values ​​in the character image slice; When the pixel value in the character image slice is a first pixel value, if the value of the pixel at the corresponding position in the second image is equal to or less than the first pixel value within a specified range, then the counter is incremented; When the pixel value in the character image slice is the second pixel value, if the value of the pixel at the corresponding position in the second image is equal to or greater than the second pixel value within a specified range, then the counter is incremented; The matching rate is determined according to the value of the accumulated counter obtained after traversal.

6. The table comparison method based on image matching according to any one of claims 1 to 5, characterized in that: include: Output the results whose matching rate is lower than the matching rate threshold for matching verification; Obtaining a matching verification result, if the character image slice matches the character at a position corresponding to the character image slice in the second picture, obtaining an image slice of the character in the second picture as a verification character image slice; The verified character image slice is used as a template and based on the lattice structure, a second image region having other positions of the same character is re-matched.

7. The table comparison method based on image matching according to any one of claims 1 to 5, characterized in that: include: The character image slice matching calculation is performed in the grid unit, and the results below the matching rate threshold are checked from low to high according to the matching rate to obtain the results; According to the checking result, if a specified number of consecutive grids are all matched, the matching rate threshold is adjusted to the lowest character matching rate of the last grid.

8. The table comparison method based on image matching according to claim 7, characterized in that: include: Take the grid as the unit, and output the checked characters to the file in order according to the division of the grid; And output the character modification log in the obtained verification result.

9. The table comparison method based on image matching according to any one of claims 1 to 5, characterized in that: Output visual matching results, where Characters with a matching rate higher than the specified threshold are rendered in a specified color to reduce the visibility.

10. The table comparison method based on image matching according to any one of claims 1 to 5, characterized in that: Export the electronic interlocking table as the first picture; Use a scan of the paper interlocking table as the second image.

11. A table comparison system based on image matching, characterized in that: include: The file acquisition module is used to: acquire a first picture, where the first picture is a spreadsheet export diagram describing a first object; Acquire a second image, where the second image is a scanned image of a paper form describing the first object; Acquire a first file, where the first file includes vector information of image elements corresponding to the first picture; A slice acquisition module, used for acquiring a character image slice at a specified position according to the first picture and the first file; A matching module, used to use the character image slice as a template, perform character matching at a position corresponding to the character image slice in the second image, and output a matching result; The slice acquisition module is further used to: scale the second image to the same size as the first image and determine a scaling factor; The slicing module is used to: use the first file to obtain line segment elements corresponding to the elements in the first picture, and classify them into horizontal line elements and vertical line elements; obtain the intersection of the horizontal line elements and the vertical line elements; Determining the position information of the grid in the table according to the intersection of the horizontal line element and the vertical line element; storing the position information of the grid in the grid structure; The slicing module is used to: obtain the character element corresponding to the element in the first picture using the first file; determine the belonging grid of the character element according to the position information of the character element; and store the text of the character in the grid structure corresponding to the belonging grid; In each grid corresponding to the first image, segment the character area to form a character image slice containing a single character; Save the relative position of the character image slices in the grid in the character structure; Associate the character structure with the grid structure of the corresponding grid.

12. The table comparison system based on image matching according to claim 11, characterized in that: The slicing module is used to: align the grid size with the first image and the second image after scaling the grid size according to the scaling factor, and store the alignment position in the corresponding grid structure.

13. The table comparison system based on image matching according to claim 12, characterized in that: The slice module is used to: According to the correspondence between the position of the character element in the lattice structure and the position of the character image slice, the text of the character element is saved in the corresponding character structure.

14. The table comparison system based on image matching according to claim 11, characterized in that: The matching module is used to: Whether the image at the corresponding position in the second picture matches the character image slice is determined by calculating the pixel matching rate.

15. The table comparison system based on image matching according to claim 14, characterized in that: The matching module is used to: Output the results whose matching rate is lower than the matching rate threshold for matching verification; Obtaining a matching verification result, if the character image slice matches the character at a position corresponding to the character image slice in the second picture, obtaining an image slice of the character in the second picture as a verification character image slice; The verified character image slice is used as a template and based on the lattice structure, a second image region having other positions of the same character is re-matched.

16. The table comparison system based on image matching according to claim 15, characterized in that: Also included is a display module for visualizing the matching results, wherein: Characters with a matching rate higher than the specified threshold are rendered in a specified color to reduce the visibility.

17. The table comparison system based on image matching according to any one of claims 11 to 16, characterized in that: Export the electronic interlocking table as the first picture; Use a scan of the paper interlocking table as the second image.

Citation Information

Patent Citations

  • Document comparison method based on image accurate correction

    CN110610170A