A table recognition method, device and equipment based on quantitative offset
Through the table recognition method based on quantitative offset, the problem of unavailability of detecting full-frame tables and automatic positioning in the prior art is solved, and efficient identification and digital management of any tables are realized.
Patent Information
- Application Number
- CN202210670416.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-14
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2042-06-14
AI Technical Summary
The prior art cannot effectively detect full-frame tables, and the automatic positioning and electronic conversion of any tables cannot be realized, especially in the presence of merged cells, which are inefficient and complex in the recognition.
The table recognition method based on quantitative offset is adopted to create candidate coordinates of rows and columns, obtain real intersection points, and filter them to identify merged rows and merge columns, and realize digital management of tables.
It improves the efficiency and speed of table recognition, can process complex tables faster, and realizes automatic positioning and electronic conversion of any table.
Smart Images

Figure CN115050040B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of intelligent recognition, and in particular to a table recognition method, device and equipment based on quantitative offset. Background Art
[0002] Tables are used in various fields of production and life as an intuitive and concise way of recording information. Although computers have become popular, there are still a large number of paper table documents in real life, and the information in them is still of great value. At present, the research objects of table recognition technology are mainly express delivery orders, invoices and other tables with fixed formats. However, for heterogeneous tables without unified standards or templates in practical applications, the research on recognition technology is relatively slow and lacks a mature usage system.
[0003] The prior art generally adopts a method of traversing an image based on a matrix template to determine the type of each intersection.
[0004] After determining the types of each intersection in the table, traditional algorithms need to define rules for pattern matching in order to identify merged cells. The more cells there are, the longer the search time is required, and the time complexity is proportional to the number of cells. It is impossible to detect full-wireframe tables, and it is impossible to automatically locate and electronically convert any table. When identifying simple tables without merged cells or tables with a large number of cells, the recognition method based on intersection features is too complicated. Summary of the invention
[0005] The purpose of the present invention is to overcome the problems that the prior art cannot detect full-wireframe tables and cannot realize automatic positioning and electronic conversion of any table, and to this end provides a table recognition method, device and equipment based on quantitative offset, which can identify merged rows and merged columns after quantitatively offsetting the table.
[0006] In a first aspect, an embodiment of the present disclosure provides a table recognition method based on quantitative offset, comprising:
[0007] S1: Establishing coordinates for the target table to be identified, where the coordinates include row candidate coordinates and column candidate coordinates;
[0008] S2: Get the real intersection points of the rows of the target table;
[0009] S3: Get the real intersection of columns of the target table;
[0010] S4: Filter the real intersections of the rows of the target table and identify the merged rows;
[0011] S5: Filter the real intersections of the columns of the target table and identify the merged columns.
[0012] In a second aspect, an embodiment of the present disclosure further provides a table recognition device based on quantitative offset, the device comprising:
[0013] A coordinate establishment module, used to establish coordinates for a target table to be identified, wherein the coordinates include row candidate coordinates and column candidate coordinates;
[0014] A row real intersection point acquisition module is used to acquire the row real intersection points of the target table;
[0015] A column real intersection point acquisition module is used to acquire the column real intersection points of the target table;
[0016] A merged row identification module is used to filter the real intersections of rows in the target table and identify merged rows;
[0017] The merged column identification module is used to filter the real intersection points of the columns of the target table and identify the merged columns.
[0018] In a third aspect, an embodiment of the present disclosure further provides an electronic device, the electronic device comprising:
[0019] at least one processor; and
[0020] a memory communicatively connected to at least one processor; wherein,
[0021] When the memory stores a computer program executable by at least one processor, the computer program is executed by the at least one processor so that the at least one processor can perform a table recognition method based on quantitative offset according to any embodiment of the present disclosure.
[0022] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a table recognition method based on quantitative offset as in any embodiment of the present disclosure.
[0023] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description.
[0024] Therefore, the present invention has the following beneficial effects:
[0025] 1. Based on quantitative offset recognition, the recognition is performed by judging whether the product of the number of real intersections and the number of horizontal and vertical candidate coordinates is the same, which has higher recognition efficiency;
[0026] 2. Smaller size and faster execution speed;
[0027] 3. Realize digital management of tables by identifying the operations of merging rows and columns. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0029] Figure 1 is a flow chart of a table recognition method based on quantitative offset provided according to Embodiment 1 of the present invention;
[0030] Figure 2 is a schematic diagram of row candidate coordinates and column candidate coordinates provided according to Embodiment 1 of the present invention;
[0031] Figure 3 is a schematic diagram of a real intersection and a pseudo intersection provided according to Embodiment 1 of the present invention;
[0032] Figure 4 is a schematic diagram of a process of merging rows and columns provided according to Embodiment 1 of the present invention;
[0033] Figure 5 is a flow chart of another table recognition method based on quantitative offset provided according to the second embodiment of the present invention;
[0034] Figure 6 is a schematic diagram of a table merge row identification process provided according to Embodiment 2 of the present invention;
[0035] Figure 7 is a schematic diagram of the structure of a table recognition device based on quantitative offset provided according to Embodiment 3 of the present invention;
[0036] Figure 8 It is a schematic diagram of the structure of an electronic device provided according to Embodiment 4 of the present invention. DETAILED DESCRIPTION
[0037] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0038] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0039] Embodiment 1
[0040] Figure 1 A flowchart of a table recognition method based on quantitative offset is provided for the first embodiment of the present invention. This embodiment can be applied to the case of obtaining the real intersection points of rows and columns in a table. The method can be executed by the module selection device provided in the embodiment of the present disclosure, which can be implemented in software and / or hardware and can generally be integrated in a computer device. The method of the embodiment of the present disclosure specifically includes:
[0041] S1: Establish coordinates for the target table to be identified.
[0042] Among them, the coordinates include row candidate coordinates and column candidate coordinates; specifically, the table intersections are projected in the vertical direction, and the table intersections belonging to the same row have the same y-coordinate value, and these y-coordinates are called row candidate coordinates; and the table intersections are projected in the horizontal direction, and the table intersections belonging to the same column have the same x-coordinate value, and these x-coordinates are called column candidate coordinates.
[0043] Figure 2 is a schematic diagram of row candidate coordinates and column candidate coordinates, such as Figure 2 As shown, projecting the table intersection in the vertical direction can obtain y1, y2, y3, and y4, which are called row candidate coordinates; projecting the table intersection in the horizontal direction can obtain x1, x2, x3, and x4, which are called column candidate coordinates; it is necessary to assume that the horizontal and vertical lines of the table image are strictly horizontal or vertical, that is, the angle between the table line and the x-axis is 0 or 90°; obviously, for any intersection in the table, the coordinate value of the intersection should be composed of one value from the row candidate coordinates and one value from the column candidate coordinates; in addition, after removing redundant data for one row and one column, the product of the number of row candidate coordinates and the number of column candidate coordinates is consistent with the total number of source table cells of the complex table.
[0044] S2: Get the actual intersection points of the rows of the target table.
[0045] Among them, the real intersection point refers to the intersection point that can coincide with the center of the cell after a certain amount of offset; there are also pseudo intersection points in the target table. The pseudo intersection point refers to the intersection point that cannot coincide with the center of the cell after a certain amount of offset. It is a pseudo intersection point of the table.
[0046] Figure 3 is a schematic diagram of real intersections and pseudo intersections, such as Figure 3 As shown in the figure, the plus sign represents the center point of each cell in the source table of the complex table, and the dot represents the intersection point obtained by the intersection of the horizontal and vertical lines of the table; if it is a complex table with merged rows and columns, the center of the merged cell is the center of the cell in the first row and first column of its source table, so the two plus signs drawn with dotted lines in (a) should be removed; observing the relationship between the dots and the plus signs, it is found that some table intersections can coincide with the plus signs after a fixed amount of offset. These intersections are called the real intersection points of the table and are marked by dotted boxes in (b). Conversely, the intersection points that fail to coincide are pseudo intersection points; in addition, since the last vertical line and the last horizontal line of the table line are redundant for the quantitative offset method, the intersection points on the redundant rows and redundant columns are all pseudo intersection points.
[0047] Preferably, step S2 specifically includes: extracting a set of horizontal lines of the target table; constructing a set of vertical lines 1 based on the column candidate coordinates; quantitatively shifting the constructed set of vertical lines 1 to the right in the horizontal direction to obtain a new set of vertical lines 1; ANDing the set of horizontal lines with the new set of vertical lines 1 to obtain a set of intersection points 1; quantitatively counter-shifting the set of intersection points 1 to the left to obtain a true intersection point 1 of the rows of the target table.
[0048] For example, let the input horizontal line set be U H , the vertical line set is U V , will U H and U V Get the intersection point set C of the table and calculate the candidate coordinates C of the column V and row candidate coordinates C H The process of removing pseudo intersections of table merged rows based on the quantitative offset method is as follows: V , remove the last redundant column coordinate, and construct vertical lines of the same height as the table in turn, and construct the resulting vertical line set L V , L V The length is C V The length of the V Make a quantitative shift to the right, the offset is C V Half of the minimum value of the interval between two adjacent candidate coordinates in the column, the offset is recorded as L V ';L V 'and U HBy ANDing, we get the intersection point set A, and then shift A to the left in the horizontal direction by an inverse quantitative offset to get the real intersection points of the rows of the target table.
[0049] S3: Get the real intersection of the columns of the target table.
[0050] Preferably, step S3 specifically includes: extracting a set of vertical lines of the target table; constructing a horizontal line set 1 based on the row candidate coordinates; quantitatively shifting the constructed horizontal line set 1 downward in the vertical direction to obtain a new horizontal line set 1; ANDing the vertical line set with the new horizontal line set 1 to obtain an intersection point set 2; quantitatively reverse-shifting the intersection point set 2 upward to obtain the real intersection point 1 of the column of the target table.
[0051] Exemplarily, according to the row candidate coordinate list C H , remove the last redundant row coordinate, and construct horizontal lines of the same width as the table in turn, and construct the resulting horizontal line set L H , L H Height C H The height of the H A quantitative offset is made downwards, and the offset is half of the minimum value of the interval between two adjacent row candidate coordinates. The offset is recorded as L H ';L H 'and U V By ANDing them, we get the intersection point set B, and then offset B upward in the vertical direction to get the true intersection points of the columns in the target table.
[0052] S4: Filter the real intersections of the rows of the target table and identify the merged rows.
[0053] S5: Filter the real intersections of the columns of the target table and identify the merged columns.
[0054] Figure 4 is a schematic diagram of the process of merging rows and columns, such as Figure 4 As shown, a merged row represents a cell obtained by merging N cells vertically, and this merging operation is called a row merge; a merged column represents a cell obtained by merging N cells horizontally, and this merging operation is called a column merge.
[0055] The technical solution of the embodiment of the present invention is based on quantitative offset recognition, and recognition is performed by judging whether the product of the number of actual intersections and the number of horizontal and vertical candidate coordinates is the same. The recognition efficiency is higher; the volume is smaller and the execution speed is faster; and digital management of tables is achieved by identifying the operations of merging rows and columns.
[0056] Embodiment 2
[0057] Figure 5 A flowchart of a table recognition method based on quantitative offset provided in Embodiment 2 of the present invention. Figure 5 It is a further refinement of the above steps S4 and S5, and the specific steps include:
[0058] S41: Filter the row real intersection points 1 of the table to obtain the row real intersection points 2 of each column.
[0059] S42: Determine whether the length of each row's real intersection point 2 is equal to the length of the column candidate coordinates. If they are equal, execute step S43; if they are not equal, execute step S44.
[0060] S43: Indicates that there is no merged row in this column.
[0061] S44: It indicates that there is a merged row in the column where the row real intersection point 2 is located, and the subscript position of the adjacent row real intersection point 2 in the row candidate coordinates is calculated.
[0062] S45: Calculate the subscript difference of the real intersection points 2 of adjacent rows. If the subscript difference is greater than 1, it indicates that a merged row exists.
[0063] S51: Filter the column real intersection points 1 of the table to obtain the column real intersection points 2 of each row.
[0064] S52: Determine whether the height of each column's real intersection point 2 is equal to the row candidate coordinate. If so, execute step S53; if not, execute step S54.
[0065] S53: Indicates that there is no merge column in this row.
[0066] S54: It indicates that there is a merged column in the row where the column real intersection point 2 is located, and calculates the subscript position of the adjacent column real intersection point 2 in the column candidate coordinates.
[0067] S55: Calculate the subscript difference of the real intersection points 2 of adjacent columns. If the subscript difference is greater than 1, it indicates that a merged column exists.
[0068] For example, C V Filter A by the coordinate value to get all the row intersections A in the Nth column N ; A N With C H If the lengths are equal, it indicates that there is no merged row in the current column, and the next column is filtered; if the lengths are not equal, it indicates that there is a merged row; traverse A N , calculate the y coordinates of adjacent intersection points in C H In the subscript, assume that the y coordinate of the intersection point with subscript j is in the row candidate coordinate C H The subscript position in is Index j , the y coordinate of the intersection point with subscript j+1 is at C H The subscript position in is Index j+1 , when Index j+1-Index j >1 indicates that there is a merged row at that position. If the first row and first column of the table are counted from 0, the column where the merged cell is located is N, and the value of the starting row is Index. j , the value of the termination row is Index j+1 -1, cell length is Index j+1 -Index j If it does not exist, determine the next subscript.
[0069] In a specific implementation, let the input column candidate coordinates C V ={x1, x2, ..., x N}, where N = |C V |, input row candidate coordinates C H ={y1, y2, ..., y M}, where M = |C H |, the set of true intersection points of the rows of the table is A = {(x1, y1), (x2, y2)…, (x K ,y K )}, where K = |A|, the process steps for identifying table merge rows are as follows:
[0070] (1) Use C in sequence V The elements of the intersection set A are filtered to obtain all the row intersection points A in the i-th column i , the calculation formula is as follows:
[0071] A i ={(x j ,y j )|(x j ,y j )∈A,x j =C Vi}, 0≤i<N, 0≤j<K
[0072] Among them, (x j ,y j ) represents the jth intersection point in A, C vi Represents C V The i-th element of , where the element subscripts start counting from 0;
[0073] (2) When len(A i )=len(C H ) indicates that there is no merged row in the current column, and the next column is filtered; if the lengths are not equal, it indicates that there is a merged row, and go to step (3);
[0074] (3) Traverse A i , calculate the y coordinates of the adjacent intersection points in the row candidate coordinates C according to the following formula H The subscript difference in :
[0075]
[0076] Among them, ΔIndex j,j+1 Indicates that the adjacent intersection points are in the row candidate coordinates C H The difference in the subscripts in Indicates A i The y coordinate value of the jth intersection point in express In C H The subscript position in is calculated as follows:
[0077] C H (Y) = {z | Y = C Hz},0≤z<M
[0078] Among them, C Hz Represents C H The zth element of . When ΔIndex j,j+1 When >1, it indicates that there is a merged row at this position, and go to step (4); otherwise, determine the next subscript;
[0079] (4) If the column where the merged cell is located is N, the value of the starting row is Index j , the value of the termination row is Index j+1 -1, the cell length is ΔIndex j,j+1 .
[0080] Figure 6 This is a schematic diagram of the table merge row recognition process, such as Figure 6 As shown, the dotted-line framed portion of the table is the filtering of the row real intersection set using the column candidate coordinate x1, and the subscript of the portion marked by the square frame is missing, indicating that there is a merged row here.
[0081] Furthermore, the processing flow of merging columns is similar to that of merging rows. When filtering, the values of the row candidate coordinates are used to filter the actual intersections of the columns. The result is all the intersections of the Mth row. The merged columns are restored in the electronic document based on the subscript difference between two adjacent intersections.
[0082] The technical solution of the embodiment of the present invention is based on quantitative offset recognition, and recognition is performed by judging whether the product of the number of actual intersections and the number of horizontal and vertical candidate coordinates is the same. The recognition efficiency is higher; the volume is smaller and the execution speed is faster; and digital management of tables is achieved by identifying the operations of merging rows and columns.
[0083] Embodiment 3
[0084] Figure 7The following is a schematic diagram of a table recognition device based on quantitative offset provided in the third embodiment of the present invention. The device can be implemented in software and / or hardware, and can generally be integrated in an electronic device that executes the method. Figure 7 As shown, the device includes: a coordinate establishment module 310, used to establish coordinates for a target table to be identified, wherein the coordinates include row candidate coordinates and column candidate coordinates; a row real intersection acquisition module 320, used to acquire the real intersections of the rows of the target table; a column real intersection acquisition module 330, used to acquire the real intersections of the columns of the target table; a merged row identification module 340, used to filter the real intersections of the rows of the target table and identify merged rows; a merged column identification module 350, used to filter the real intersections of the columns of the target table and identify merged columns.
[0085] Preferably, the row real intersection acquisition module 320 is specifically used to: extract the horizontal line set of the target table; construct a vertical line set 1 based on the column candidate coordinates; quantitatively shift the constructed vertical line set 1 to the right in the horizontal direction to obtain a new vertical line set 1; AND the horizontal line set with the new vertical line set 1 to obtain an intersection set 1; quantitatively reverse shift the intersection set 1 to the left to obtain the row real intersection 1 of the target table.
[0086] Preferably, the column real intersection acquisition module 330 is specifically used to: extract the vertical line set of the target table; construct a horizontal line set 1 based on the row candidate coordinates; quantitatively shift the constructed horizontal line set 1 downward in the vertical direction to obtain a new horizontal line set 1; AND the vertical line set with the new horizontal line set 1 to obtain an intersection set 2; quantitatively reverse-shift the intersection set 2 upward to obtain the column real intersection 1 of the target table.
[0087] Preferably, the merged row identification module 340 is specifically used to: filter the row real intersection points 1 of the table to obtain the row real intersection points 2 of each column; determine whether the length of each row real intersection point 2 is equal to the column candidate coordinate, if they are equal, it indicates that there is no merged row in this column; if they are not equal, it indicates that there is a merged row in the column where the row real intersection point 2 is located, and calculate the subscript positions of adjacent row real intersection points 2 in the row candidate coordinates; calculate the subscript difference of adjacent row real intersection points 2, if the subscript difference is greater than 1, it indicates that there is a merged row.
[0088] Preferably, the merged column identification module 350 is specifically used to: filter the column real intersection points 1 of the table to obtain the column real intersection points 2 of each row; determine whether the height of each column real intersection point 2 is equal to the row candidate coordinates, if they are equal, it indicates that there is no merged column in this row; if they are not equal, it indicates that there is a merged column in the row where the column real intersection point 2 is located, and calculate the subscript positions of adjacent column real intersection points 2 in the column candidate coordinates; calculate the subscript difference of adjacent column real intersection points 2, if the subscript difference is greater than 1, it indicates that there is a merged column.
[0089] The technical solution of the embodiment of the present invention is based on quantitative offset recognition, and recognition is performed by judging whether the product of the number of actual intersections and the number of horizontal and vertical candidate coordinates is the same. The recognition efficiency is higher; the volume is smaller and the execution speed is faster; and digital management of tables is achieved by identifying the operations of merging rows and columns.
[0090] A table recognition device based on quantitative offset provided in an embodiment of the present invention can execute a table recognition method based on quantitative offset provided in any embodiment of the present invention, and has corresponding functional modules and beneficial effects of the execution method.
[0091] Embodiment 4
[0092] Figure 8 A schematic diagram of the structure of an electronic device 400 provided for Embodiment 4 of the present invention. The electronic device in the disclosed embodiment may be a device corresponding to the backend service platform of the application, or may be a mobile terminal device with an application client installed. Specifically, the electronic device may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 8 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0093] like Figure 8 As shown, the electronic device 400 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 401, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 402 or a program loaded from a storage device 408 into a random access memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the electronic device 400 are also stored. The processing device 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0094] Typically, the following devices may be connected to the I / O interface 405: an input device 406 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 407 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 408 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 409. The communication device 409 may allow the electronic device 400 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 3The electronic device 400 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0095] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 409, or installed from the storage device 408, or installed from the ROM 402. When the computer program is executed by the processing device 401, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0096] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0097] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0098] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0099] The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by the electronic device, the internal process of the electronic device executes: establishing coordinates for the target table to be identified, wherein the coordinates include row candidate coordinates and column candidate coordinates; obtaining the true intersection points of the rows of the target table; obtaining the true intersection points of the columns of the target table; filtering the true intersection points of the rows of the target table to identify merged rows; filtering the true intersection points of the columns of the target table to identify merged columns.
[0100] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or combinations thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0101] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0102] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a unit does not, in some cases, limit the unit itself.
[0103] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0104] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0105] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0106] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0107] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A table recognition method based on quantitative offset, characterized in that: The following steps are involved: S1: Establishing coordinates for a target table to be identified, wherein the coordinates include row candidate coordinates and column candidate coordinates; S2: Obtaining the actual intersection of the rows of the target table; S3: Obtaining the actual intersection of the columns of the target table; S4: filtering the real intersections of the rows of the target table to identify the merged rows; S5: filtering the real intersections of the columns of the target table to identify merged columns; Wherein, the step S2 specifically includes: S21: extracting a set of horizontal lines of the target table; S22: constructing a vertical line set 1 according to the column candidate coordinates; S23: quantitatively shifting the constructed vertical line set 1 to the right in the horizontal direction to obtain a new vertical line set 1; S24: AND the horizontal line set with the new vertical line set 1 to obtain an intersection point set 1; S25: quantitatively de-shift the intersection point set 1 to the left to obtain a row real intersection point 1 of the target table; Wherein, the step S3 specifically includes: S31: extracting a set of vertical lines of the target table; S32: constructing a horizontal line set 1 according to the row candidate coordinates; S33: quantitatively shifting the constructed horizontal line set 1 downward in the vertical direction to obtain a new horizontal line set 1; S34: AND the vertical line set with the new horizontal line set 1 to obtain an intersection point set 2; S35: quantitatively de-shifting the intersection point set 2 upward to obtain a column real intersection point 1 of the target table; Wherein, the step S4 specifically includes: S41: filtering the row real intersection points 1 of the table to obtain the row real intersection points 2 of each column; S42: Determine whether the length of each row real intersection point 2 is equal to the length of the column candidate coordinates. If they are equal, execute step S43; if not, execute step S44; S43: indicates that there is no merged row in this column; S44: indicating that there is a merged row in the column where the row real intersection point 2 is located, and calculating the subscript position of the adjacent row real intersection point 2 in the row candidate coordinates; S45: Calculate the subscript difference of the real intersection points 2 of the adjacent rows, and if the subscript difference is greater than 1, it indicates that there is a merged row; Wherein, the step S4 specifically includes: S51: filtering the column real intersection point 1 of the table to obtain the column real intersection point 2 of each row; S52: Determine whether the height of each of the column real intersection points 2 is equal to the row candidate coordinates. If they are equal, execute step S53; if not, execute step S54; S53: indicates that there is no merge column in this row; S54: indicating that there is a merged column in the row where the column real intersection point 2 is located, and calculating the subscript position of the adjacent column real intersection point 2 in the column candidate coordinates; S55: Calculate the subscript difference of the real intersection points 2 of the adjacent columns. If the subscript difference is greater than 1, it indicates that a merged column exists.
2. The table recognition method based on quantitative offset according to claim 1, characterized in that: The calculation principle of the subscript position in step S44 is: C H (Y)={z|Y=C Hz },0≤z<M Among them, C Hz Represents C H The zth element of H |, C H ={y1,y2,...,y M } represents the row candidate coordinates, and Y represents the subscript position.
3. The table recognition method based on quantitative offset according to claim 1, characterized in that: The calculation principle of the subscript difference in step S45 is: Among them, ΔIndex j,j+1 Indicates that the adjacent intersection points are in the row candidate coordinates C H The difference in the subscripts in Indicates A i The y coordinate value of the jth intersection point in express In C H The subscript position in C H ={y1,y2,…,y M } represents the row candidate coordinates.
4. A table recognition device based on quantitative offset, applied to the table recognition method based on quantitative offset as claimed in claim 1, characterized in that: include: A coordinate establishment module, used to establish coordinates for a target table to be identified, wherein the coordinates include row candidate coordinates and column candidate coordinates; A row real intersection point acquisition module, used for acquiring the row real intersection points of the target table; A column real intersection point acquisition module, used for acquiring the column real intersection points of the target table; The merged row identification module is used to filter the real intersections of the rows of the target table and identify the merged rows; the merged column identification module is used to filter the real intersections of the columns of the target table and identify the merged columns.
5. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the method according to any one of claims 1 to 3.
6. A computer storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the method according to any one of claims 1 to 3 when executed.
