A report data collection method and system
By identifying and updating the differences between data tables, the time-consuming collection problem caused by frequent changes in data tables is solved, and efficient data collection and update are achieved.
Patent Information
- Application Number
- CN202411524862.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-30
- Publication Date
- 2025-05-16
- Estimated Expiration
- 2044-10-30
AI Technical Summary
When the data on the data table is changed frequently, the existing report data acquisition method needs to re-acquire a large amount of data, resulting in a long time in the collection process.
By obtaining pictures of the first data table and the second data table, the difference picture between the two is calculated, the difference point is identified and its position information is determined, thereby only the changing data value is updated.
This method can quickly determine whether the data table has changed, skip unchanged data tables, and only the changed data values are collected, thereby improving data acquisition efficiency and reducing acquisition time and consumption.
Smart Images

Figure CN119047441B_ABST
Abstract
Description
Technical Field
[0001] One or more embodiments of the present specification relate to the field of data collection technology, and in particular, to a report data collection method and system. Background Art
[0002] Reports are generated by collecting data from various data tables. Specifically, various data tables are first uploaded to the report generation system, and then the template for the report to be generated is selected on the report generation system and the relevant parameter information is set. Then the report generation system will automatically collect the required data from various data tables. Finally, the report generation system processes the collected data to form the required report.
[0003] When the data on the data table changes, the report needs to be regenerated, that is, the data on the data table needs to be collected again. When the generation of a report requires the collection of data from a large number of data tables and the data on these data tables may change frequently, the collection of report data will be very time-consuming. Summary of the invention
[0004] In order to solve the above problems, one or more embodiments of this specification describe a report data collection method and system.
[0005] According to a first aspect, a report data collection method is provided, the method comprising:
[0006] S1. Obtain a first data table and a second data table, and obtain a first data table image based on the first data table and obtain a second data table image based on the second data table;
[0007] S2. Obtaining a difference picture based on the first data table picture and the second data table picture;
[0008] S3 obtains the difference point on the difference picture, and determines the difference point position information obtained;
[0009] S4. If the difference point is obtained, the first data value is obtained in the first data table image according to the difference point position information of the difference point and the corresponding second data value is obtained in the second data table image according to the difference point position information;
[0010] The first data value is compared with the corresponding second data value to determine whether the first data value has changed. When the first data value has changed, the filling position of the first data value in the report is determined, and the report data value in the filling position is updated based on the second data value.
[0011] Preferably, S2 specifically includes:
[0012] S21. Binarize the first data table image and the second data table image to obtain a difference image 1;
[0013] S22. Determine whether there are vertical lines and / or horizontal lines on the difference picture 1. If there are no vertical lines and / or horizontal lines, the difference picture 1 is used as the difference picture; if there are vertical lines and / or horizontal lines, enter S23;
[0014] S23. If there is a vertical line, obtain the vertical line position information, and determine the first vertical dividing line on the first data table picture based on the vertical line position information and determine the second vertical dividing line on the second data table picture; if there is a horizontal line, obtain the horizontal line position information, and determine the first horizontal dividing line on the first data table picture based on the horizontal line position information and determine the second horizontal dividing line on the second data table picture;
[0015] Performing image segmentation on the first data table picture based on the first vertical dividing line and / or the first horizontal dividing line to obtain at least two first data table sub-pictures, and determining whether only one first data table sub-picture among all the first data table sub-pictures is a non-blank picture, if so, taking the difference picture 1 as the difference picture; if not, entering S24;
[0016] S24. Performing image segmentation on the second data table picture based on the second vertical dividing line and / or the second horizontal dividing line to obtain at least two second data table sub-pictures;
[0017] Obtain a first data table sub-image located at the rightmost, bottommost, or lower-rightmost side of the first data table image, and obtain a second data table sub-image located at the rightmost, bottommost, or lower-rightmost side of the second data table image, cut or expand the second data table sub-image so that the size of the second data table sub-image is the same as the size of the corresponding first data table sub-image, and perform binarization and difference processing on the first data table sub-image and the second data table sub-image to obtain a sub-difference image;
[0018] Determine whether there are vertical lines and / or horizontal lines on the sub-difference picture. If there are no vertical lines and / or horizontal lines, proceed to S25; if there are vertical lines and / or horizontal lines, return to S23;
[0019] S25. Remove the first vertical dividing line that coincides with the rightmost vertical line of the table in the first data table picture and remove the first horizontal dividing line that coincides with the bottommost horizontal line of the table in the first data table picture, and perform image segmentation on the first data table picture based on the remaining first vertical dividing lines and / or first horizontal dividing lines to obtain at least two first data table sub-pictures;
[0020] Removing the second vertical dividing line that coincides with the rightmost vertical line of the table in the second data table picture and removing the second horizontal dividing line that coincides with the bottommost horizontal line of the table in the second data table picture, and performing image segmentation on the second data table picture based on the remaining second vertical dividing line and / or second horizontal dividing line to obtain at least two second data table sub-pictures;
[0021] All the second data table sub-images are cut or expanded so that the size of the second data table sub-images is the same as the size of the corresponding first data table sub-images, all the first data table sub-images and all the second data table sub-images are one-to-one binarized and differenced to obtain more than two difference images 2, and all the difference images 2 are used as difference images.
[0022] Preferably, in S22, determining whether there are vertical lines and / or horizontal lines on the difference image 1 specifically includes:
[0023] Obtain vertically continuous pixel points with a value of 1 in the difference image 1, and when the number of the vertically continuous pixel points is greater than a first numerical threshold, determine that the vertically continuous pixel points are a vertical line, and the first numerical threshold is the total number of pixels on the vertical side of the difference image 1 multiplied by a first preset proportion value;
[0024] Obtain horizontal continuous pixel points with a value of one in the difference image one. When the number of horizontal continuous pixel points is greater than a second numerical threshold, determine that the horizontal continuous pixel points are a horizontal line. The second numerical threshold is the total number of pixels on the horizontal side of the difference image one multiplied by a second preset proportion value.
[0025] Preferably, before S23, the method further includes:
[0026] Marking the vertical lines and the horizontal lines in the first data table picture with serial numbers to obtain a data table reference picture;
[0027] In S23, obtaining the vertical line position information specifically includes:
[0028] Compare the difference image 1 with the reference image in the data table to determine the first vertical line that is compared and overlapped from left to right, and obtain the vertical line sequence number of the first vertical line that is compared and overlapped through the reference image in the data table, and use the vertical line sequence number as the vertical line position information;
[0029] In S23, obtaining the horizontal line position information specifically includes:
[0030] The difference image 1 is compared with the reference image in the data table to determine the first horizontal line that overlaps from top to bottom, and the horizontal line number of the first horizontal line that overlaps is obtained through the reference image in the data table, and the horizontal line number is used as the horizontal line position information.
[0031] Preferably, before S3, it also includes:
[0032] When there are more than two difference pictures, the data table reference picture is segmented based on the first vertical dividing line and / or the first horizontal dividing line remaining in S25 to obtain data table reference sub-pictures corresponding one to one with the first data table sub-pictures;
[0033] S3 specifically includes:
[0034] S31 determines whether the difference picture is a blank picture. When the difference picture is a non-blank picture, proceed to S32;
[0035] S32 sets a sliding box on the difference picture, counts the number of pixels with a value of one in the sliding box, and when the number of pixels with a value of one is greater than the third threshold, determines that the sliding box has a difference point at the current position, and marks the difference point on the difference picture;
[0036] S33. Compare the difference picture with the difference point with the data table reference picture or the corresponding data table reference sub-picture to determine the upper horizontal line number above the difference point, the lower horizontal line number below the difference point, the left vertical line number to the left of the difference point and the right vertical line number to the right of the difference point, and use the upper horizontal line number, the lower horizontal line number, the left vertical line number and the right vertical line number as the difference point position information of the difference point.
[0037] According to a second aspect, a report data collection system is provided, the system comprising:
[0038] A data table image acquisition module, used to acquire a first data table and a second data table, and acquire a first data table image based on the first data table and acquire a second data table image based on the second data table;
[0039] A difference picture acquisition module, used for acquiring a difference picture based on the first data table picture and the second data table picture;
[0040] A difference point position information acquisition module is used to acquire difference points on the difference image and determine the difference point position information of the acquired difference points;
[0041] A data value acquisition module, configured to acquire a first data value in the first data table image according to the difference point position information of the difference point if a difference point is acquired, and acquire a corresponding second data value in the second data table image according to the difference point position information;
[0042] a data value change determination module, used to compare the first data value with the corresponding second data value to determine whether the first data value has changed;
[0043] The report data value updating module is used to determine the filling position of the first data value in the report when the first data value changes, and update the report data value in the filling position based on the second data value.
[0044] Preferably, the difference picture acquisition module includes:
[0045] A difference picture 1 acquisition unit, used for performing binarization and difference processing on the first data table picture and the second data table picture to obtain a difference picture 1;
[0046] a first difference picture determination unit, configured to determine whether there are vertical lines and / or horizontal lines on the first difference picture, and if there are no vertical lines and / or horizontal lines, use the first difference picture as the difference picture;
[0047] a dividing line determining unit, configured to obtain vertical line position information if there is a vertical line, and determine a first vertical dividing line on the first data table picture based on the vertical line position information, and determine a second vertical dividing line on the second data table picture; and obtain horizontal line position information if there is a horizontal line, and determine a first horizontal dividing line on the first data table picture based on the horizontal line position information, and determine a second horizontal dividing line on the second data table picture;
[0048] A first data table sub-picture obtaining unit, configured to perform image segmentation on the first data table picture based on a first vertical dividing line and / or a first horizontal dividing line to obtain at least two first data table sub-pictures;
[0049] The second difference picture determination unit is used to determine whether only one first data table sub-picture among all the first data table sub-pictures is a non-blank picture, and if so, the first difference picture is used as the difference picture;
[0050] A second data table sub-picture obtaining unit, configured to perform image segmentation on the second data table picture based on a second vertical dividing line and / or a second horizontal dividing line to obtain at least two second data table sub-pictures;
[0051] a sub-difference picture acquisition unit, configured to acquire a first data table sub-picture located at the rightmost, bottommost, or lower-rightmost side of the first data table picture and acquire a second data table sub-picture located at the rightmost, bottommost, or lower-rightmost side of the second data table picture, cut or expand the second data table sub-picture so that the size of the second data table sub-picture is the same as the size of the corresponding first data table sub-picture, and perform binarization and difference processing on the first data table sub-picture and the second data table sub-picture to obtain a sub-difference picture;
[0052] a sub-difference picture determination unit, configured to determine whether there are vertical lines and / or horizontal lines on the sub-difference picture;
[0053] a first data table sub-image determining unit, configured to remove a first vertical dividing line that coincides with the rightmost vertical line of the table in the first data table image and remove a first horizontal dividing line that coincides with the bottommost horizontal line of the table in the first data table image, and perform image segmentation on the first data table image based on the remaining first vertical dividing lines and / or first horizontal dividing lines to obtain at least two first data table sub-images;
[0054] a second data table sub-image determining unit, configured to remove a second vertical dividing line that coincides with the rightmost vertical line of the table in the second data table image, and remove a second horizontal dividing line that coincides with the bottommost horizontal line of the table in the second data table image, and perform image segmentation on the second data table image based on the remaining second vertical dividing line and / or second horizontal dividing line to obtain at least two second data table sub-images;
[0055] The difference picture determination unit three is used to cut or expand all the second data table sub-pictures so that the size of the second data table sub-pictures is the same as the size of the corresponding first data table sub-pictures, and to perform one-to-one binarization and difference processing on all the first data table sub-pictures and all the second data table sub-pictures to obtain more than two difference pictures two, and all the difference pictures two are used as difference pictures.
[0056] Preferably, the difference picture determination unit 1 includes:
[0057] A vertical line determination subunit is used to obtain vertical continuous pixel points with a value of 1 in the difference image 1, and when the number of the vertical continuous pixel points is greater than a first numerical threshold, the vertical continuous pixel points are determined to be a vertical line, and the first numerical threshold is the total number of pixels on the vertical side of the difference image 1 multiplied by a first preset ratio value;
[0058] The horizontal line determination subunit is used to obtain horizontal continuous pixel points with a value of one in the difference image 1. When the number of horizontal continuous pixel points is greater than a second numerical threshold, the horizontal continuous pixel points are determined to be a horizontal line. The second numerical threshold is the total number of pixels on the horizontal side of the difference image 1 multiplied by a second preset proportion value.
[0059] Preferably, the system further comprises:
[0060] A data table reference picture acquisition module, used for marking the vertical lines and the horizontal lines in the first data table picture with serial numbers to obtain a data table reference picture;
[0061] The dividing line determination unit includes:
[0062] A vertical line position information acquisition subunit is used to compare the difference image 1 with the reference image in the data table to determine the first vertical line that is compared and overlapped from left to right, and obtain the vertical line sequence number of the first vertical line that is compared and overlapped through the reference image in the data table, and use the vertical line sequence number as the vertical line position information;
[0063] The horizontal line position information acquisition subunit is used to compare the difference image 1 with the data table reference image to determine the first horizontal line that overlaps from top to bottom, and obtain the horizontal line sequence number of the first horizontal line that overlaps through the data table reference image, and use the horizontal line sequence number as the horizontal line position information.
[0064] Preferably, the system further comprises:
[0065] A data table reference sub-picture acquisition module, used for, when there are more than two difference pictures, performing image segmentation on the data table reference picture based on the remaining first vertical dividing lines and / or first horizontal dividing lines to obtain a data table reference sub-picture corresponding one-to-one to the first data table sub-picture;
[0066] The difference point location information acquisition module includes:
[0067] A difference picture determination unit, used to determine whether the difference picture is a blank picture;
[0068] A difference point acquisition marking unit is used to set a sliding frame on a non-blank difference picture, count the number of pixels with a value of 1 in the sliding frame, and when the number of pixels with a value of 1 is greater than a third numerical threshold, determine that the sliding frame has a difference point at the current position, and mark the difference point on the difference picture;
[0069] A difference point position information determination unit is used to compare a difference picture with a difference point with a data table reference picture or a corresponding data table reference sub-picture to determine an upper horizontal line number above the difference point, a lower horizontal line number below the difference point, a left vertical line number to the left of the difference point, and a right vertical line number to the right of the difference point, and use the upper horizontal line number, the lower horizontal line number, the left vertical line number, and the right vertical line number as the difference point position information of the difference point.
[0070] Beneficial Effects
[0071] The method and system provided in the embodiments of the present specification can very quickly determine whether a data table has changed. When a data table has not changed, the data table can be directly skipped to process the next data table, rather than re-collecting data for the data table, thereby effectively improving data collection efficiency; when a data table has changed, the changed data values can be quickly found through the difference points of the difference images, and only the changed data values on the data table need to be collected, without the need to collect all the data values on the data table, so that the data collection efficiency can still be improved, thereby reducing the time consumption of data collection after the data table is changed. BRIEF DESCRIPTION OF THE DRAWINGS
[0072] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0073] Figure 1 It is a flowchart of a report data collection method in one embodiment of this specification.
[0074] Figure 2 It is a schematic diagram of a first data table picture, a second data table picture, a difference picture 1, and a data table reference picture in one embodiment of this specification.
[0075] Figure 3 It is a schematic diagram of a first data table picture, a second data table picture, a first data table sub-picture, and an expanded second data table sub-picture in one embodiment of the present specification.
[0076] Figure 4 It is a schematic diagram of a first data table picture, a first data table sub-picture after segmentation, a second data table picture, and a second data table sub-picture after segmentation in an embodiment of the present specification.
[0077] Figure 5 It is a schematic diagram of a first data table picture after segmentation, a second data table sub-picture after segmentation and already cut or expanded, and a difference picture 2 in an embodiment of the present specification.
[0078] Figure 6 It is a schematic diagram of a data table reference picture after segmentation, a data table reference sub-picture after segmentation, and a difference picture 2 in one embodiment of the present specification.
[0079] Figure 7 It is a schematic diagram of setting a sliding box and difference points for a difference picture in one embodiment of this specification. DETAILED DESCRIPTION
[0080] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0081] In the following introduction, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance. The following introduction provides multiple embodiments of the present application, and different embodiments can be replaced or combined, so the present application can also be considered to include all possible combinations of the same and / or different embodiments recorded. Therefore, if one embodiment includes features A, B, and C, and another embodiment includes features B and D, then the present application should also be considered to include embodiments containing one or more of all other possible combinations of A, B, C, and D, although the embodiment may not be clearly recorded in the following text.
[0082] The following description provides examples and does not limit the scope, applicability or examples set forth in the claims. Changes may be made to the functions and arrangements of the elements described without departing from the scope of the present application. Various processes or components may be appropriately omitted, substituted or added to each example. For example, the described method may be performed in an order different from the order described, and various steps may be added, omitted or combined. In addition, features described in some examples may be combined in other examples.
[0083] Embodiment 1:
[0084] See also Figure 1 , Figure 1 : is a flow chart of a report data collection method provided in an embodiment of the present application. In an embodiment of the present application, the method includes:
[0085] S1. Obtain a first data table and a second data table, and obtain a first data table image based on the first data table and obtain a second data table image based on the second data table.
[0086] The number of data tables used to generate a report is unlimited, and can be one, two, or more. In this embodiment, it is assumed that there are 100 data tables for generating a certain report.
[0087] In this embodiment, the 100 data tables currently input into the report generation system are used as the second data tables, and the 100 data tables previously input into the report generation system are used as the first data tables. Among them, the 100 first data tables correspond to the 100 second data tables one by one. For example, the first data table A1 corresponds to the second data table A2, the first data table B1 corresponds to the second data table B2, the first data table C1 corresponds to the second data table C2... The second data table A2 is the same data table as the first data table A1, except that the data on the second data table A2 may have changed relative to the data on the first data table A1.
[0088] In short, when some data on some of the 100 data tables are changed, the staff will re-enter these 100 data tables into the report generation system. Since the report generation system cannot directly know which data on which data table has changed, it is necessary to re-collect the data in these 100 data tables, which is very time-consuming. To this end, this embodiment proposes a new report data collection method, which is mainly used to collect data from the changed data table, thereby improving the efficiency of report data collection and reducing the time consumption of report data collection.
[0089] This step takes the first data table A1 and the second data table A2 as an example. The report data acquisition system integrated in the report generation system automatically obtains the first data table A1 and the second data table A2, and automatically performs image capture on the first data table A1 to obtain the first data table picture, and automatically performs image capture on the second data table A2 to obtain the second data table picture. When performing image capture on the first data table A1, it is necessary to determine the first capture base point a11 and the second capture base point a12 on the display interface. The first capture base point a11 is located at the upper left corner of the first data table A1, and the second capture base point a12 is located at the lower right corner of the first data table A1. When performing image capture on the second data table A2, it is necessary to determine the first capture base point a21 and the second capture base point a22 on the display interface. The first capture base point a21 is located at the upper left corner of the second data table A2, and the second capture base point a22 is located at the lower right corner of the second data table A2. Among them, the positions of the first interception base point a11 and the first interception base point a21 on the display interface are the same, and the positions of the second interception base point a12 and the second interception base point a22 on the display interface are the same, so that the sizes of the intercepted first data table image and the second data table image are the same.
[0090] If the first data table A1 and the second data table A2 are exactly the same (no data change occurs), then the captured first data table image and the captured second data table image are exactly the same.
[0091] S2. Obtain a difference picture based on the first data table picture and the second data table picture.
[0092] In the embodiment of the present specification, in S2, obtaining a difference picture based on the first data table picture and the second data table picture specifically includes:
[0093] S21. Binarize the first data table image and the second data table image and perform difference processing to obtain a difference image 1.
[0094] Taking the first data table picture D1 and the second data table picture D2 as examples, the first data table picture D1 is first binarized to obtain the binarized first data table picture D1, and then the second data table picture D2 is binarized to obtain the binarized second data table picture D2. The binarized first data table picture D1 only has black table lines and black data values, and similarly, the binarized second data table picture D2 also has black table lines and black data values. Finally, the binarized first data table picture D1 and the binarized second data table picture D2 are subtracted to obtain a difference picture 1.
[0095] S22. Determine whether there are vertical lines and / or horizontal lines on the difference picture 1. If there are no vertical lines and / or horizontal lines, take the difference picture 1 as the difference picture; if there are vertical lines and / or horizontal lines, enter S23.
[0096] Case 1: The first data table image is exactly the same as the second data table image (the table lines and data values have not changed), then the difference image 1 is blank, and there are no vertical lines and / or horizontal lines on the difference image 1. In this case, the difference image 1 is directly used as the difference image.
[0097] Case 2: Some data values have changed, but the table lines of the first data table image and the second data table image are still the same (it may be because the setting properties of the table are such that the table lines do not change adaptively with the length of the data values; it may also be that the data values themselves change slightly and will not cause the position of the table lines to move). In this case, the difference picture 1 obtained is an independent area with black pixels on the blank picture. The independent area can be one, two or more, and the size of the independent area is similar to the size of a data filling box on the data table. However, there are still no vertical lines and / or horizontal lines on the difference picture 1. At this time, the difference picture 1 is also directly used as the difference picture.
[0098] Case 3: Some data values have changed, and the position of the table lines has changed due to the change in data values (the table lines of these data tables will automatically adapt according to the length of the data). For example, the data value in the data filling box in the second row of the last column has changed. Assuming that the data value has become longer, the last vertical line from left to right in the table line will move to the right as a whole, making the last vertical line of the first data table image D1 and the last vertical line of the second data table image D2 staggered. At this time, there will be two vertical lines on the difference image.
[0099] Assuming that the data value in the data filling box in the second row from the second to last column has changed, and assuming that the data value has become longer, then the second to last and the first to last vertical lines from left to right in the table line will move to the right as a whole, so that the last two vertical lines of the first data table picture D1 and the last two vertical lines of the second data table picture D2 are staggered. At this time, there will be four vertical lines on the difference picture.
[0100] In short, in some data tables, when the length of a data value changes, the vertical table line to the right of the data value will move; or the horizontal table line below the data value will move, resulting in the existence of vertical lines and / or horizontal lines on the difference image 1, and then entering S23.
[0101] In addition, in S22, determining whether there is a vertical line and / or a horizontal line on the difference image 1 specifically includes:
[0102] Obtain vertically continuous pixel points whose value is one (i.e., black) in the difference image 1. When the number of the vertically continuous pixel points is greater than a first numerical threshold, the vertically continuous pixel points are determined to be a vertical line. The first numerical threshold is the total number of pixels on the vertical side of the difference image 1 multiplied by a first preset ratio. In this embodiment, the first preset ratio may be 0.8. Assuming that the total number of pixels on the vertical side of the difference image 1 is 1000, the first numerical threshold is 800. When the number of the vertically continuous pixel points obtained is greater than 800, the vertically continuous pixel points are determined to be a vertical line.
[0103] Obtain horizontally continuous pixel points with a value of 1 in the difference image 1. When the number of horizontally continuous pixel points is greater than a second numerical threshold, the horizontally continuous pixel points are determined to be a horizontal line. The second numerical threshold is the total number of horizontal pixels of the difference image 1 multiplied by a second preset ratio. In this embodiment, the first preset ratio may be 0.7. Assuming that the total number of horizontal pixels of the difference image 1 is 900, the second numerical threshold is 630. When the number of horizontally continuous pixel points obtained is greater than 630, the horizontally continuous pixel points are determined to be a horizontal line.
[0104] S23. If there is a vertical line, the vertical line position information is obtained, and based on the vertical line position information, a first vertical dividing line is determined on the first data table picture and a second vertical dividing line is determined on the second data table picture; if there is a horizontal line, the horizontal line position information is obtained, and based on the horizontal line position information, a first horizontal dividing line is determined on the first data table picture and a second horizontal dividing line is determined on the second data table picture.
[0105] In the embodiment of the present specification, before S23, the step further includes: marking the vertical lines and the horizontal lines in the first data table picture with serial numbers to obtain a data table reference picture.
[0106] In S23, obtaining the vertical line position information specifically includes:
[0107] The difference image 1 is compared with the reference image in the data table to determine the first vertical line that overlaps from left to right, and the vertical line sequence number of the first vertical line that overlaps is obtained through the reference image in the data table, and the vertical line sequence number is used as the vertical line position information.
[0108] like Figure 2 As shown, dotted frame 1 is the first data table image, dotted frame 2 is the second data table image, dotted frame 3 is the difference image 1, and dotted frame 4 is the data table reference image. This step only requires comparing the first vertical line in dotted frame 3 with the data table reference image in dotted frame 4. Since the first vertical line in dotted frame 3 can be compared and overlapped with the fourth vertical line in dotted frame 4, the first vertical line in dotted frame 3 is used as the first vertical line for comparison and overlap, and the vertical line sequence number "vertical 4" of the fourth vertical line in dotted frame 4 is used as the vertical line position information of the first vertical line for comparison and overlap (i.e., the first vertical line in dotted frame 3).
[0109] Since the vertical line position information is "vertical 4", the 4th vertical line in the dotted frame 1 is used as the first vertical dividing line of the first data table picture, and the 4th vertical line in the dotted frame 2 is used as the second vertical dividing line of the second data table picture.
[0110] In S23, obtaining the horizontal line position information specifically includes:
[0111] The difference image 1 is compared with the reference image in the data table to determine the first horizontal line that overlaps from top to bottom, and the horizontal line number of the first horizontal line that overlaps is obtained through the reference image in the data table, and the horizontal line number is used as the horizontal line position information.
[0112] The specific method for acquiring the horizontal line position information is the same as the specific method for acquiring the vertical line position information. The first horizontal dividing line and the second horizontal dividing line are acquired in the same manner as the first vertical dividing line and the second vertical dividing line.
[0113] Furthermore, S23 also includes: performing image segmentation on the first data table picture based on the first vertical dividing line and / or the first horizontal dividing line to obtain at least two first data table sub-pictures, and determining whether only one first data table sub-picture among all the first data table sub-pictures is a non-blank picture, and if so, taking the difference picture 1 as the difference picture; if not, entering S24.
[0114] like Figure 2 As shown, when the fourth vertical line in the dotted frame 1 is used as the first vertical dividing line of the first data table image (the first horizontal dividing line is not obtained), the first data table image is divided into two first data table sub-images, of which the left first data table sub-image is a non-blank image, and the right first data table sub-image is a blank image, that is, only one first data table sub-image among all the first data table sub-images is a non-blank image, and at this time, the difference image 1 is directly used as the difference image.
[0115] When the data value in the rightmost column of data in the first data table changes, causing the rightmost vertical line of the table to move, or when the data value in the bottommost row of data in the first data table changes, causing the bottommost horizontal line of the table to move, or when the data value in the bottom rightmost data frame in the first data table changes, causing the rightmost vertical line of the table and the bottommost horizontal line of the table to move, the first vertical dividing line and / or the first horizontal dividing line will be obtained, but only one first data table sub-image (i.e., the leftmost or topmost or upper leftmost first data table sub-image) among the divided first data table sub-images is a non-blank image. At this time, the difference image 1 can be directly used as the difference image.
[0116] S24. Perform image segmentation on the second data table picture based on the second vertical segmentation line and / or the second horizontal segmentation line to obtain at least two second data table sub-pictures.
[0117] If there is more than one first data table sub-picture in the segmented first data table sub-picture, the second data table picture is segmented based on the second vertical segmentation line and / or the second horizontal segmentation line to obtain at least two second data table sub-pictures.
[0118] Furthermore, S24 also includes: obtaining a first data table sub-image located at the rightmost, bottommost, or lower-rightmost side of the first data table image and obtaining a second data table sub-image located at the rightmost, bottommost, or lower-rightmost side of the second data table image, cutting or expanding the second data table sub-image so that the size of the second data table sub-image is the same as the size of the corresponding first data table sub-image, and binarizing the first data table sub-image and the second data table sub-image for difference processing to obtain a sub-difference image.
[0119] When the data value in a data frame in the first data table changes, if it only causes the vertical line of the table to move, the first data table image will be split into the first data table sub-image on the left and the first data table sub-image on the right, and the first data table sub-image on the right can be obtained. Correspondingly, the second data table sub-image on the right can be obtained.
[0120] When the data value in a data frame in the first data table changes, if only the horizontal line of the table moves, the first data table image will be split into the upper first data table sub-image and the lower first data table sub-image, and the lower first data table sub-image can be obtained at this time. Correspondingly, the lower second data table sub-image can be obtained.
[0121] When the data value in a data frame in the first data table changes, if it only causes the vertical line and the horizontal line of the table to move, the first data table image will be divided into the first data table sub-image on the upper left side, the first data table sub-image on the upper right side, the first data table sub-image on the lower left side, and the first data table sub-image on the lower right side. At this time, the first data table sub-image on the lower right side can be obtained. Correspondingly, the second data table sub-image on the lower right side can be obtained.
[0122] like Figure 3 As shown, the solid line frame 5 is the first data table picture and has a first vertical dividing line, the solid line frame 6 is the second data table picture and has a second vertical dividing line, the solid line frame 52 is the first data table sub-picture located on the right, and the solid line frame 62' is the second data table sub-picture located on the right and the second data table sub-picture has been expanded to the same size as the corresponding first data table sub-picture.
[0123] Taking the first data table sub-image F1 on the far right and the second data table sub-image F2 on the far right as examples, the first data table sub-image F1 is first binarized to obtain the binarized first data table sub-image F1, and then the second data table sub-image F2 is binarized to obtain the binarized second data table sub-image F2. The binarized first data table sub-image F1 only has black table lines and black data values, and similarly, the binarized second data table sub-image F2 also has black table lines and black data values. Finally, the binarized first data table sub-image F1 and the binarized second data table sub-image F2 are subtracted to obtain a sub-difference image.
[0124] Furthermore, S24 also includes: determining whether there are vertical lines and / or horizontal lines on the sub-difference picture, if there are no vertical lines and / or horizontal lines, entering S25; if there are vertical lines and / or horizontal lines, returning to S23.
[0125] like Figure 3 As shown, the sub-difference image obtained by performing binarization and difference processing on the first data table sub-image in the solid line frame 52 and the second data table sub-image in the solid line frame 62' does not have vertical lines and / or horizontal lines, and the process directly enters S25. If vertical lines and / or horizontal lines exist, the process returns to S23, and more segmentation lines and data table sub-images are obtained by repeatedly executing S23 and S24.
[0126] In addition, in S24, determining whether there are vertical lines and / or horizontal lines on the sub-difference picture specifically includes:
[0127] Obtain vertically continuous pixel points whose value is one (i.e., black) in the sub-difference image. When the number of the vertically continuous pixel points is greater than a first numerical threshold, the vertically continuous pixel points are determined to be a vertical line. The first numerical threshold is the total number of pixels on the vertical side of the sub-difference image multiplied by a first preset ratio. In this embodiment, the first preset ratio may be 0.8. Assuming that the total number of pixels on the vertical side of the sub-difference image is 500, the first numerical threshold is 400. When the number of the vertically continuous pixel points obtained is greater than 400, the vertically continuous pixel points are determined to be a vertical line.
[0128] Obtain horizontally continuous pixel points whose value is one in the sub-difference image. When the number of the horizontally continuous pixel points is greater than a second numerical threshold, determine that the horizontally continuous pixel points are a horizontal line. The second numerical threshold is the total number of pixels on the horizontal side of the sub-difference image multiplied by a second preset ratio. In this embodiment, the first preset ratio may be 0.7. Assuming that the total number of pixels on the horizontal side of the sub-difference image is 400, the second numerical threshold is 280. When the number of the horizontally continuous pixel points obtained is greater than 280, determine that the horizontally continuous pixel points are a horizontal line.
[0129] S25. Remove the first vertical dividing line that coincides with the rightmost vertical line of the table in the first data table picture and remove the first horizontal dividing line that coincides with the bottommost horizontal line of the table in the first data table picture, and perform image segmentation on the first data table picture based on the remaining first vertical dividing lines and / or first horizontal dividing lines to obtain at least two first data table sub-pictures;
[0130] Remove the second vertical dividing line that coincides with the rightmost vertical line of the table in the second data table image, and remove the second horizontal dividing line that coincides with the bottommost horizontal line of the table in the second data table image, and perform image segmentation on the second data table image based on the remaining second vertical dividing line and / or second horizontal dividing line to obtain at least two second data table sub-images.
[0131] After entering S25, all the first vertical dividing lines and the second vertical dividing lines can be determined by all the vertical line position information, and all the first horizontal dividing lines and the second horizontal dividing lines can be determined by all the horizontal line position information. First, remove the first vertical dividing line that overlaps with the rightmost vertical line of the table in the first data table picture and remove the first horizontal dividing line that overlaps with the bottommost horizontal line of the table in the first data table picture, and then use all the remaining first vertical dividing lines and / or first horizontal dividing lines to perform image segmentation on the first data table picture to obtain at least two first data table sub-pictures. At the same time, first remove the second vertical dividing line that overlaps with the rightmost vertical line of the table in the second data table picture and remove the second horizontal dividing line that overlaps with the bottommost horizontal line of the table in the second data table picture, and then use all the remaining second vertical dividing lines and / or second horizontal dividing lines to perform image segmentation on the second data table picture to obtain at least two second data table sub-pictures.
[0132] like Figure 4 As shown, the solid line frame 5 is the first data table picture and has a first vertical dividing line. The first data table picture does not have a first horizontal dividing line and the first vertical dividing line does not overlap with the rightmost vertical line of the table in the first data table picture. Therefore, the first data table picture can be directly divided by the first vertical dividing line. Among them, the solid line frame 51 is the first first data table sub-picture obtained by cutting the first data table picture, and the solid line frame 52 is the second first data table sub-picture obtained by cutting the first data table picture.
[0133] The solid line frame 6 is the second data table picture and has a second vertical dividing line. The second data table picture does not have a second horizontal dividing line and the second vertical dividing line does not overlap with the rightmost vertical line of the table in the second data table picture. Therefore, the second data table picture can be directly divided by the second vertical dividing line. The solid line frame 61 is the first second data table sub-picture obtained by cutting the second data table picture, and the solid line frame 62 is the second second data table sub-picture obtained by cutting the second data table picture.
[0134] Furthermore, S25 also includes: cutting or expanding all the second data table sub-pictures so that the size of the second data table sub-pictures is the same as the size of the corresponding first data table sub-pictures, performing one-to-one binarization and difference processing on all the first data table sub-pictures and all the second data table sub-pictures to obtain more than two difference pictures two, and using all the difference pictures two as difference pictures.
[0135] like Figure 5As shown, the solid line frame 51 is the first first data table sub-image obtained by cutting the first data table image, and the solid line frame 52 is the second first data table sub-image obtained by cutting the first data table image. The solid line frame 61' is the second data table sub-image obtained by cutting the first second data table sub-image according to the size of the first first data table sub-image, and the solid line frame 62' is the second second data table sub-image obtained by expanding the second second data table sub-image according to the size of the second first data table sub-image.
[0136] Solid line frame 7 is a process of performing binarization and difference processing on the first data table sub-image in solid line frame 51 and the second data table sub-image in solid line frame 61' to obtain the first difference image 2. Solid line frame 8 is a process of performing binarization and difference processing on the first data table sub-image in solid line frame 52 and the second data table sub-image in solid line frame 62' to obtain the second difference image 2. Finally, the first difference image 2 and the second difference image 2 are both used as difference images.
[0137] S3. Obtain difference points on the difference image, and determine difference point position information of the obtained difference points.
[0138] This embodiment further includes before S3:
[0139] When there are more than two difference pictures, the data table reference picture is segmented based on the first vertical dividing line and / or the first horizontal dividing line remaining in S25 to obtain data table reference sub-pictures corresponding one-to-one to the first data table sub-pictures.
[0140] like Figure 6 As shown, solid line frame 9 is a data table reference picture and has a first vertical dividing line, solid line frame 91 is the first data table reference sub-picture obtained by dividing the data table reference picture, and solid line frame 92 is the second data table reference sub-picture obtained by dividing the data table reference picture. Solid line frame 7 is the first difference picture, and solid line frame 8 is the second difference picture.
[0141] In short, when there is only one difference picture, the data table reference picture does not need to be segmented; when there are more than two difference pictures, the data table reference picture is segmented, and the segmentation method is the same as the image segmentation method of the first data table picture in S25.
[0142] In the embodiment of this specification, S3 specifically includes:
[0143] S31. Determine whether the difference picture is a blank picture. When the difference picture is a non-blank picture, enter S32.
[0144] Whether the difference picture is a blank picture can be determined by counting the total number of pixels with a value of one on the entire difference picture. When the total number of pixels is greater than the total number threshold, the difference picture is determined to be a non-blank picture; otherwise, the difference picture is determined to be a blank picture. When a certain difference picture is a blank picture, the next difference picture is replaced for processing; if there is only one difference picture and the difference picture is a blank picture, the next data table is replaced for processing; if a certain difference picture is a non-blank picture, enter S32 to continue processing.
[0145] The first difference picture in the solid line frame 7 is a non-blank picture, so it enters S32 for further processing. The second difference picture in the solid line frame 8 is not a non-blank picture, so it does not need to enter S32 for further processing.
[0146] S32. Set a sliding box on the difference picture, count the number of pixels with a value of one in the sliding box, and when the number of pixels with a value of one is greater than a third numerical threshold, determine that the sliding box has a difference point at the current position, and mark the difference point on the difference picture.
[0147] This embodiment does not limit the specific size of the sliding box, which can be similar to the size of the data grid in the data table. In this embodiment, the third number threshold can be 6. Figure 7 As shown, the solid line frame 7' sets a sliding frame for the first difference picture. When the sliding frame slides to the upper rightmost position, the number of pixels with a value of 1 in the sliding frame is greater than the third numerical threshold, so a difference point is marked at this position. When the sliding frame slides to the lower rightmost position, the number of pixels with a value of 1 in the sliding frame is also greater than the third numerical threshold, so a difference point is also marked at this position of the first difference picture. Finally, there are two difference points on the first difference picture.
[0148] S33. Compare the difference picture with the difference point with the data table reference picture or the corresponding data table reference sub-picture to determine the upper horizontal line number above the difference point, the lower horizontal line number below the difference point, the left vertical line number to the left of the difference point and the right vertical line number to the right of the difference point, and use the upper horizontal line number, the lower horizontal line number, the left vertical line number and the right vertical line number as the difference point position information of the difference point.
[0149] This step will Figure 7 The first difference picture with the difference point in the solid line frame 7' and Figure 6By comparing the first data table in the solid line frame 91 with reference to the sub-image, it can be determined that the upper horizontal line numbered above the first difference point is horizontal 1; the lower horizontal line numbered below the first difference point is horizontal 2; the left vertical line numbered to the left of the first difference point is vertical 3; and the right vertical line numbered to the right of the first difference point is vertical 4. Therefore, the difference point position information of the first difference point is: horizontal 1, horizontal 2, vertical 3, and vertical 4. It can also be determined that the upper horizontal line numbered above the second difference point is horizontal 2; the lower horizontal line numbered below the second difference point is horizontal 3; the left vertical line numbered to the left of the second difference point is vertical 3; and the right vertical line numbered to the right of the second difference point is vertical 4. Therefore, the difference point position information of the second difference point is: horizontal 2, horizontal 3, vertical 3, and vertical 4.
[0150] In short, S3 can be used to determine whether there are difference points on the difference image, and if there are difference points, the location information of the difference points can be obtained.
[0151] S4. If the difference point is obtained, obtain the first data value in the first data table picture according to the difference point position information of the difference point and obtain the corresponding second data value in the second data table picture according to the difference point position information.
[0152] If S3 cannot obtain the difference point, it means that the first data table and the second data table are the same (that is, the data table has not changed). In this case, the data table is directly skipped (that is, data collection for the data table is not required) and the next data table is processed.
[0153] If the difference point is obtained in S3, the first data value is obtained in the first data table picture according to the difference point position information, and the second data value is obtained in the second data table picture according to the difference point position information.
[0154] like Figure 4 As shown, through the difference point position information of the first difference point (i.e., horizontal 1, horizontal 2, vertical 3, and vertical 4), the first data value: Y2 can be obtained in the first data table image; and the second data value: Y2 can be obtained in the second data table image. Through the difference point position information of the second difference point (i.e., horizontal 2, horizontal 3, vertical 3, and vertical 4), the first data value: a2 can be obtained in the first data table image; and the second data value: a2888888 can be obtained in the second data table image.
[0155] Furthermore, S4 also includes: comparing the first data value with the corresponding second data value to determine whether the first data value has changed, when the first data value has changed, determining the filling position of the first data value in the report, and updating the report data value in the filling position based on the second data value.
[0156] When the first data value obtained from a certain difference point is Y2 and the second data value is Y2, it means that the first data value has not changed, and the difference point can be ignored directly. When the first data value obtained from a certain difference point is a2 and the second data value is a2888888, it means that the first data value has changed. If the generation of the report has nothing to do with the first data value, then the corresponding filling position will not be found, and the difference point can be ignored directly. If the corresponding filling position in the report can be found through a certain mapping relationship, it means that the change of the first data value will cause the change of the report. At this time, the report data value in the filling position is updated based on the second data value (the report data value can be directly adopted from the second data value, or it can be obtained through processing of the second data value).
[0157] When the first data values and the second data values of all the difference points are processed, it means that the data collection operation of the data table is completed. At this time, the next data table is processed through S1 to S4 until all the data tables are processed.
[0158] This embodiment assumes that 60 of the 100 data tables have not changed at all; the data values in 30 data tables have changed, but the table lines have not changed; and the data values and table lines in 10 data tables have changed. Through the report data collection method of this embodiment, it is possible to very quickly determine whether a data table has changed. When a data table has not changed, it is possible to directly skip the data table to process the next data table, rather than recollecting data for the data table, thereby effectively improving data collection efficiency. When a data table changes, the changed data values can also be quickly found through the difference points of the difference pictures. It is only necessary to collect the changed data values on the data table, and it is not necessary to collect all the data values on the data table. Therefore, it is still possible to improve data collection efficiency, thereby reducing the time consumption of data collection after the data table is changed.
[0159] Embodiment 2:
[0160] The report data collection system provided in the embodiment of the present application is described in detail below. It should be noted that the report data collection system is used to execute the method of embodiment 1 of the present application. For the convenience of description, only the part related to the embodiment of the present application is shown. For the specific technical details not disclosed, please refer to embodiment 1 of the present application.
[0161] A report data collection system, comprising:
[0162] A data table image acquisition module, used to acquire a first data table and a second data table, and acquire a first data table image based on the first data table and acquire a second data table image based on the second data table;
[0163] A difference picture acquisition module, used for acquiring a difference picture based on the first data table picture and the second data table picture;
[0164] A difference point position information acquisition module is used to acquire difference points on the difference image and determine the difference point position information of the acquired difference points;
[0165] A data value acquisition module, configured to acquire a first data value in the first data table image according to the difference point position information of the difference point if a difference point is acquired, and acquire a corresponding second data value in the second data table image according to the difference point position information;
[0166] a data value change determination module, used to compare the first data value with the corresponding second data value to determine whether the first data value has changed;
[0167] The report data value updating module is used to determine the filling position of the first data value in the report when the first data value changes, and update the report data value in the filling position based on the second data value.
[0168] In one possible implementation, the difference picture acquisition module includes:
[0169] A difference picture 1 acquisition unit, used for performing binarization and difference processing on the first data table picture and the second data table picture to obtain a difference picture 1;
[0170] a first difference picture determination unit, configured to determine whether there are vertical lines and / or horizontal lines on the first difference picture, and if there are no vertical lines and / or horizontal lines, use the first difference picture as the difference picture;
[0171] a dividing line determining unit, configured to obtain vertical line position information if there is a vertical line, and determine a first vertical dividing line on the first data table picture based on the vertical line position information, and determine a second vertical dividing line on the second data table picture; and obtain horizontal line position information if there is a horizontal line, and determine a first horizontal dividing line on the first data table picture based on the horizontal line position information, and determine a second horizontal dividing line on the second data table picture;
[0172] A first data table sub-picture obtaining unit, configured to perform image segmentation on the first data table picture based on a first vertical dividing line and / or a first horizontal dividing line to obtain at least two first data table sub-pictures;
[0173] The second difference picture determination unit is used to determine whether only one first data table sub-picture among all the first data table sub-pictures is a non-blank picture, and if so, the first difference picture is used as the difference picture;
[0174] A second data table sub-picture obtaining unit, configured to perform image segmentation on the second data table picture based on a second vertical dividing line and / or a second horizontal dividing line to obtain at least two second data table sub-pictures;
[0175] a sub-difference picture acquisition unit, configured to acquire a first data table sub-picture located at the rightmost, bottommost, or lower-rightmost side of the first data table picture and acquire a second data table sub-picture located at the rightmost, bottommost, or lower-rightmost side of the second data table picture, cut or expand the second data table sub-picture so that the size of the second data table sub-picture is the same as the size of the corresponding first data table sub-picture, and perform binarization and difference processing on the first data table sub-picture and the second data table sub-picture to obtain a sub-difference picture;
[0176] a sub-difference picture determination unit, configured to determine whether there are vertical lines and / or horizontal lines on the sub-difference picture;
[0177] a first data table sub-image determining unit, configured to remove a first vertical dividing line that coincides with the rightmost vertical line of the table in the first data table image and remove a first horizontal dividing line that coincides with the bottommost horizontal line of the table in the first data table image, and perform image segmentation on the first data table image based on the remaining first vertical dividing lines and / or first horizontal dividing lines to obtain at least two first data table sub-images;
[0178] a second data table sub-image determining unit, configured to remove a second vertical dividing line that coincides with the rightmost vertical line of the table in the second data table image, and remove a second horizontal dividing line that coincides with the bottommost horizontal line of the table in the second data table image, and perform image segmentation on the second data table image based on the remaining second vertical dividing line and / or second horizontal dividing line to obtain at least two second data table sub-images;
[0179] The difference picture determination unit three is used to cut or expand all the second data table sub-pictures so that the size of the second data table sub-pictures is the same as the size of the corresponding first data table sub-pictures, and to perform one-to-one binarization and difference processing on all the first data table sub-pictures and all the second data table sub-pictures to obtain more than two difference pictures two, and all the difference pictures two are used as difference pictures.
[0180] In one possible implementation, the difference picture determination unit 1 includes:
[0181] A vertical line determination subunit is used to obtain vertical continuous pixel points with a value of 1 in the difference image 1, and when the number of the vertical continuous pixel points is greater than a first numerical threshold, the vertical continuous pixel points are determined to be a vertical line, and the first numerical threshold is the total number of pixels on the vertical side of the difference image 1 multiplied by a first preset ratio value;
[0182] The horizontal line determination subunit is used to obtain horizontal continuous pixel points with a value of one in the difference image 1. When the number of horizontal continuous pixel points is greater than a second numerical threshold, the horizontal continuous pixel points are determined to be a horizontal line. The second numerical threshold is the total number of pixels on the horizontal side of the difference image 1 multiplied by a second preset proportion value.
[0183] In one possible implementation, the system further includes:
[0184] A data table reference picture acquisition module, used for marking the vertical lines and the horizontal lines in the first data table picture with serial numbers to obtain a data table reference picture;
[0185] The dividing line determination unit includes:
[0186] A vertical line position information acquisition subunit is used to compare the difference image 1 with the reference image in the data table to determine the first vertical line that is compared and overlapped from left to right, and obtain the vertical line sequence number of the first vertical line that is compared and overlapped through the reference image in the data table, and use the vertical line sequence number as the vertical line position information;
[0187] The horizontal line position information acquisition subunit is used to compare the difference image 1 with the data table reference image to determine the first horizontal line that overlaps from top to bottom, and obtain the horizontal line sequence number of the first horizontal line that overlaps through the data table reference image, and use the horizontal line sequence number as the horizontal line position information.
[0188] In one possible implementation, the system further includes:
[0189] A data table reference sub-picture acquisition module, used for, when there are more than two difference pictures, performing image segmentation on the data table reference picture based on the remaining first vertical dividing lines and / or first horizontal dividing lines to obtain a data table reference sub-picture corresponding one-to-one to the first data table sub-picture;
[0190] The difference point location information acquisition module includes:
[0191] A difference picture determination unit, used to determine whether the difference picture is a blank picture;
[0192] A difference point acquisition marking unit is used to set a sliding frame on a non-blank difference picture, count the number of pixels with a value of 1 in the sliding frame, and when the number of pixels with a value of 1 is greater than a third numerical threshold, determine that the sliding frame has a difference point at the current position, and mark the difference point on the difference picture;
[0193] A difference point position information determination unit is used to compare a difference picture with a difference point with a data table reference picture or a corresponding data table reference sub-picture to determine an upper horizontal line number above the difference point, a lower horizontal line number below the difference point, a left vertical line number to the left of the difference point, and a right vertical line number to the right of the difference point, and use the upper horizontal line number, the lower horizontal line number, the left vertical line number, and the right vertical line number as the difference point position information of the difference point.
[0194] The above are merely exemplary embodiments of the present application and are not intended to limit the scope of the present application.
Claims
1. A report data collection method, characterized in that: The method comprises: S1. Obtain a first data table and a second data table, and obtain a first data table image based on the first data table and obtain a second data table image based on the second data table; S2. Obtaining a difference picture based on the first data table picture and the second data table picture; S3. Obtaining the difference point on the difference picture, and determining the difference point position information of the obtained difference point; S4. If a difference point is obtained, obtaining a first data value in the first data table image according to the difference point position information of the difference point and obtaining a corresponding second data value in the second data table image according to the difference point position information; Comparing the first data value with the corresponding second data value to determine whether the first data value has changed, and when the first data value has changed, determining the filling position of the first data value in the report, and updating the report data value in the filling position based on the second data value; The S2 specifically includes: S21. Binarize the first data table image and the second data table image to obtain a difference image 1; S22. Determine whether there are vertical lines and / or horizontal lines on the difference picture 1. If there are no vertical lines and / or horizontal lines, use the difference picture 1 as the difference picture; if there are vertical lines and / or horizontal lines, proceed to S23; S23. If there is a vertical line, obtain the vertical line position information, and determine a first vertical dividing line on the first data table picture based on the vertical line position information and determine a second vertical dividing line on the second data table picture; if there is a horizontal line, obtain the horizontal line position information, and determine a first horizontal dividing line on the first data table picture based on the horizontal line position information and determine a second horizontal dividing line on the second data table picture; Performing image segmentation on the first data table picture based on the first vertical dividing line and / or the first horizontal dividing line to obtain at least two first data table sub-pictures, and determining whether only one of all the first data table sub-pictures is a non-blank picture, if so, taking the difference picture 1 as the difference picture; if not, entering S24; S24. performing image segmentation on the second data table picture based on the second vertical segmentation line and / or the second horizontal segmentation line to obtain at least two second data table sub-pictures; Obtain a first data table sub-image located at the rightmost, bottommost, or lower-rightmost side of the first data table image, and obtain a second data table sub-image located at the rightmost, bottommost, or lower-rightmost side of the second data table image, cut or expand the second data table sub-image so that the size of the second data table sub-image is the same as the size of the corresponding first data table sub-image, and perform binarization and difference processing on the first data table sub-image and the second data table sub-image to obtain a sub-difference image; Determine whether there are vertical lines and / or horizontal lines on the sub-difference picture, if there are no vertical lines and / or horizontal lines, proceed to S25; if there are vertical lines and / or horizontal lines, return to S23; S25. removing the first vertical dividing line that coincides with the rightmost vertical line of the table in the first data table picture and removing the first horizontal dividing line that coincides with the bottommost horizontal line of the table in the first data table picture, and performing image segmentation on the first data table picture based on the remaining first vertical dividing line and / or first horizontal dividing line to obtain at least two first data table sub-pictures; Removing the second vertical dividing line that coincides with the rightmost vertical line of the table in the second data table picture and removing the second horizontal dividing line that coincides with the bottommost horizontal line of the table in the second data table picture, and performing image segmentation on the second data table picture based on the remaining second vertical dividing line and / or second horizontal dividing line to obtain at least two second data table sub-pictures; All the second data table sub-images are cut or expanded so that the size of the second data table sub-images is the same as the size of the corresponding first data table sub-images, all the first data table sub-images and all the second data table sub-images are one-to-one binarized and differenced to obtain more than two difference images two, and all the difference images two are used as the difference images.
2. The method according to claim 1, characterized in that In S22, determining whether there are vertical lines and / or horizontal lines on the difference picture 1 specifically includes: Obtaining vertically continuous pixel points whose value is one in the difference image 1, and when the number of the vertically continuous pixel points is greater than a first numerical threshold, determining that the vertically continuous pixel points are a vertical line, wherein the first numerical threshold is the total number of pixels on the vertical side of the difference image 1 multiplied by a first preset proportion value; Obtain horizontal continuous pixel points with a value of one in the difference image one. When the number of the horizontal continuous pixel points is greater than a second numerical threshold, determine that the horizontal continuous pixel points are a horizontal line. The second numerical threshold is the total number of pixels on the horizontal side of the difference image one multiplied by a second preset proportion value.
3. The method according to claim 1, characterized in that Before S23, the method further includes: Marking the vertical lines and the horizontal lines in the first data table picture with serial numbers to obtain a data table reference picture; In S23, obtaining the vertical line position information specifically includes: Compare the difference image 1 with the reference image in the data table to determine the first vertical line that is compared and overlapped from left to right, and obtain the vertical line sequence number of the first vertical line that is compared and overlapped through the reference image in the data table, and use the vertical line sequence number as the vertical line position information; In the step S23, obtaining the horizontal line position information specifically includes: The difference image 1 is compared with the reference image in the data table to determine the first horizontal line that overlaps from top to bottom, and the horizontal line number of the first horizontal line that overlaps is obtained through the reference image in the data table, and the horizontal line number is used as the horizontal line position information.
4. The method according to claim 3, characterized in that Before the S3, it also includes: When there are more than two difference pictures, performing image segmentation on the data table reference picture based on the first vertical dividing line and / or the first horizontal dividing line remaining in S25 to obtain data table reference sub-pictures corresponding one to one to the first data table sub-pictures; The S3 specifically includes: S31. Determine whether the difference picture is a blank picture. When the difference picture is a non-blank picture, proceed to S32; S32. Setting a sliding frame on the non-blank difference picture, counting the number of pixels with a value of one in the sliding frame, and when the number of pixels with a value of one is greater than a third numerical threshold, determining that the sliding frame has a difference point at the current position, and marking the difference point on the difference picture; S33. Compare the difference picture with the difference point with the data table reference picture or the corresponding data table reference sub-picture to determine the upper horizontal line number above the difference point, the lower horizontal line number below the difference point, the left vertical line number to the left of the difference point and the right vertical line number to the right of the difference point, and use the upper horizontal line number, the lower horizontal line number, the left vertical line number and the right vertical line number as the difference point position information of the difference point.
5. A report data collection system, characterized in that: The system comprises: A data table image acquisition module, used to acquire a first data table and a second data table, and acquire a first data table image based on the first data table and acquire a second data table image based on the second data table; A difference picture acquisition module, used for acquiring a difference picture based on the first data table picture and the second data table picture; A difference point position information acquisition module, used to acquire difference points on the difference picture, and determine the acquired difference point position information of the difference points; a data value acquisition module, configured to, if a difference point is obtained, acquire a first data value in the first data table image according to the difference point position information of the difference point, and acquire a corresponding second data value in the second data table image according to the difference point position information; a data value change determination module, configured to compare the first data value with the corresponding second data value to determine whether the first data value has changed; a report data value updating module, configured to determine a setting position of the first data value in the report when the first data value changes, and to update the report data value in the setting position based on the second data value; The difference picture acquisition module includes: A difference picture 1 acquisition unit, configured to perform a binarization and difference processing on the first data table picture and the second data table picture to obtain a difference picture 1; a first difference picture determination unit, configured to determine whether there are vertical lines and / or horizontal lines on the first difference picture, and if there are no vertical lines and / or horizontal lines, use the first difference picture as the difference picture; a dividing line determining unit, configured to obtain vertical line position information if there is a vertical line, and determine a first vertical dividing line on the first data table picture based on the vertical line position information, and determine a second vertical dividing line on the second data table picture; and to obtain horizontal line position information if there is a horizontal line, and determine a first horizontal dividing line on the first data table picture based on the horizontal line position information, and determine a second horizontal dividing line on the second data table picture; A first data table sub-picture obtaining unit, configured to perform image segmentation on the first data table picture based on the first vertical dividing line and / or the first horizontal dividing line to obtain at least two first data table sub-pictures; a second difference picture determination unit, configured to determine whether only one of the first data table sub-pictures is a non-blank picture among all the first data table sub-pictures, and if so, use the first difference picture as the difference picture; A second data table sub-picture obtaining unit, configured to perform image segmentation on the second data table picture based on the second vertical dividing line and / or the second horizontal dividing line to obtain at least two second data table sub-pictures; a sub-difference picture acquisition unit, configured to acquire a first data table sub-picture located at the rightmost, bottommost, or lower-rightmost side of the first data table picture and acquire a second data table sub-picture located at the rightmost, bottommost, or lower-rightmost side of the second data table picture, cut or expand the second data table sub-picture so that the size of the second data table sub-picture is the same as the size of the corresponding first data table sub-picture, and perform binarization and difference processing on the first data table sub-picture and the second data table sub-picture to obtain a sub-difference picture; a sub-difference picture determination unit, configured to determine whether there are vertical lines and / or horizontal lines on the sub-difference picture; a first data table sub-image determining unit, configured to remove a first vertical dividing line overlapping with a rightmost vertical line of a table in the first data table image and to remove a first horizontal dividing line overlapping with a bottommost horizontal line of a table in the first data table image, and to perform image segmentation on the first data table image based on the remaining first vertical dividing line and / or first horizontal dividing line to obtain at least two first data table sub-images; a second data table sub-image determining unit, configured to remove a second vertical dividing line overlapping with the rightmost vertical line of the table in the second data table image, and remove a second horizontal dividing line overlapping with the bottommost horizontal line of the table in the second data table image, and perform image segmentation on the second data table image based on the remaining second vertical dividing line and / or second horizontal dividing line to obtain at least two second data table sub-images; The difference picture determination unit three is used to cut or expand all the second data table sub-pictures so that the size of the second data table sub-pictures is the same as the size of the corresponding first data table sub-pictures, and to perform one-to-one binarization and difference processing on all the first data table sub-pictures and all the second data table sub-pictures to obtain more than two difference pictures two, and all the difference pictures two are used as the difference pictures.
6. The system according to claim 5, characterized in that The first difference picture determination unit comprises: A vertical line determination subunit is used to obtain vertical continuous pixel points with a value of 1 in the difference picture 1, and when the number of the vertical continuous pixel points is greater than a first numerical threshold, determine that the vertical continuous pixel points are a vertical line, and the first numerical threshold is the total number of pixels on the vertical side of the difference picture 1 multiplied by a first preset proportion value; The horizontal line determination subunit is used to obtain horizontal continuous pixel points with a value of one in the difference image one. When the number of pixel points of the horizontal continuous pixel points is greater than a second numerical threshold, the horizontal continuous pixel points are determined to be a horizontal line. The second numerical threshold is the total number of pixels on the horizontal side of the difference image one multiplied by a second preset proportion value.
7. The system according to claim 5, characterized in that The system further comprises: A data table reference picture acquisition module, used for marking the vertical lines and the horizontal lines in the first data table picture with serial numbers to obtain a data table reference picture; The dividing line determining unit comprises: A vertical line position information acquisition subunit is used to compare the difference image 1 with the reference image in the data table to determine the first vertical line that is compared and overlapped from left to right, and obtain the vertical line sequence number of the first vertical line that is compared and overlapped through the reference image in the data table, and use the vertical line sequence number as the vertical line position information; The horizontal line position information acquisition subunit is used to compare the difference image 1 with the reference image in the data table to determine the first horizontal line that is compared and overlapped from top to bottom, and obtain the horizontal line sequence number of the first horizontal line that is compared and overlapped through the reference image in the data table, and use the horizontal line sequence number as the horizontal line position information.
8. The system according to claim 7, characterized in that The system further comprises: a data table reference sub-picture acquisition module, configured to, when there are more than two difference pictures, perform image segmentation on the data table reference picture based on the remaining first vertical dividing lines and / or the first horizontal dividing lines to obtain data table reference sub-pictures corresponding one-to-one to the first data table sub-pictures; The difference point location information acquisition module includes: A difference picture determination unit, used to determine whether the difference picture is a blank picture; a difference point acquisition and marking unit, used for setting a sliding frame on the non-blank difference picture, counting the number of pixels with a value of one in the sliding frame, and when the number of pixels with a value of one is greater than a third numerical threshold, determining that the sliding frame has a difference point at the current position, and marking the difference point on the difference picture; A difference point position information determination unit is used to compare a difference picture with a difference point with a data table reference picture or a corresponding data table reference sub-picture to determine an upper horizontal line number above the difference point, a lower horizontal line number below the difference point, a left vertical line number to the left of the difference point, and a right vertical line number to the right of the difference point, and use the upper horizontal line number, the lower horizontal line number, the left vertical line number, and the right vertical line number as the difference point position information of the difference point.
Citation Information
Patent Citations
Image-text content comparison method and device
CN110688889A
Table document comparison and identification method and device
CN115188016A
Data processing method and device, computer equipment, medium and product
CN116975177A