Frameless table tilt correction method, tilt correction device, and program

The method corrects frameless table images by detecting rectangular frames, determining tilt angles and reference points, and performing perspective transformation, thereby improving accuracy and performance in image tilt correction and table identification.

JP7761084B2Active Publication Date: 2025-10-28RICOH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
JP2024084085
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Priority Date
2023-05-24
Filing Date
2024-05-23
Publication Date
2025-10-28
Estimated Expiration
2044-05-23

AI Technical Summary

Technical Problem

Existing methods struggle to accurately correct the tilt of frameless table images due to the difficulty in obtaining precise feature points for perspective transformation, leading to inaccurate image tilt correction and table identification.

Method used

A method involving text detection to identify rectangular frames, determining target tilt angles and reference points, generating a rectangular frame set, and performing perspective transformation using intersection points to correct the frameless table image.

Benefits of technology

Improves the accuracy of feature points in frameless table images, enhancing the performance of image tilt correction and table identification processes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007761084000002
    Figure 0007761084000002
  • Figure 0007761084000003
    Figure 0007761084000003
  • Figure 0007761084000004
    Figure 0007761084000004
Patent Text Reader

Abstract

To provide an inclination correction method and an inclination correction device for a frameless table, and a storage medium.SOLUTION: An inclination correction method and an inclination correction device for a frameless table provided in an embodiment of the present invention fix an outer frame line of a frameless table on the basis of the inclination angle and vertex coordinates of a rectangular frame obtained by text detection. The inclination correction method and inclination correction device for a frameless table of the embodiment of the prevent invention comprehensively consider the inclination angles and vertex coordinates of a plurality of rectangular frames, and thereby can improve the accuracy of the feature points of an obtained image of the frameless table, and can improve the efficiency of subsequent image inclination correction processing.SELECTED DRAWING: Figure 1
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] The present invention relates to the field of image processing technology, and more particularly to a method and device for correcting tilt of a frameless table, and a storage medium. [Background technology]

[0002] In document processing, it is often necessary to identify text printed on paper. A common method is to photograph the paper, obtain an image containing the text, and then use OCR (Optical Character Recognition) to recognize the image to obtain the text. For example, if an image contains a table, table structure analysis and text recognition are required on the image to obtain the table cells and the text content within them.

[0003] When capturing an image containing text, distortion is likely to occur. Conventionally, the image is first corrected for tilt through perspective transformation. For a table image with a complete frame, feature points for the perspective transformation process can be easily obtained. In practical applications, some tables are images of tables without frames, i.e., vertical and horizontal lines in the table are omitted. For frameless table images, it is difficult to obtain feature points for the perspective transformation process, or the obtained feature points are less accurate, which is disadvantageous for subsequent image tilt correction and table identification. Summary of the Invention [Problem to be solved by the invention]

[0004] At least one embodiment of the present invention provides a method, an apparatus, and a storage medium for correcting the tilt of a frameless table, which can improve the accuracy of the feature points of the captured frameless table image and improve the performance of the image tilt correction process. [Means for solving the problem]

[0005] In order to solve the above technical problem, an embodiment of the present invention includes the steps of: obtaining a first rectangular image of a frameless table containing text; performing text detection on the first rectangular image to obtain a text portion in the first rectangular image and a rectangular frame circumscribing the text portion; generating a rectangular frame set for each side of the first rectangular image, the rectangular frame set including at least one rectangular frame near the side; determining a target tilt angle based on the tilt angle of a target frame side of a rectangular frame in the rectangular frame set; determining a reference point based on the target vertex of a rectangular frame in the rectangular frame set; and determining a target tilt angle that passes through the reference point and is equal to the target tilt angle. the target frame side is the frame side closest to the side in the rectangular frame, and the target vertex is a vertex through which the target frame side passes; determining four intersection points based on the four outer frame lines of the frameless table; performing perspective transformation based on the four intersection points and four predetermined target points to obtain a perspective transformation matrix; and correcting the first rectangular image based on the perspective transformation matrix to generate a corrected second rectangular image.

[0006] Preferably, the step of generating a rectangular frame set for each side of the first rectangular image includes the steps of: identifying a matrix to which the rectangular frames in the first rectangular image belong; wherein, for rectangular frames in the same row, the distance between the upper frame extension lines of any two rectangular frames is smaller than a first threshold value, and the distance between the lower frame extension lines is smaller than a second threshold value; and, for rectangular frames in the same column, the distance between the left frame extension lines of any two rectangular frames is smaller than a third threshold value; and selecting rectangular frames in the first column for the left side of the first rectangular image to form a first rectangular frame set; selecting rectangular frames in the last column for the right side of the first rectangular image to form a second rectangular frame set; selecting rectangular frames in the first row for the top side of the first rectangular image to form a third rectangular frame set; and selecting rectangular frames in the last row for the bottom side of the first rectangular image to form a fourth rectangular frame set.

[0007] Also, preferably, the step of determining a target inclination angle based on the inclination angle of a target frame side of a rectangular frame in the set of rectangular frames includes the steps of: calculating an angle of the target frame side of each rectangular frame in the set of rectangular frames relative to a reference line, the reference line being a predetermined horizontal or vertical line; and calculating a first statistical value of the angle of each rectangular frame relative to the reference line of the target frame as the target inclination angle, the first statistical value being a median or average of the angles.

[0008] Also, preferably, the step of determining a reference point based on target vertices of rectangular frames in the rectangular frame set includes the steps of acquiring coordinates of target vertices of each rectangular frame in the rectangular frame set, and calculating a second statistical value of the acquired coordinates of the target vertices as the coordinate of the reference point, wherein the second statistical value is the median or average value of the coordinates of the target vertices.

[0009] Also, preferably, the step of acquiring the coordinates of the target vertices of each rectangular frame in the rectangular frame set includes the steps of acquiring the coordinates of the upper left and / or lower left vertices of each rectangular frame in the first rectangular set relative to the left side of the first rectangular image, acquiring the coordinates of the upper right and / or lower right vertices of each rectangular frame in the second rectangular set relative to the right side of the first rectangular image, acquiring the coordinates of the upper left and / or upper right vertices of each rectangular frame in the third rectangular set relative to the top side of the first rectangular image, and acquiring the coordinates of the lower left and / or lower right vertices of each rectangular frame in the fourth rectangular set relative to the bottom side of the first rectangular image.

[0010] Further, an embodiment of the present invention includes an image acquisition module that acquires a first rectangular image of a frameless table including text; a text detection module that performs text detection on the first rectangular image and acquires a text portion in the first rectangular image and a rectangular frame circumscribing the text portion; a text detection module that generates a rectangular frame set including at least one rectangular frame near each side of the first rectangular image, determines a target tilt angle based on the tilt angle of a target frame side of a rectangular frame in the rectangular frame set, determines a reference point based on the target vertex of a rectangular frame in the rectangular frame set, and calculates a straight line that passes through the reference point and has the target tilt angle by drawing the straight line through the frameless table. the target frame side is the frame side closest to the side of the rectangular frame, and the target vertex is a vertex through which the target frame side passes; an intersection generation module that determines four intersections based on the four outer frame lines of the frameless table; a matrix acquisition module that performs perspective transformation based on the four intersections and four predetermined target points to acquire a perspective transformation matrix; and an image correction module that performs correction on the first rectangular image based on the perspective transformation matrix to generate a corrected second rectangular image.

[0011] Preferably, the outer frame line generation module includes: a first identification module that identifies the matrix to which a rectangular frame in the first rectangular image belongs, where, for rectangular frames in the same row, the distance between the upper frame extension lines of any two rectangular frames is smaller than a first threshold, and the distance between the lower frame extension lines is smaller than a second threshold, and for rectangular frames in the same column, the distance between the left frame extension lines of any two rectangular frames is smaller than a third threshold; a first selection module that selects rectangular frames in the first column for the left side of the first rectangular image and constitutes a first rectangular frame set; a second selection module that selects rectangular frames in the last column for the right side of the first rectangular image and constitutes a second rectangular frame set; a third selection module that selects rectangular frames in the first row for the top side of the first rectangular image and constitutes a third rectangular frame set; and a fourth selection module that selects rectangular frames in the last row for the bottom side of the first rectangular image and constitutes a fourth rectangular frame set.

[0012] Preferably, the outer frame line generation module includes a first calculation module that calculates the angle of a target frame side of each rectangular frame in the rectangular frame set relative to a reference line, the reference line being a predetermined horizontal or vertical line, and a second calculation module that calculates a first statistical value of the angle of each rectangular frame relative to the reference line of the target frame as the target tilt angle, the first statistical value being the median or average of the angles.

[0013] In addition, preferably, the outer frame line generation module further includes a first acquisition module that acquires coordinates of target vertices of each rectangular frame in the rectangular frame set, and a third calculation module that calculates a second statistical value of the acquired coordinates of the target vertices as the coordinates of the reference point, wherein the second statistical value is the median or average value of the coordinates of the target vertices.

[0014] Also, preferably, the first acquisition module acquires the coordinates of the upper left and / or lower left vertices of each rectangular frame in the first rectangular set relative to the left side of the first rectangular image, acquires the coordinates of the upper right and / or lower right vertices of each rectangular frame in the second rectangular set relative to the right side of the first rectangular image, acquires the coordinates of the upper left and / or upper right vertices of each rectangular frame in the third rectangular set relative to the top side of the first rectangular image, and acquires the coordinates of the lower left and / or lower right vertices of each rectangular frame in the fourth rectangular set relative to the bottom side of the first rectangular image.

[0015] Furthermore, an embodiment of the present invention provides a computer-readable storage medium that stores a computer program, and the computer program is executed by a processor to implement the steps of the above-described method for correcting tilt of a frameless table.

[0016] Compared with the prior art, the frameless table skew correction method and apparatus according to the embodiment of the present invention determines each outer border of the frameless table based on the skew angle and vertex coordinates of the rectangular frame obtained by text detection, and comprehensively considers the skew angles and vertex coordinates of multiple rectangular frames, thereby improving the accuracy of the feature points of the frameless table image and improving the performance of the subsequent image skew correction process. [Brief explanation of the drawings]

[0017] Various other benefits and advantages will become apparent to those skilled in the art from the detailed description of the preferred embodiments below. The accompanying drawings are used only to illustrate the preferred embodiments and are not intended to limit the invention. The same reference numerals are used throughout the drawings to refer to the same parts. [Figure 1] FIG. 1 is a flowchart showing a method for correcting tilt of a frameless table according to an embodiment of the present invention. [Figure 2] FIG. 2 is a diagram showing an example of a first rectangular image including a frameless table according to an embodiment of the present invention. [Figure 3] FIG. 3 is a diagram showing an example of a rectangular frame obtained by performing text detection on the first rectangular image. [Figure 4] FIG. 4 is a diagram showing an example of specifying rectangular frames on the same line in an embodiment of the present invention. [Figure 5] FIG. 5 is a diagram showing an example of specifying rectangular frames in the same column in the embodiment of the present invention. [Figure 6] FIG. 6 is a block diagram showing the configuration of a frameless table tilt correction device according to an embodiment of the present invention. [Figure 7] FIG. 7 is a diagram showing another configuration of a frameless table tilt correction device according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE INVENTION

[0018] In the following, detailed descriptions will be provided in conjunction with drawings and specific embodiments to clarify the problems, configurations, and effects of the present invention. In the following description, specific details of specific arrangements and components are provided only to facilitate a comprehensive understanding of the embodiments of the present invention. Therefore, it will be apparent to those skilled in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present invention. For the sake of clarity and conciseness, descriptions of known functions and configurations will be omitted.

[0019] References throughout the specification to "one embodiment" or "an embodiment" mean that a particular feature, structure, or characteristic associated with an embodiment is included in at least one embodiment of the present application. Therefore, the appearances of "in one embodiment" or "in one embodiment" in various places in the specification do not necessarily refer to the same embodiment. Alternatively, these particular features, structures, or characteristics may be combined in any suitable manner with one or more embodiments. The terms "first," "second," and the like in the specification and claims of the present application are used to distinguish between similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such terms are interchangeable under appropriate circumstances, whereby the embodiments of the present invention described herein may, for example, be practiced in orders other than those illustrated or described herein. Furthermore, the terms "comprise" and "have," and any variations thereof, are intended to cover non-exclusive inclusions; for example, a process, method, system, product, or apparatus comprising a series of steps or units is not necessarily limited to the explicitly recited steps or units, but may include other steps or units not explicitly recited or inherent in such process, method, product, or apparatus. In the specification and claims, "and / or" means at least one of the connected objects.

[0020] In each embodiment of the present invention, the magnitude of the numbers of the following processes does not mean the order of execution. The execution order of each process is determined by its function and inherent logic, and does not imply any limitation on the implementation process of the embodiment of the present invention.

[0021] The following description provides examples and is not intended to limit the scope, applicability, or configuration of the claims. Changes may be made in the function or arrangement of the elements discussed without departing from the spirit and scope of the invention. Procedures and components of the various examples may be omitted, substituted, or added as appropriate. For example, the methods described may be performed in an order different from that described, and various steps may be added, omitted, or combined. Additionally, features described in some examples may be combined in other examples.

[0022] In order to improve the accuracy of the feature points of the acquired frameless table image, improve the performance of the image skew correction process, and further improve the accuracy of identifying the frameless table, an embodiment of the present invention provides a frameless table skew correction method, which, as shown in Figure 1, includes the following steps:

[0023] In step 11, a first rectangular image of a frameless table containing text is obtained. Here, a frameless table means that the table has no vertical or horizontal lines. Table 1 shows an example of a frameless table.

[0024] [Table 1] In an embodiment of the present invention, an image including a frameless table is obtained by photographing a sheet of paper on which the frameless table is printed. Typically, the photographed image is a rectangular image having four sides (left, top, right, and bottom). Here, the left side faces the right side, and the top side faces the bottom. Figure 2 is an example of a first rectangular image photographed of the frameless table shown in Table 1. The first rectangular image 20 shown in Figure 2 has four sides: a left side 201, a top side 202, a right side 203, and a bottom side 204. The frameless table in Figure 2 is oriented at an angle.

[0025] In step 12, the frameless table skew correction method according to the embodiment of the present invention performs text detection on the first rectangular image to obtain a text portion in the first rectangular image and a rectangular frame circumscribing the text portion.

[0026] Here, text can be detected from the first rectangular image using conventional OCR technology. OCR technology identifies characters in an image, obtains text portions consisting of at least one character, and generates rectangular frames circumscribing the text portions. Figure 3 shows the detection results of text detection performed on the first rectangular image of the frameless table shown in Figure 2. The first rectangular image contains 56 rectangular frames, 301 to 356. Due to a certain distortion in the captured image, sides 201 to 204 of the first rectangular image are not strictly parallel or perpendicular to the four sides of the rectangular frames shown in Figure 3. Each rectangular frame has four frame sides: a left frame side, a top frame side, a right frame side, and a bottom frame side. Each rectangular frame has four vertices: an upper left corner vertex, an upper right corner vertex, a lower left corner vertex, and a lower right corner vertex. The two vertices of the left frame side are the upper left corner vertex and the lower left corner vertex. The two vertices of the top frame side are the upper left corner vertex and the upper right corner vertex. The two vertices of the bottom frame edge are the bottom left corner vertex and the bottom right corner vertex.

[0027] In step 13, a rectangular frame set is generated that includes at least one rectangular frame near each side of the first rectangular image; a target inclination angle is identified based on the inclination angle of a target frame edge that is the frame edge closest to the side in a rectangular frame in the rectangular frame set; a reference point is identified based on a target vertex that is a vertex through which the target frame edge passes in a rectangular frame in the rectangular frame set; and a straight line that passes through the reference point and has an inclination angle equal to the target inclination angle is generated as the outer frame line of the frameless table.

[0028] Here, a set of rectangular frames is generated for each side of the first rectangular image, including at least one rectangular frame near that side. In the embodiment of the present invention, there are several methods for generating the set of rectangular frames, which will be described in detail below.

[0029] As a method for generating a set of rectangular frames, a first method selects, for each side of a first rectangular image, a predetermined number of rectangular frames that are closest to that side, and configures a set of rectangular frames.

[0030] Specifically, first, the distance from a predetermined vertex of each rectangular frame to the corresponding side is calculated. For example, for the left side of the first rectangular image, the distance from the upper left vertex or the lower left vertex of the rectangular frame is calculated. Also, for the top side of the first rectangular image, the distance from the upper left vertex or the upper right vertex of the rectangular frame is calculated. Furthermore, for the right side of the first rectangular image, the distance from the upper right vertex or the lower right vertex of the rectangular frame is calculated, and for the bottom side of the first rectangular image, the distance from the lower left vertex or the lower right vertex of the rectangular frame is calculated.

[0031] A predetermined number of rectangular frames are then selected in ascending order of distance to form a rectangular frame set. The predetermined number of rectangular frames corresponding to each side of the first rectangular image may be the same. For example, for each side of the first rectangular image, three rectangular frames that are closest to that side are selected to form one rectangular frame set. Using FIG. 3 as an example, the three rectangular frames closest to the left side 201 of the first rectangular image, e.g., rectangular frame 301, rectangular frame 306, and rectangular frame 344, are selected to form a rectangular frame set. The three rectangular frames closest to the top side 202 of the first rectangular image, e.g., rectangular frame 301, rectangular frame 302, and rectangular frame 303, are selected to form a rectangular frame set. The three rectangular frames closest to the right side 203 of the first rectangular image, e.g., rectangular frame 305, rectangular frame 310, and rectangular frame 314, are selected to form a rectangular frame set. The three rectangular frames closest to the bottom side 204 of the first rectangular image, e.g., rectangular frames 354, 355, and 356, are selected to form a rectangular frame set.

[0032] In addition, in the embodiment of the present invention, the predetermined number corresponding to each side of the first rectangular image may be different or may be partially the same. For example, four rectangular frames with the smallest distance to the left side of the first rectangular image are selected in order from smallest to largest distance to form a rectangular frame set. Similarly, three rectangular frames with the smallest distance to the top side of the first rectangular image are selected to form a rectangular frame set. Furthermore, four rectangular frames with the smallest distance to the right side of the first rectangular image are selected to form a rectangular frame set. Furthermore, three rectangular frames with the smallest distance to the bottom side of the first rectangular image are selected to form a rectangular frame set.

[0033] As a method for generating a rectangular frame set, the second method selects, for each side of the first rectangular image, a rectangular frame whose distance to that side is equal to or less than a preset distance threshold, and forms a rectangular frame set. Specifically, first, the distance from a predetermined vertex of each rectangular frame to that side is calculated. See above for the calculation method. Then, a corresponding distance threshold is set for each side of the first rectangular image. The distance thresholds corresponding to each side may be the same, partially the same, or completely different. Then, a rectangular frame whose distance to that side is equal to or less than the corresponding distance threshold is selected, and a rectangular frame set is formed.

[0034] The third method for generating a set of rectangular frames is as follows.

[0035] (1) First, identify the matrix to which the rectangular frame in the first rectangular image belongs. That is, identify the rectangular frames that belong to the same row and column in the first rectangular image. Since the image of the frameless table may be distorted, when identifying the matrix, identify the matrix relationship from the extension lines of the frame sides of the rectangular frame.

[0036] Specifically, for any two rectangular frames in the same row, the distance between the extension lines of the top frame side is smaller than a first threshold value, and the distance between the extension lines of the bottom frame side is smaller than a second threshold value. Also, for any two rectangular frames in the same column, the distance between the extension lines of the left frame side is smaller than a third threshold value. The first, second, and third threshold values ​​may be the same or different. Specifically, these threshold values ​​can be set based on parameters such as character size, character spacing, and line spacing.

[0037] Considering that the corresponding sides of a rectangular frame may not be parallel, the distance between the extensions of the top sides is expressed as the distance from the two vertices of the top side of one rectangular frame to the extension of the top side of the other rectangular frame. The distance between the extensions of the bottom sides is expressed as the distance from the two vertices of the bottom side of one rectangular frame to the extension of the bottom side of the other rectangular frame. The distance between the extensions of the left sides is expressed as the distance from the two vertices of the left side of one rectangular frame to the extension of the left side of the other rectangular frame.

[0038] In this way, when there are at least two rectangular frames belonging to the same row, the distances from the two vertices of the top edge of the first rectangular frame to the extension of the top edge of the second rectangular frame are all smaller than the first threshold, and the distances from the two vertices of the bottom edge of the first rectangular frame to the extension of the bottom edge of the second rectangular frame are all smaller than the second threshold. The first rectangular frame and the second rectangular frame are any two rectangular frames belonging to the same row. Furthermore, when there are at least two rectangular frames belonging to the same column, the distances from the two vertices of the left edge of the third rectangular frame to the extension of the left edge of the fourth rectangular frame are all smaller than the third threshold. The third rectangular frame and the fourth rectangular frame are any two rectangular frames belonging to the same column.

[0039] Note that one rectangular frame is considered to be in a row or column by itself if it satisfies the condition that the distance between the extended lines of the top frame sides is equal to or greater than a first threshold value, or the distance between the extended lines of the bottom frame sides is equal to or greater than a second threshold value, relative to the other rectangular frame in the first rectangular image. Furthermore, when the distance between the extended lines of the top frame sides is expressed using the distance from two vertices of the top frame side of one rectangular frame to the extended line of the top frame side of the other rectangular frame, the above condition can be expressed by the distance from at least one vertex of the top frame side of one rectangular frame to the extended line of the top frame side of the other rectangular frame being equal to or greater than a first threshold value, or the distance from at least one vertex of the bottom frame side of one rectangular frame to the extended line of the bottom frame side of the other rectangular frame being equal to or greater than a second threshold value.

[0040] One rectangular frame is considered to be in a single column when the distances between the left extended lines of the other rectangular frame in the first rectangular image are equal to or greater than a third threshold. When the distances between the left extended lines of the one rectangular frame and the other rectangular frame are expressed using the distances from the two vertices of the left side of the one rectangular frame to the extended lines of the left side of the other rectangular frame, the above condition may be expressed by the distances from the two vertices of the left side of the one rectangular frame to the extended lines of the left side of the other rectangular frame being equal to or greater than the third threshold.

[0041] Take Figure 4 as an example. Here, the distances from the two vertices of the top edge of rectangular frame 302 to extension line 402 of the top edge of rectangular frame 301 are D1 and D2, respectively. Because D1 is greater than the first threshold and D2 is greater than the second threshold, rectangular frame 302 and rectangular frame 301 do not belong to the same row. Also, because the distances between the extension line of the top edge of rectangular frame 301 and the extension lines of the top edges of other rectangular frames are all greater than the first threshold, there are no other rectangular frames that belong to the same row as rectangular frame 301, and rectangular frame 301 belongs to a row by itself. In other words, the row contains only rectangular frame 301.

[0042] The distances from the two vertices of the top frame side of rectangular frames 303-305 to an extension line 402 of the top frame side of rectangular frame 302 are all smaller than a first threshold, and the distances from the two vertices of the bottom frame side of rectangular frames 303-305 to an extension line 403 of the bottom frame side of rectangular frame 302 are also smaller than a second threshold. Therefore, rectangular frames 303-305 and rectangular frame 302 are rectangular frames that belong to the same column. That is, the rectangular frames belonging to that row include rectangular frames 302 to 305.

[0043] Also, take FIG. 5 as an example. FIG. 5 shows an extension line 501 of the left frame side of rectangular frame 301. Since the distances from the two vertices of the left frame side of rectangular frames other than rectangular frame 301 to the extension line 501 of the left frame side of rectangular frame 301 are all greater than the third threshold, rectangular frame 301 forms a column by itself. The rectangular frames in this column control only rectangular frame 301. In contrast, the distances from the two vertices of the left frame side of rectangular frame 344 to the extension line 502 of the left frame side of rectangular frame 306 are all less than the third threshold. Therefore, rectangular frame 344 and rectangular frame 306 belong to the same column. In other words, the rectangular frames belonging to this column include rectangular frame 344 and rectangular frame 306. Furthermore, the distances of the two vertices of the left frame side of rectangular frame 311, rectangular frame 315, rectangular frame 318, rectangular frame 322, rectangular frame 326, rectangular frame 329, rectangular frame 332, rectangular frame 335, rectangular frame 338, rectangular frame 341, rectangular frame 345, rectangular frame 349, and rectangular frame 353 to the extension line 503 of the left frame side of rectangular frame 307 are all less than the third threshold, so rectangular frame 307, rectangular frame 311, rectangular frame 315, rectangular frame 318, rectangular frame 322, rectangular frame 326, rectangular frame 329, rectangular frame 332, rectangular frame 335, rectangular frame 338, rectangular frame 341, rectangular frame 345, rectangular frame 349, and rectangular frame 353 belong to one column.

[0044] (2) For the left edge of the first rectangular image, rectangular frames belonging to the first column are selected to form the first rectangular frame set. For the right edge of the first rectangular image, rectangular frames belonging to the last column are selected to form the second rectangular frame set. Furthermore, for the top edge of the first rectangular image, rectangular frames belonging to the first row are selected to form the third rectangular frame set. Finally, for the bottom edge of the first rectangular image, rectangular frames belonging to the last row are selected to form the fourth rectangular frame set. Here, the first column is the column closest to the left edge of the first rectangular image, and the last column is the column closest to the right edge of the first rectangular image. Furthermore, the first row is the row closest to the top edge of the first rectangular image, and the last row is the row closest to the bottom edge of the first rectangular image.

[0045] By using the above method, a set of rectangular frames corresponding to each side of the first rectangular image can be generated.

[0046] After generating the rectangular frame set, the embodiment of the present invention determines the target inclination angle based on the inclination angle of the target frame side, which is the frame side closest to the side of a rectangular frame in the rectangular frame set.

[0047] The target tilt angle is determined by calculating the tilt angle of the target frame side of each rectangular frame in the set of rectangular frames relative to a reference line, and setting this as the tilt angle of the target frame side of the rectangular frame. The reference line is a preset horizontal or vertical line. For example, any side of the first rectangular image is set as the reference line. Then, a first statistical value, which is the median or average of the angles of the target frame side of each rectangular frame relative to the reference line, is calculated and set as the target tilt angle. Furthermore, when determining a reference point from the target vertex of each rectangular frame in the set of rectangular frames, the coordinates of the target vertex of each rectangular frame in the set of rectangular frames are obtained. Then, a second statistical value, which is the median or average of the coordinates of the obtained target vertex, is calculated and set as the coordinate of the reference point.

[0048] Here, the number of rectangular frames in the rectangular frame set may be one or more. Therefore, the number of calculated inclination angles of the target frame sides may be one or more. When the number of calculated inclination angles of the target frame sides is one, an embodiment of the present invention determines the target inclination angle based on this one inclination angle. For example, this one inclination angle is used as the target inclination angle. Also, when the number of calculated inclination angles of the target frame sides is multiple, the target inclination angle is determined based on the first statistical value of these inclination angles.

[0049] For example, a first target tilt angle is determined based on a first statistical value of the angle of the left frame side of each rectangular frame in the first rectangular frame set corresponding to the left side of the first rectangular image relative to the reference line. Then, the coordinate of the upper left vertex of each rectangular frame in the first rectangular frame set is obtained, and a second statistical value of the coordinate of these upper left vertices is calculated to obtain the coordinate of the first reference point. Alternatively, the coordinate of the lower left vertex of each rectangular frame in the first rectangular frame set is obtained, and a second statistical value of the coordinate of these lower left vertices is calculated to obtain the coordinate of the first reference point. Alternatively, the coordinates of the upper left and lower left vertices of each rectangular frame in the first rectangular frame set are obtained, and a second statistical value of the coordinate of these upper left and lower left vertices is calculated to obtain the coordinate of the first reference point. Furthermore, a straight line passing through the first reference point and having a tilt angle equal to the first target tilt angle is generated, and this line is used as the first outer frame line of the frameless table.

[0050] A second target tilt angle is determined based on first statistical values ​​of the angles of the right frame sides of each rectangular frame in the second rectangular frame set corresponding to the right side of the first rectangular image relative to the reference line. Then, the coordinates of the upper right vertices of each rectangular frame in the second rectangular frame set are obtained, second statistical values ​​of these upper right vertices are calculated, and the coordinates of the second reference point are obtained. Alternatively, the coordinates of the lower right vertices of each rectangular frame in the second rectangular frame set are obtained, second statistical values ​​of these lower right vertices are calculated, and the coordinates of the second reference point are obtained. Alternatively, the coordinates of the upper right and lower right vertices of each rectangular frame in the second rectangular frame set are obtained, second statistical values ​​of these upper right and lower right vertices are calculated, and the coordinates of the second reference point are obtained. Furthermore, a straight line passing through the second reference point and having a tilt angle equal to the second target tilt angle is generated, and this line is used as the second outer frame line of the frameless table.

[0051] A third target tilt angle is determined based on first statistical values ​​of the angles of the top frame sides of each rectangular frame in the third rectangular frame set corresponding to the top side of the first rectangular image relative to the reference line. Then, the coordinates of the upper left vertices of each rectangular frame in the third rectangular frame set are obtained, and second statistical values ​​of these upper left vertices are calculated to obtain the coordinates of the third reference point. Alternatively, the coordinates of the upper right vertices of each rectangular frame in the third rectangular frame set are obtained, and second statistical values ​​of these upper right vertices are calculated to obtain the coordinates of the third reference point. Alternatively, the coordinates of the upper left and upper right vertices of each rectangular frame in the third rectangular frame set are obtained, and second statistical values ​​of these upper left and upper right vertices are calculated to obtain the coordinates of the third reference point. Furthermore, a straight line passing through the third reference point and having a tilt angle equal to the third target tilt angle is generated, and this line is used as the third outer frame line of the frameless table.

[0052] A fourth target tilt angle is determined based on first statistical values ​​of the angles of the bottom frame edges of each rectangular frame in the fourth rectangular frame set corresponding to the bottom edge of the first rectangular image relative to the reference line. Then, the coordinates of the lower left vertices of each rectangular frame in the fourth rectangular frame set are obtained, and second statistical values ​​of these lower left vertices are calculated to obtain the coordinates of the fourth reference point. Alternatively, the coordinates of the lower right vertices of each rectangular frame in the fourth rectangular frame set are obtained, and second statistical values ​​of these lower right vertices are calculated to obtain the coordinates of the fourth reference point. Alternatively, the coordinates of the lower left and lower right vertices of each rectangular frame in the fourth rectangular frame set are obtained, and second statistical values ​​of these lower left and lower right vertices are calculated to obtain the coordinates of the fourth reference point. Furthermore, a straight line passing through the fourth reference point and having a tilt angle equal to the fourth target tilt angle is generated, and this line is used as the fourth outer frame line of the frameless table.

[0053] In step 14, four intersection points are determined based on the four outer borders of the frameless table.

[0054] Here, based on the four outer frame lines of the frameless table obtained in step 13, the intersections of these outer frame lines, that is, four intersection points, are obtained.

[0055] In step 15, a perspective transformation is performed based on the four intersection points and four predetermined target points to form a perspective transformation matrix.

[0056] Here, the four predetermined target points are the four vertices of the perspective-transformed frameless table, which respectively correspond to the four intersection points obtained in step 14. Based on the coordinates of the intersection points and the target points, a perspective transformation matrix is ​​formed by conventional processing methods.

[0057] Specifically, any one of the four intersections is set as a predetermined target point, and the coordinates of the remaining predetermined target points are determined based on the coordinates of this intersection and the distance to the adjacent intersection. Below, we will explain an example in which the lower left intersection is set as the predetermined intersection.

[0058] The coordinates of the intersection of the first outer frame line and the fourth outer frame line at the bottom left are (x1, y1).

[0059] The coordinates of the upper left intersection of the first outer frame line and the third outer frame line are (x2, y2).

[0060] The coordinates of the intersection of the second and fourth outer frame lines at the bottom right are (x3, y3).

[0061] The coordinates of the upper right intersection of the second and third outer frame lines are (x4, y4).

[0062] If the frameless table does not need to be resized, the lower-left intersection is selected as the first predetermined target point. That is, the coordinates of the first predetermined target point corresponding to the lower-left intersection are (x1, y1). Then, the first distance L1 between the lower-left intersection and the upper-left intersection is calculated, and the coordinates (x1, y1 + L1) of the second predetermined target point corresponding to the upper-left intersection are generated. The second distance L2 between the lower-left intersection and the lower-right intersection is calculated, and the coordinates (x1 + L2, y1) of the third predetermined target point corresponding to the lower-right intersection are generated. Finally, the coordinates (x1 + L2, y1 + L1) of the fourth predetermined target point corresponding to the upper-right intersection are obtained.

[0063] If the frameless table does not need to be resized, the size is changed for the first distance and the second distance according to a preset scaling ratio α, and the coordinates of the four predetermined target points are as follows: the coordinates of the first predetermined target point corresponding to the lower left intersection are (x1, y1), the coordinates of the second predetermined target point corresponding to the upper left intersection are (x1, y1+α*L1), the coordinates of the third predetermined target point corresponding to the lower right intersection are (x1+α*L2, y1), and the coordinates of the fourth predetermined target point corresponding to the upper right intersection are (x1+α*L2, y1+α*L1).

[0064] In step 16, the first rectangular image is corrected based on the perspective transformation matrix to generate a corrected second rectangular image.

[0065] Here, tilt correction is performed on the first rectangular image using the perspective transformation matrix to obtain a corrected second rectangular image.

[0066] In the embodiment of the present invention, the outlines of the frameless table are determined based on the skew angles and vertex coordinates of the rectangular frames obtained through text detection. By comprehensively considering the skew angles and vertex coordinates of multiple rectangular frames, the accuracy of the feature points of the frameless table image obtained can be improved, and the performance of the subsequent image skew correction process can be improved.

[0067] Furthermore, an embodiment of the present invention provides a tilt correction device for implementing the above tilt correction method. As shown in Figure 6, the tilt correction device for a frameless table according to this embodiment of the present invention includes an image acquisition module 601 for acquiring a first rectangular image of a frameless table including text, a text detection module 602 for performing text detection on the first rectangular image to obtain a text portion in the first rectangular image and a rectangular frame circumscribing the text portion, a set of rectangular frames including at least one rectangular frame near each side of the first rectangular image, a target tilt angle determined based on the tilt angle of a target frame side that is the frame side closest to the first side in the set of rectangular frames, and a target tilt angle determined based on the tilt angle of a target frame side that is the frame side closest to the first side in the set of rectangular frames. an outer frame line generation module 603 that determines a reference point based on a target vertex that is a vertex through which the target frame side passes; an outer frame line generation module 603 that generates a straight line that passes through the reference point and has a tilt angle of the target tilt angle as the outer frame line of the frameless table; an intersection generation module 604 that determines four intersections based on the four outer frame lines of the frameless table; a matrix acquisition module 605 that performs perspective transformation based on the four intersections and four predetermined target points to form a perspective transformation matrix; and an image correction module 606 that corrects the first rectangular image based on the perspective transformation matrix to generate a corrected second rectangular image.

[0068] Through the above modules, the embodiment of the present invention can improve the accuracy of the feature points of the acquired frameless table image and improve the performance of the subsequent image skew correction process.

[0069] Preferably, the outer frame line generation module 603 includes a first identification module that identifies the matrix to which the rectangular frames in the first rectangular image belong, and among them, for rectangular frames in the same row, the distance between the upper frame extension lines of any two rectangular frames is smaller than a first threshold, the distance between the lower frame extension lines is smaller than a second threshold, and for rectangular frames in the same column, the distance between the left frame extension lines of any two rectangular frames is smaller than a third threshold; a first selection module that selects rectangular frames in the first column for the left side of the first rectangular image and forms a first rectangular frame set; a second selection module that selects rectangular frames in the last column for the right side of the first rectangular image and forms a second rectangular frame set; a third selection module that selects rectangular frames in the first row for the top side of the first rectangular image and forms a third rectangular frame set; and a fourth selection module that selects rectangular frames in the last row for the bottom side of the first rectangular image and forms a fourth rectangular frame set.

[0070] Preferably, the outer frame line generation module 603 includes a first calculation module that calculates the angle of the target frame of each rectangular frame in the set of rectangular frames relative to a reference line that is a predetermined horizontal or vertical line, and a second calculation module that calculates a first statistical value that is the median or average value of the angles of the target frame of each rectangular frame relative to the reference line as the target tilt angle.

[0071] Preferably, the outer frame line generation module 603 further includes a first acquisition module that acquires the coordinates of the target vertices of each rectangular frame in the set of rectangular frames, and a third calculation module that calculates a second statistical value, which is the median or average value of the acquired coordinates of the target vertices, as the coordinate of the reference point.

[0072] Preferably, the first acquisition module further includes acquiring the coordinates of the upper left and / or lower left vertices of each rectangular frame in the first rectangular set relative to the left side of the first rectangular image, acquiring the coordinates of the upper right and / or lower right vertices of each rectangular frame in the second rectangular set relative to the right side of the first rectangular image, acquiring the coordinates of the upper left and / or upper right vertices of each rectangular frame in the third rectangular set relative to the top side of the first rectangular image, and acquiring the coordinates of the lower left and / or lower right vertices of each rectangular frame in the fourth rectangular set relative to the bottom side of the first rectangular image.

[0073] The device / system provided in the above embodiment is a frameless table tilt correction device corresponding to the frameless table tilt correction method. The implementation manner of the above embodiment can also be applied to the device embodiment, and similar technical effects can be achieved. Therefore, the tilt correction device of the embodiment of the present invention implements all the method steps implemented in the tilt correction method embodiment and achieves similar effects, so detailed descriptions of the similar parts and beneficial effects to the method embodiment will be omitted.

[0074] 7 is a block diagram showing the hardware structure of a frameless table skew correction device according to an embodiment of the present invention. As shown in FIG. 7, the frameless table skew correction device 700 includes a processor 702 and a memory 704 for storing computer program instructions. When the processor executes the computer program instructions, the processor 702 acquires a first rectangular image of the frameless table containing text; performs text detection on the first rectangular image to obtain a text portion in the first rectangular image and a rectangular frame circumscribing the text portion; generates a set of rectangular frames including at least one rectangular frame near each side of the first rectangular image; and generates a set of rectangular frames near each side of the first rectangular image. The steps are realized: determining a target inclination angle based on the inclination angle of the target frame side, which is the closest frame side; determining a reference point based on the target vertex, which is the vertex through which the target frame side passes in a rectangular frame in the rectangular frame set; generating a straight line that passes through the reference point and has an inclination angle of the target inclination angle as the outer frame line of the frameless table; determining four intersection points based on the four outer frame lines of the frameless table; performing perspective transformation based on the four intersection points and four predetermined target points to form a perspective transformation matrix; and correcting the first rectangular image based on the perspective transformation matrix to generate a corrected second rectangular image.

[0075] The device / system provided in the above embodiment is a frameless table tilt correction device corresponding to the frameless table tilt correction method. The implementation manner of the above embodiment can also be applied to the device embodiment, and similar technical effects can be achieved. Therefore, the tilt correction device of the embodiment of the present invention implements all the method steps implemented in the tilt correction method embodiment and achieves similar effects, so detailed descriptions of the similar parts and beneficial effects to the method embodiment will be omitted.

[0076] Furthermore, as shown in FIG. 7, the frameless table tilt correction device 700 includes a network interface 701 , an input device 703 , a hard disk 705 , and a display device 706 . These interfaces and devices are interconnected via a bus architecture. The bus architecture may include any number of interconnected buses and bridges. Specifically, various circuits, such as one or more central processing units (CPUs) and / or graphics processors (GPUs) represented by processor 702, and one or more memories represented by memory 704, are connected. The bus architecture may also connect various other circuits, such as peripherals, voltage regulators, and power management circuits. The bus architecture enables communication between these components. In addition to a data bus, the bus architecture may also include a power bus, a control bus, and a status signal bus. All of these are well known in the art and will not be described in detail here. The network interface 701 is connected to a network (for example, the Internet, a local area network, etc.), receives data such as original training samples from the network, and stores the received data in the hard disk 705 .

[0077] The input device 703 receives various commands input by an operator and sends them to the processor 702 for execution. The input device 703 includes a keyboard or a pointing device (e.g., a mouse, a trackball, a touch board, or a touch screen).

[0078] Display device 706 displays the results obtained from the execution of instructions by processor 702, such as model training progress.

[0079] The memory 704 stores programs and data necessary for the execution of the operating system (OS), as well as data such as intermediate results during calculations by the processor 702.

[0080] It should be noted that memory 704 in embodiments of the invention may be volatile or non-volatile memory, or may include both volatile and non-volatile memory. Non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory may be random access memory (RAM) used as an external cache. Memory 704 of the apparatus and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0081] In some embodiments, memory 704 stores an operating system 7041 and application programs 7042, which may be executable modules or data structures or submodules or extension modules thereof.

[0082] Here, the operating system 7041 includes various system programs, such as a framework layer, a core library layer, and a driver layer, and is used to realize various mission-critical tasks and hardware-based tasks. The application programs 7042 include various application programs, such as a web browser, and are used to realize various application tasks. The program that executes the method according to this embodiment is included in the application programs 7042.

[0083] The method according to the embodiment of the present invention is applied to or implemented by a processor 702. The processor 702 is an integrated circuit board capable of processing signals. Each step of the method is implemented by an integrated logic circuit (hardware) in the processor 702 or by instructions in software form. The processor 702 may be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, capable of implementing or executing each method, step, and logic box disclosed in the embodiment of the present invention. The general-purpose processor may be a microprocessor or any other general processor. Each step of the method according to the embodiment of the present invention may be implemented by a decoder (hardware), or may be implemented by a combination of hardware and software accessible to the decoder. The software modules are stored in a storage medium well-known in the art, such as a random memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, or a register. The processor 702 reads information from the memory 704, which comprises a storage medium on which the software is stored, and configures the hardware to implement the steps of the above-described method.

[0084] The above-described embodiments may be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof, wherein, for a hardware implementation, the processing unit may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processors (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units that perform the functions of the present invention, or a combination thereof.

[0085] Regarding software implementation, the above technology is realized by modules (e.g., processes, functions, etc.) that implement the functions described above. The software code is stored in a memory and executed by a processor. The memory may be implemented inside or outside the processor.

[0086] Specifically, when the computer program is executed by the processor 702, the following steps are realized: identifying the matrix to which the rectangular frames in the first rectangular image belong, and among the rectangular frames in the same row, the distance between the upper frame extension lines of any two rectangular frames is smaller than a first threshold, the distance between the lower frame extension lines is smaller than a second threshold, and among the rectangular frames in the same column, the distance between the left frame extension lines of any two rectangular frames is smaller than a third threshold; selecting the rectangular frames in the first column for the left edge of the first rectangular image to form a first rectangular frame set; selecting the rectangular frames in the last column for the right edge of the first rectangular image to form a second rectangular frame set; selecting the rectangular frames in the first row for the top edge of the first rectangular image to form a third rectangular frame set; and selecting the rectangular frames in the last row for the bottom edge of the first rectangular image to form a fourth rectangular frame set.

[0087] Specifically, when the computer program is executed by the processor 702, the following steps are realized: calculating the angle of the target frame of each rectangular frame in the set of rectangular frames relative to a reference line, which is a predetermined horizontal or vertical line; and calculating, as the target tilt angle, a first statistical value that is the median or average value of the angles of the target frames of each rectangular frame relative to the reference line.

[0088] Specifically, when the computer program is executed by the processor 702, the steps of obtaining the coordinates of the target vertices of each rectangular frame in the set of rectangular frames and calculating a second statistical value, which is the median or average value of the coordinates of the obtained target vertices, as the coordinate of the reference point, are realized.

[0089] Specifically, when the computer program is executed by the processor 702, the following steps are realized: acquiring the coordinates of the upper left and / or lower left vertices of each rectangular frame in the first rectangular set relative to the left side of the first rectangular image; acquiring the coordinates of the upper right and / or lower right vertices of each rectangular frame in the second rectangular set relative to the right side of the first rectangular image; acquiring the coordinates of the upper left and / or upper right vertices of each rectangular frame in the third rectangular set relative to the top side of the first rectangular image; and acquiring the coordinates of the lower left and / or lower right vertices of each rectangular frame in the fourth rectangular set relative to the bottom side of the first rectangular image.

[0090] The frameless table tilt correction device provided in the above embodiment implements all the method steps implemented in the frameless table tilt correction method and achieves the same effects, so detailed descriptions of the same parts and beneficial effects as those in the method embodiment will be omitted.

[0091] Furthermore, some embodiments of the present invention provide a computer-readable storage medium having a program stored thereon, wherein the program, when executed by a processor, achieves the following steps: acquiring a first rectangular image of a frameless table containing text; performing text detection on the first rectangular image to obtain a text portion in the first rectangular image and a rectangular frame circumscribing the text portion; generating a rectangular frame set including at least one rectangular frame near each side of the first rectangular image, and determining a target tilt angle based on the tilt angle of a target frame edge, which is the frame edge closest to the first side, in a rectangular frame in the rectangular frame set; determining a reference point based on a target vertex, which is a vertex through which the target frame edge passes, in a rectangular frame in the rectangular frame set, and generating a straight line that passes through the reference point and has the target tilt angle as an outer frame line of the frameless table; determining four intersection points based on four outer frame lines of the frameless table; performing perspective transformation based on the four intersection points and four predetermined target points to form a perspective transformation matrix; and performing correction on the first rectangular image based on the perspective transformation matrix to generate a corrected second rectangular image.

[0092] When the program is executed by a processor, all aspects of the frameless table tilt correction method are realized and the same technical effects are achieved, so to avoid repetition, a description thereof will be omitted here.

[0093] Those skilled in the art of the present invention can easily imagine that the units and algorithm steps of each example described in the embodiments disclosed above can be realized by electronic hardware or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the invention. Those skilled in the art can realize the above functions in a way that suits the specific application, but it should not go beyond the scope of the present invention.

[0094] Furthermore, for the sake of convenience and brevity, detailed descriptions of the specific operating processes of the above systems, devices, and units will be omitted, as it will be obvious to those skilled in the art that reference can be made to the corresponding processes in the above embodiments.

[0095] It is readily apparent that the methods and devices disclosed in the various embodiments of the present invention may be realized in other forms. For example, the devices described above are merely schematic. For example, the division of units described above is merely an example of logical function allocation, and other division schemes may be adopted in actual implementation. For example, multiple units or modules may be combined or integrated into another system, or some functions may be omitted or not performed. Note that the mutual connections, direct connections, or communicative connections shown or disclosed above are connections via interfaces. Indirect connections or communicative connections between devices or units may be electrical, mechanical, or other types of connections.

[0096] The units described as separate components may or may not be physically separated. Components represented as units may or may not be physical units. That is, they may be co-located or distributed across multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the embodiments of the present invention.

[0097] The functional units according to the embodiments of the present invention may be integrated into one processing unit, may be physically independent, or may be integrated into one unit consisting of two or more functional units.

[0098] The functions can be realized in the form of software functional units and stored in a computer-readable storage medium when sold or used as an independent product. In this case, the technical solution of the present invention, or the part that essentially contributes to the prior art or the part of the technical solution, is expressed in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions that cause a computer device (such as a personal computer, a server, or a network device) to perform all or part of the steps of the method according to each embodiment of the present invention. The storage medium includes various media capable of storing program code, such as a USB memory, a removable disk, a ROM, a RAM, a magnetic disk, or an optical disk.

[0099] The above description is a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto, and any modifications or substitutions that can be easily conceived by any person skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of the present invention should be determined based on the scope of the claims.

Claims

1. A method for correcting tilt of a frameless table, which is performed by a frameless table tilt correction device, comprising: obtaining a first rectangular image of a frameless table containing text; performing text detection on the first rectangular image to obtain a text portion in the first rectangular image and a rectangular frame circumscribing the text portion; a step of generating, for each side of the first rectangular image, a rectangular frame set including at least one rectangular frame near the side, determining a target inclination angle based on the inclination angle of a target frame side of a rectangular frame in the rectangular frame set, determining a reference point based on a target vertex of a rectangular frame in the rectangular frame set, and generating a straight line that passes through the reference point and has the target inclination angle as an outer frame line of the frameless table, wherein the target frame side is the frame side of the rectangular frame that is closest to the side, and the target vertex is a vertex through which the target frame side passes; determining four intersection points based on four outer border lines of the frameless table; performing a perspective transformation based on the four intersections and four predetermined target points to obtain a perspective transformation matrix; and correcting the first rectangular image based on the perspective transformation matrix to generate a corrected second rectangular image. A method for correcting tilt of a frameless table.

2. The step of generating a rectangular frame set for each side of the first rectangular image includes: a step of identifying a matrix to which a rectangular frame in the first rectangular image belongs, wherein, for rectangular frames in the same row, the distance between the upper frame extension lines of any two rectangular frames is smaller than a first threshold value, and the distance between the lower frame extension lines of any two rectangular frames is smaller than a second threshold value, and for rectangular frames in the same column, the distance between the left frame extension lines of any two rectangular frames is smaller than a third threshold value; selecting rectangular frames in the first column relative to the left side of the first rectangular image to form a first rectangular frame set, selecting rectangular frames in the last column relative to the right side of the first rectangular image to form a second rectangular frame set, selecting rectangular frames in the first row relative to the top side of the first rectangular image to form a third rectangular frame set, and selecting rectangular frames in the last row relative to the bottom side of the first rectangular image to form a fourth rectangular frame set.

2. The method for correcting tilt of a frameless table according to claim 1.

3. The step of determining a target inclination angle based on the inclination angle of the target frame side of the rectangular frame in the rectangular frame set includes: a step of calculating an angle of a target frame side of each rectangular frame in the set of rectangular frames with respect to a reference line, the reference line being a predetermined horizontal line or vertical line; calculating a first statistical value of the angle of the target frame side of each rectangular frame relative to the reference line as the target tilt angle, wherein the first statistical value is a median or average value of the angles.

3. The method for correcting tilt of a frameless table according to claim 2.

4. The step of determining a reference point based on a target vertex of a rectangular frame in the set of rectangular frames includes: obtaining coordinates of a target vertex of each rectangular box in the set of rectangular boxes; calculating a second statistical value of the coordinates of the acquired target vertices as the coordinates of the reference points, wherein the second statistical value is a median or an average value of the coordinates of the target vertices; 3. The method for correcting tilt of a frameless table according to claim 2.

5. The step of acquiring coordinates of the target vertices of each rectangular frame in the set of rectangular frames includes: obtaining the coordinates of the upper left vertex and / or the lower left vertex of each rectangular frame in the first set of rectangles relative to the left side of the first rectangular image; obtaining the coordinates of the upper right corner vertex and / or the lower right corner vertex of each rectangular frame in the second set of rectangles relative to the right side of the first rectangular image; obtaining the coordinates of the top left vertex and / or the top right vertex of each rectangular frame in the third set of rectangles relative to the top sides of the first rectangular image; and obtaining the coordinates of the bottom left vertex and / or bottom right vertex of each rectangular frame in the fourth set of rectangles relative to the bottom edge of the first rectangular image.

5. The method for correcting tilt of a frameless table according to claim 4.

6. an image acquisition module for acquiring a first rectangular image of a frameless table containing text; a text detection module that performs text detection on the first rectangular image to obtain a text portion in the first rectangular image and a rectangular frame circumscribing the text portion; an outer frame line generation module that generates, for each side of the first rectangular image, a rectangular frame set including at least one rectangular frame near the side, determines a target tilt angle based on the tilt angle of a target frame side of a rectangular frame in the rectangular frame set, determines a reference point based on a target vertex of a rectangular frame in the rectangular frame set, and generates a straight line that passes through the reference point and has a tilt angle of the target tilt angle as an outer frame line of the frameless table, wherein the target frame side is the frame side of the rectangular frame that is closest to the side, and the target vertex is a vertex through which the target frame side passes; an intersection generation module that determines four intersections based on the four outer frame lines of the frameless table; a matrix acquisition module that performs perspective transformation based on the four intersections and four predetermined target points to acquire a perspective transformation matrix; an image correction module that performs correction on the first rectangular image based on the perspective transformation matrix to generate a corrected second rectangular image. A tilt correction device for a frameless table.

7. The outer frame line generation module: a first specifying module for specifying a matrix to which a rectangular frame in the first rectangular image belongs, wherein, for rectangular frames in the same row, the distance between the upper frame extension lines of any two rectangular frames is smaller than a first threshold value, and the distance between the lower frame extension lines of any two rectangular frames in the same column is smaller than a third threshold value; a first selection module for selecting rectangular frames in a first row relative to a left edge of the first rectangular image to form a first set of rectangular frames; a second selection module for selecting rectangular frames in the last row relative to the right side of the first rectangular image to form a second set of rectangular frames; a third selection module for selecting rectangular boxes in a first row relative to a top edge of the first rectangular image to form a third set of rectangular boxes; a fourth selection module for selecting rectangular frames in the last row relative to the bottom of the first rectangular image to form a fourth set of rectangular frames.

7. The tilt correction device for a frameless table according to claim 6.

8. The outer frame line generation module: a first calculation module that calculates an angle of a target frame side of each rectangular frame in the rectangular frame set with respect to a reference line, the reference line being a predetermined horizontal line or vertical line; a second calculation module that calculates a first statistical value of an angle of a target frame side of each rectangular frame relative to a reference line as the target tilt angle, the first statistical value being a median or average value of the angle.

8. The tilt correction device for a frameless table according to claim 7.

9. The outer frame line generation module: a first acquisition module for acquiring coordinates of a target vertex of each rectangular frame in the set of rectangular frames; a third calculation module that calculates a second statistical value of the acquired coordinates of the target vertex as the coordinates of the reference point, wherein the second statistical value is a median or an average value of the coordinates of the target vertex; 8. The tilt correction device for a frameless table according to claim 7.

10. The first acquisition module: obtaining the coordinates of the upper left corner vertex and / or the lower left corner vertex of each rectangular frame in the first set of rectangles relative to the left side of the first rectangular image; obtain the coordinates of the upper right corner vertex and / or the lower right corner vertex of each rectangular frame in the second set of rectangles relative to the right side of the first rectangular image; obtaining the coordinates of the upper left corner vertex and / or the upper right corner vertex of each rectangular frame in the third set of rectangles relative to the top side of the first rectangular image; obtaining the coordinates of the bottom left vertex and / or the bottom right vertex of each rectangular frame in the fourth set of rectangles relative to the bottom side of the first rectangular image; 10. The tilt correction device for a frameless table according to claim 9.

11. A program that causes a processor to execute the method for correcting tilt of a frameless table according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Method and device for correcting inclined text image, medium and electronic equipment

    CN110427939A

  • Medical copy text tilt correction method, electronic equipment and readable storage medium

    CN113177899A

  • Image identification method and device, equipment and readable storage medium

    CN113762054A

  • Document labeling method and device, electronic equipment and storage medium

    CN114387598A

  • Image viewpoint conversion device and method

    JP2018045691A