An image tilt angle correction method, device, equipment, storage medium and product

CN115620002BActive Publication Date: 2026-08-07CHINA CONSTRUCTION BANK +1
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA CONSTRUCTION BANK
Filing Date
2022-09-22
Publication Date
2026-08-07

AI Technical Summary

Technical Problem

但是依赖于边缘检测的方法在图像边缘不清晰或是没有提取到边缘的情况下难以实现,且涉及的算法难度高,处理过程复杂

Benefits of technology

[0023]The image tilt angle correction method, apparatus, device, storage medium, and product of this application embodiment acquire multiple first target detection boxes in the image to be corrected, determine the tilt angle of each first target detection box relative to a first coordinate axis of the preset coordinate system, and obtain a tilt angle set. After processing the tilt angle set, a target angle subset is obtained, and the image to be corrected is rotated based on the average tilt angle of the target angle subset. Thus, this application embodiment achieves tilt image correction without using edge detection technology by clustering the tilt angles of multiple target detection boxes and then correcting the tilt angle of the image to be corrected based on the average angle of the angle subset with the most elements after clustering. This enables image tilt angle correction even when the image edges are unclear or have not been extracted.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115620002B_ABST
    Figure CN115620002B_ABST
Patent Text Reader

Abstract

The application discloses an image tilt angle correction method, device, equipment, storage medium and product. The method comprises the following steps: acquiring a plurality of first target detection boxes in a to-be-corrected image; determining a tilt angle of each first target detection box in a preset coordinate system relative to a first coordinate axis of the preset coordinate system, to obtain a tilt angle set; performing closed-loop clustering on the tilt angles in the tilt angle set, to obtain a plurality of angle sub-sets; selecting an angle sub-set with the largest number of elements from the plurality of angle sub-sets, to obtain a target angle sub-set; performing angle conversion on angles smaller than a preset angle threshold in the target angle sub-set, to obtain an angle-converted target angle sub-set; and rotating the to-be-corrected image according to an average value of the tilt angles of the angle-converted target angle sub-set, to obtain a target corrected image. According to the embodiment of the application, the angle correction of the to-be-detected image can be realized without relying on edge detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of image processing technology, and in particular relates to an image tilt angle correction method, device, equipment, storage medium and product. Background Technology

[0002] In machine vision, for images that are not in the correct orientation, i.e., images that are tilted, we usually try to correct them to the correct angle and viewpoint so that subsequent analysis and recognition can proceed smoothly.

[0003] Currently, most methods for correcting image tilt angles rely on edge detection. By extracting the image contour, the angular deviation is determined and the image is straightened. However, edge detection-based methods are difficult to implement when the image edges are unclear or no edges have been extracted, and the algorithms involved are complex and the processing is intricate. Summary of the Invention

[0004] This application provides an image tilt angle correction method, apparatus, device, and computer storage medium, which can achieve angle correction of the image to be detected without relying on edge detection.

[0005] In a first aspect, embodiments of this application provide an image tilt angle correction method, the method comprising:

[0006] Obtain multiple first target detection boxes in the image to be corrected. The first target detection boxes are obtained by performing target detection on the image to be corrected.

[0007] The tilt angle of each of the multiple first target detection boxes relative to the first coordinate axis of the preset coordinate system is determined to obtain a set of tilt angles;

[0008] Perform closed-loop clustering on the tilt angles in the tilt angle set to obtain multiple angle subsets;

[0009] The target angle subset is obtained by selecting the angle subset with the largest number of elements from multiple angle subsets.

[0010] The angles in the target angle subset that are less than a preset angle threshold are converted to obtain the target angle subset after angle conversion;

[0011] Based on the average tilt angle of the target angle subset after angle transformation, rotate the image to be corrected to obtain the target corrected image.

[0012] Secondly, embodiments of this application provide an image tilt angle correction device, the device comprising:

[0013] The acquisition module is used to acquire multiple first target detection boxes in the image to be corrected, wherein the first target detection boxes are obtained by performing target detection on the image to be corrected;

[0014] The determination module is used to determine the tilt angle of each of the multiple first target detection boxes relative to the first coordinate axis of the preset coordinate system in the preset coordinate system, so as to obtain a set of tilt angles;

[0015] The closed-loop clustering module is used to perform closed-loop clustering on the tilt angles in the tilt angle set to obtain multiple angle subsets.

[0016] The selection module is used to select the angle subset with the most elements from multiple angle subsets to obtain the target angle subset.

[0017] The angle conversion module is used to convert angles in the target angle subset that are less than a preset angle threshold to obtain the target angle subset after angle conversion.

[0018] The rotation module is used to rotate the image to be corrected based on the average tilt angle of the target angle subset after angle transformation, so as to obtain the target corrected image.

[0019] Thirdly, embodiments of this application provide an electronic device, which includes: a processor and a memory storing computer program instructions;

[0020] When the processor executes computer program instructions, it implements the steps of the image tilt angle correction method as described in any embodiment of the first aspect.

[0021] Fourthly, embodiments of this application provide a computer storage medium storing computer program instructions, which, when executed by a processor, implement the steps of the image tilt angle correction method as described in any embodiment of the first aspect.

[0022] Fifthly, embodiments of this application provide a computer program product in which, when the instructions in the computer program product are executed by the processor of an electronic device, the electronic device performs the steps of the image tilt angle correction method as described in any embodiment of the first aspect.

[0023] The image tilt angle correction method, apparatus, device, storage medium, and product of this application embodiment acquire multiple first target detection boxes in the image to be corrected, determine the tilt angle of each first target detection box relative to a first coordinate axis of the preset coordinate system, and obtain a tilt angle set. After processing the tilt angle set, a target angle subset is obtained, and the image to be corrected is rotated based on the average tilt angle of the target angle subset. Thus, this application embodiment achieves tilt image correction without using edge detection technology by clustering the tilt angles of multiple target detection boxes and then correcting the tilt angle of the image to be corrected based on the average angle of the angle subset with the most elements after clustering. This enables image tilt angle correction even when the image edges are unclear or have not been extracted. Attached Figure Description

[0024] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0025] Figure 1 This is a flowchart illustrating an image tilt angle correction method provided in an embodiment of this application;

[0026] Figure 2 This is a schematic diagram illustrating the specific implementation of step S110;

[0027] Figure 3 This is a flowchart illustrating another image tilt angle correction method provided in an embodiment of this application;

[0028] Figure 4 This is a flowchart illustrating the specific implementation method of step S220;

[0029] Figure 5 This is a flowchart illustrating the specific implementation method of step S130;

[0030] Figure 6 This is a flowchart illustrating another image tilt angle correction method provided in an embodiment of this application;

[0031] Figure 7 This is a flowchart illustrating another image tilt angle correction method provided in an embodiment of this application;

[0032] Figure 8 This is a schematic diagram of the structure of an image tilt angle correction device provided in an embodiment of this application;

[0033] Figure 9This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0034] The features and exemplary embodiments of various aspects of this application will be described in detail below. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain this application and not to limit it. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by illustrating examples.

[0035] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.

[0036] The acquisition, storage, use, and processing of data in this application all comply with the relevant provisions of national laws and regulations.

[0037] To address the problems existing in the background art, embodiments of this application provide an image tilt angle correction method, apparatus, device, and computer storage medium.

[0038] This application embodiment uses the tilt angle of multiple target detection boxes to cluster them, and then uses the average angle of the angle subset with the most elements after clustering to correct the tilt angle of the image to be corrected. This achieves the correction of tilted images without using edge detection technology, and enables the correction of image tilt angle even when the image edges are unclear or no edges are extracted.

[0039] The image tilt angle correction method provided in the embodiments of this application will be introduced first below.

[0040] Figure 1 A schematic flowchart of an image tilt angle correction method provided in an embodiment of this application is shown. Figure 1As shown, the image tilt angle correction method may specifically include the following steps:

[0041] S110. Obtain multiple first target detection boxes in the image to be corrected, wherein the first target detection boxes are obtained by performing target detection on the image to be corrected;

[0042] S120. Determine the tilt angle of each of the multiple first target detection boxes relative to the first coordinate axis of the preset coordinate system in the preset coordinate system, and obtain a set of tilt angles.

[0043] S130. Perform closed-loop clustering on the tilt angles in the tilt angle set to obtain multiple angle subsets;

[0044] S140. Select the angle subset with the largest number of elements from multiple angle subsets to obtain the target angle subset;

[0045] S150. Convert the angles in the target angle subset that are less than the preset angle threshold to obtain the target angle subset after angle conversion.

[0046] S160. Based on the average tilt angle of the target angle subset after angle transformation, rotate the image to be corrected to obtain the target corrected image.

[0047] Therefore, by acquiring multiple first target detection boxes in the image to be corrected, the tilt angle of each first target detection box relative to the first coordinate axis of the preset coordinate system is determined, resulting in a set of tilt angles. After processing the set of tilt angles, a subset of target angles is obtained, and the image to be corrected is rotated based on the average tilt angle of the target angle subset. Thus, this embodiment of the application achieves tilt angle correction without using edge detection technology by clustering the tilt angles of multiple target detection boxes and then correcting the tilt angle of the image to be corrected based on the average angle of the subset of angles with the most elements after clustering. This enables tilt angle correction even when image edges are unclear or have not been extracted.

[0048] The specific implementation methods for each of the above steps are described below.

[0049] In some embodiments, in S110, target detection can be performed on the image to be corrected using a target detection model to obtain multiple first target detection boxes. For example... Figure 2 As shown, assuming the object detection model is a text object detection model, taking an ID card as an example, the object detection model outputs the coordinates of the four vertices of multiple first object detection boxes. The position of each first object detection box is determined based on these vertex coordinates, resulting in the following... Figure 2 The multiple first target detection boxes shown.

[0050] In some embodiments, in S120, a preset coordinate system is set, and the tilt angles of the multiple first target detection boxes obtained above relative to the first coordinate axis of the preset coordinate system are determined respectively. The first coordinate axis can be either the X-axis or the Y-axis; here, the X-axis is used as the first coordinate axis. Based on the coordinates of the four vertices of each first target detection box obtained from the target detection model, the long side or short side of each first target detection box is determined. Taking the long side as an example, the angle between the X-axis and the long side of the first target detection box is defined as the tilt angle, which ranges from 0 to 180 degrees. The tilt angle of each first target detection box is determined in this way, resulting in a set of tilt angles.

[0051] As an example, the angle between the long side of each first target detection box and the X-axis is determined to obtain multiple tilt angles. The set of tilt angles consisting of multiple tilt angles is {0, 1, 2, 87, 89, 90, 90, 92, 93, 169, 169, 172, 172, 173, 174, 175, 175, 177, 179}.

[0052] In some embodiments, in S130, closed-loop clustering is performed on the tilt angles in the tilt angle set. Closed-loop clustering means that 0 degrees is defined as 179 degrees to the left and 1 degree to the right, and 0 degrees and 180 degrees are connected end to end to form a closed loop. Then, an angle neighborhood value is set to cluster the tilt angle set. Angles whose differences between any two angles in the tilt angle set are within the range of the angle neighborhood value are grouped into one category. The tilt angle set is divided to obtain multiple angle subsets.

[0053] As an example, to improve the efficiency of closed-loop clustering, such as Figure 5 As shown, the above S130 may include the following steps:

[0054] S131. Set the angle neighborhood value according to the characteristics of the image to be corrected;

[0055] S132. If the difference between any two angles in the set of tilt angles is within the angle neighborhood, the angles within the angle difference will be classified into one category, and the set of tilt angles will be divided to obtain multiple angle subsets.

[0056] The features of the image to be corrected include its size, type, and shape. The angle neighborhood value is a specific angle value, which can be determined based on the features of the image to be corrected and the actual business requirements. For example, if the angle neighborhood value is set to 2 degrees, the angles in the tilt angle set {0, 1, 2, 87, 89, 90, 90, 92, 93, 169, 169, 172, 172, 173, 174, 175, 175, 177, 179} are compared pairwise. If the angle difference is within the set angle neighborhood value of 2 degrees, the two angles are classified into the same category. According to the above definition, 0 degrees and 180 degrees form a closed loop when connected end to end. Therefore, 0 degrees and 179 degrees, 2 degrees and 177 degrees, etc., are all within the range of the angle neighborhood value of 2 degrees. Thus, after closed loop clustering, the set of tilt angles is divided into multiple angle subsets, namely: {0, 1, 2, 169, 169, 172, 172, 173, 174, 175, 175, 177, 179}, {87, 89, 90, 90, 92, 93}.

[0057] In some embodiments, in S140, the angle subset with the largest number of elements is selected from the multiple angle subsets obtained above as the target angle subset.

[0058] As an example, considering the multiple angle subsets obtained above, set A{0, 1, 2, 169, 169, 172, 172, 173, 174, 175, 175, 177, 179} has 13 angle elements, and set B{87, 89, 90, 90, 92, 93} has 6 angle elements. Therefore, the angle subset A{0, 1, 2, 169, 169, 172, 172, 173, 174, 175, 175, 177, 179} with the larger number of elements is selected as the target angle subset.

[0059] In some embodiments, in S150, a preset angle threshold is set. If the angle in the target angle subset is less than the preset angle threshold, the target angle is added to the angle to perform angle conversion. If the angle in the target angle subset is greater than the preset angle threshold, no angle conversion is performed.

[0060] The preset angle threshold is a criterion used to determine whether angles in the target angle subset need to be converted. Here, the preset angle threshold is set to 90 degrees. If an angle in the target angle subset is less than 90 degrees, angle conversion is performed; if an angle in the target angle subset is greater than 90 degrees, the angle value remains unchanged, and no angle conversion is performed. Setting 90 degrees as the preset angle threshold and adding 180 degrees to angles in the target angle subset that are less than 90 degrees before conversion expands the original small angle value, resulting in a more accurate average tilt angle and reducing calculation errors.

[0061] As an example, the resulting target angle subset is {0, 1, 2, 169, 169, 172, 172, 173, 174, 175, 175, 177, 179}. The angles less than 90 degrees in this subset, i.e., 0 degrees, 1 degree, and 2 degrees, are converted by adding 180 degrees to their original values, resulting in the target angle subset {180, 181, 182, 169, 169, 172, 172, 173, 174, 175, 175, 177, 179}.

[0062] In some embodiments, in S160, the image to be corrected is rotated according to the average tilt angle of the target angle subset after the angle transformation. Since the X-axis has been selected as the first coordinate axis, in order to ensure that the image to be corrected is in a horizontal state after rotation, the image to be corrected is rotated clockwise according to the average tilt angle.

[0063] As an example, the target angle subset after angle transformation is {180, 181, 182, 169, 169, 172, 172, 173, 174, 175, 175, 177, 179}. The average tilt angle of this target angle subset after angle transformation is 175 degrees. Then, the image to be corrected is rotated 175 degrees clockwise to obtain the target corrected image.

[0064] Therefore, by processing the set of angles to obtain the average value of the tilt angle, the image to be corrected is rotated using this average value, and the originally tilted image is corrected to a horizontal position, thus obtaining the target corrected image and realizing the correction of the image tilt angle.

[0065] Some images may contain dust or stains, and the detection boxes corresponding to these interference items are usually not rectangles, but may be squares. Therefore, in order to eliminate interference, this application also provides another embodiment of the image tilt angle correction method.

[0066] like Figure 3 As shown, after obtaining multiple first target detection boxes in the image to be corrected, the method may further include the following steps:

[0067] S310. From multiple first target detection boxes, filter out detection boxes with rectangular target detection box shapes to obtain multiple second target detection boxes;

[0068] S320. Determine the tilt angle of each of the multiple second target detection boxes relative to the first coordinate axis of the preset coordinate system in the preset coordinate system.

[0069] As an example, to easily obtain the tilt angle, such as Figure 4As shown, the above S320 also includes the following steps:

[0070] S321. Obtain the coordinates of the four vertices of the second target detection box;

[0071] S322. Determine the first side of the second target detection box based on the coordinates of the four vertices;

[0072] S323. Determine the tilt angle of the first side relative to the first coordinate axis of the preset coordinate system.

[0073] For example, the coordinates of the four vertices of the second target detection box are obtained from the target detection model, the long side of the second target detection box is determined based on the vertex coordinates, the long side of the second target detection box is taken as the first side, the X-axis is taken as the first coordinate axis of the preset coordinate system, and then the tilt angle of the long side of each second target detection box relative to the X-axis is determined.

[0074] Therefore, by filtering multiple first target detection boxes, square detection boxes caused by dust or stains are excluded, and rectangular first target detection boxes are retained, which not only eliminates interference but also improves the accuracy of the correction results.

[0075] Because images often contain noise that can be identified by object detection, based on experience, this noise is often identified as vertical or horizontal rectangles. Therefore, as... Figure 6 As shown, this application also provides another embodiment of the image tilt angle correction method. After obtaining the target angle subset, it is determined whether the angles in the target angle subset meet the preset conditions. Based on the actual situation, the angles are excluded and reselected to obtain a more accurate target angle subset, making the image correction result more accurate.

[0076] Figure 6 This is a flowchart illustrating another image tilt angle correction method provided in an embodiment of this application. Figure 6 As shown, after selecting the angle subset with the largest number of elements from multiple angle subsets to obtain the target angle subset, the following steps are also included:

[0077] S610. Determine whether the angles in the target angle subset meet the preset conditions;

[0078] S620. Under the condition of satisfying the preset conditions, the angles in the target angle subset that are less than the preset angle threshold are converted to obtain the target angle subset after angle conversion.

[0079] S630. If the preset conditions are not met, remove the target angle subset from multiple angle subsets to obtain the updated angle subset.

[0080] If the obtained target angle subset does not meet the preset conditions, return to the previous step and select the angle subset with the most elements from multiple angle subsets to obtain the target angle subset, until the angles in the target angle subset meet the preset conditions.

[0081] As an example, in S610, the preset conditions include the following two items:

[0082] The number of elements in the target angle subset is greater than the total number of elements in the tilt angle subset of the first preset ratio;

[0083] The proportion of elements in the target angle subset whose angle value is a preset angle is less than the second preset proportion.

[0084] Here, both the first and second preset ratios are set to 50%. It should be noted that the setting of the first and second preset ratios in this embodiment is not limited to this and can be set according to actual needs.

[0085] For example, for a target angle subset, it can be set that if 50% of the set contains 90 degrees or 0 degrees, and the total number of elements in the set is less than 50% of all elements, then this target angle subset is discarded, and the next set is selected for angle transformation again. For example, suppose there are 20 angles in total, and the target angle subset obtained after closed-loop clustering is {90, 90, 90, 89}. Since 90 degrees account for more than half, and the number of elements in the set is 4, which is less than half of 20, the current set is discarded, and the next set is rotated as the target angle subset.

[0086] In the closed-loop clustering process, there are other angles that exceed the neighborhood setting and are not classified into the same class. As a result, the set of interference classes is used as the target angle set. Therefore, after obtaining the target angle subset after angle transformation, it is determined whether the angles in the target angle subset meet the preset conditions. Based on the judgment result, corresponding measures are taken to obtain a more accurate target angle subset, which not only eliminates interference but also greatly reduces the calculation error.

[0087] The image to be corrected is rotated to a horizontal position based on the average tilt angle of the target angle subset. However, since it is impossible to determine whether the image to be corrected was originally upside down or obtained as a mirror image, ... Figure 7 As shown, this application also provides another embodiment of the image tilt angle correction method, which determines whether the target corrected image needs to be inverted or mirrored after obtaining the target corrected image by a classification model.

[0088] Figure 7 This is a schematic flowchart of another image tilt angle correction method provided in an embodiment of this application. As an example, such as... Figure 7 As shown, S160 may also include:

[0089] S710. Input the target correction image into the classification model, and determine whether the target correction image needs to be inverted or mirrored through the classification model;

[0090] S720. If it is determined that the target correction image needs to be inverted or mirrored, the target correction image is inverted or mirrored to obtain the final correction image.

[0091] Therefore, when it is uncertain whether the target image to be corrected is inverted or mirrored, a classification model is trained and adjusted to determine whether the target image to be corrected needs to be inverted or mirrored, so as to make the correction result more accurate.

[0092] It should be noted that the application scenarios described in the above embodiments of this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. Those skilled in the art will understand that with the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.

[0093] Based on the same inventive concept, this application also provides an image tilt angle correction device, specifically combined with... Figure 8 Please provide a detailed explanation.

[0094] Figure 8 A schematic diagram of the structure of an image tilt angle correction device provided in an embodiment of this application is shown.

[0095] like Figure 8 As shown, the image tilt angle correction device 800 may include:

[0096] The acquisition module 810 is used to acquire multiple first target detection boxes in the image to be corrected;

[0097] The determining module 820 is used to determine the tilt angle of each of the multiple first target detection boxes relative to the first coordinate axis of the preset coordinate system in the preset coordinate system, so as to obtain a set of tilt angles;

[0098] The closed-loop clustering module 830 is used to perform closed-loop clustering on the tilt angles in the tilt angle set to obtain multiple angle subsets.

[0099] Module 840 is used to select the angle subset with the most elements from multiple angle subsets to obtain the target angle subset.

[0100] Angle conversion module 850 is used to convert angles in the target angle subset that are less than a preset angle threshold to obtain the target angle subset after angle conversion.

[0101] The rotation module 860 is used to rotate the image to be corrected based on the average tilt angle of the target angle subset after angle conversion, so as to obtain the target corrected image.

[0102] The image tilt angle correction device 800 described above will be explained in detail below:

[0103] In some embodiments, in order to accurately obtain the tilt angle of each second target detection box relative to the first coordinate axis, the determination module 820 may include the following units:

[0104] The filtering unit is used to filter out rectangular target detection boxes from multiple first target detection boxes to obtain multiple second target detection boxes;

[0105] The first acquisition unit is used to acquire the coordinates of the four vertices of the second target detection box;

[0106] The first determining unit is used to determine the first side of the second target detection box;

[0107] The second determining unit is used to determine the tilt angle of the first side relative to the first coordinate axis of the preset coordinate system.

[0108] In some embodiments, to improve the efficiency of closed-loop clustering, the closed-loop clustering module 830 may include the following units:

[0109] The setting unit is used to set the angle neighborhood value according to the features of the image to be corrected;

[0110] The partitioning unit is used to group angles within the same neighborhood value if the difference between any two angles in the tilt angle set is within the neighborhood value, thus dividing the tilt angle set into multiple angle subsets.

[0111] In some embodiments, to reduce errors and obtain a more accurate average tilt angle, the angle conversion module 850 may include the following units:

[0112] The judgment unit is used to determine whether the angles in the target angle subset meet the preset conditions.

[0113] The first angle conversion unit is used to convert the angles in the target angle subset that are less than the preset angle threshold under the condition that the preset conditions are met, so as to obtain the target angle subset after angle conversion.

[0114] The removal unit is used to remove the target angle subset from multiple angle subsets when the preset conditions are not met, so as to obtain the updated angle subset;

[0115] Setting unit, used to set preset angle threshold;

[0116] The second angle conversion unit is used to perform angle conversion by adding the target angle to the angle if the angle in the target angle subset is less than a preset angle threshold, and not to perform angle conversion if the angle in the target angle subset is greater than the preset angle threshold.

[0117] In some embodiments, in order to obtain a positive target correction image, the image tilt angle correction device 800 may further include the following units:

[0118] The classification unit is used to input the target corrected image into the classification model, and the classification model determines whether the target corrected image needs to be inverted or mirrored.

[0119] The inverted mirror unit is used to invert or mirror the target corrected image when it is determined that the target corrected image needs to be inverted or mirrored, so as to obtain the final corrected image.

[0120] Figure 9 A schematic diagram of the structure of an electronic device provided in an embodiment of this application is shown.

[0121] The electronic device 900 may include a processor 920 and a memory 930 storing computer program instructions.

[0122] Specifically, the processor 920 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.

[0123] Memory 930 may include mass storage for data or instructions. For example, and not limitingly, memory 930 may include a hard disk drive (HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 930 may include removable or non-removable (or fixed) media. Where appropriate, memory 930 may be internal or external to the integrated gateway disaster recovery device. In a particular embodiment, memory 930 is non-volatile solid-state memory.

[0124] In a particular embodiment, memory 930 includes read-only memory (ROM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM), or flash memory, or a combination of two or more of these.

[0125] Memory 930 may include read-only memory (ROM), random access memory (RAM), disk storage media device, optical storage media device, flash memory device, electrical, optical, or other physical / tangible memory storage device. Therefore, typically, memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the image tilt angle correction method according to the first aspect of this application.

[0126] The processor 920 reads and executes computer program instructions stored in the memory 930 to implement any of the image tilt angle correction methods in the above embodiments.

[0127] In one example, electronic device 900 may further include communication interface 940 and bus 910. For example, Figure 9 As shown, the processor 920, memory 930, and communication interface 940 are connected via bus 910 and communicate with each other.

[0128] The communication interface 940 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of this application.

[0129] Bus 910 includes hardware, software, or both, that couples components of an image tilt angle correction device together. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Microchannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, bus 910 may include one or more buses. Although specific buses are described and illustrated in embodiments of this application, any suitable bus or interconnect is contemplated herein.

[0130] The electronic device 900 can execute the image tilt angle correction method in the embodiments of this application, thereby achieving the combination of Figure 1 and Figure 8 The image tilt angle correction method and apparatus are described.

[0131] Furthermore, in conjunction with the image tilt angle correction methods in the above embodiments, this application embodiment can provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when these computer program instructions are executed by a processor, they implement any of the image tilt angle correction methods in the above embodiments.

[0132] It should be clarified that this application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of this application is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of this application.

[0133] The functional blocks shown in the above-described structural diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried on a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.

[0134] It should also be noted that the exemplary embodiments mentioned in this application describe methods or systems based on a series of steps or apparatus. However, this application is not limited to the order of the above steps; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.

[0135] The aspects of this disclosure have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by special-purpose hardware performing the specified functions or actions, or can be implemented by a combination of special-purpose hardware and computer instructions.

[0136] The above description is merely a specific implementation of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the protection scope of this application.

Claims

1. A method for correcting image tilt angle, characterized in that, include: Multiple first target detection boxes are obtained in the image to be corrected. The first target detection boxes are obtained by performing target detection on the image to be corrected through a target detection model. The target detection model outputs the coordinates of the four vertices of the multiple first target detection boxes. The position of each first target detection box is determined based on the vertex coordinates. The tilt angle of each of the plurality of first target detection boxes relative to the first coordinate axis of the preset coordinate system is determined to obtain a set of tilt angles; Perform closed-loop clustering on the tilt angles in the tilt angle set to obtain multiple angle subsets; The target angle subset is obtained by selecting the angle subset with the largest number of elements from the plurality of angle subsets. The angles in the target angle subset that are less than a preset angle threshold are converted to obtain the target angle subset after angle conversion. Based on the average tilt angle of the target angle subset after angle transformation, the image to be corrected is rotated to obtain the target corrected image.

2. The method according to claim 1, characterized in that, Before determining the tilt angle of each of the plurality of first target detection boxes relative to a first coordinate axis of the preset coordinate system, the method further includes: From the plurality of first target detection boxes, detection boxes with rectangular target detection box shapes are selected to obtain a plurality of second target detection boxes; Determining the tilt angle of each of the plurality of first target detection boxes relative to a first coordinate axis of the preset coordinate system includes: The tilt angle of each of the plurality of second target detection boxes relative to the first coordinate axis of the preset coordinate system is determined.

3. The method according to claim 2, characterized in that, Determining the tilt angle of each of the plurality of second target detection boxes relative to the first coordinate axis of the preset coordinate system includes: For each of the second target detection boxes, execute the following: Obtain the coordinates of the four vertices of the second target detection box; Based on the coordinates of the four vertices, the first side of the second target detection box is determined, and the first side is either the long side or the short side of the second target detection box. Determine the tilt angle of the first side relative to the first coordinate axis of the preset coordinate system.

4. The method according to claim 1, characterized in that, The step of performing closed-loop clustering on the tilt angles in the tilt angle set yields multiple angle subsets, including: Based on the features of the image to be corrected, set the angle neighborhood value; If the difference between any two angles in the set of tilt angles is within the neighborhood of the angle, the angles within the difference are grouped into one category, and the set of tilt angles is divided to obtain multiple angle subsets.

5. The method according to any one of claims 1-4, characterized in that, The step of converting angles in the target angle subset that are less than a preset angle threshold to obtain a converted target angle subset includes: Set a preset angle threshold; If the angle in the target angle subset is less than the preset angle threshold, the target angle is added to the target angle to perform angle conversion; if the angle in the target angle subset is greater than the preset angle threshold, no angle conversion is performed.

6. The method according to any one of claims 1-4, characterized in that, Before performing angle transformation on the angles in the target angle subset that are less than a preset angle threshold to obtain the transformed target angle subset, the method further includes: Determine whether the angles in the target angle subset meet the preset conditions; The step of converting angles in the target angle subset that are less than a preset angle threshold to obtain a converted target angle subset includes: Under the condition that the preset conditions are met, the angles in the target angle subset that are less than the preset angle threshold are converted to obtain the target angle subset after angle conversion. The preset conditions include the following two items: The number of elements in the target angle subset is greater than the total number of elements in the tilt angle set by a first preset ratio; The proportion of elements in the target angle subset whose angle value is a preset angle is less than the second preset proportion.

7. The method according to claim 6, characterized in that, The method further includes: If the preset conditions are not met, the target angle subset is removed from the plurality of angle subsets to obtain an updated angle subset; Return to the previous step of selecting the angle subset with the largest number of elements from the multiple angle subsets to obtain the target angle subset, until the angles in the target angle subset meet the preset conditions.

8. The method according to any one of claims 1-4, characterized in that, After obtaining the target corrected image, the method further includes: The target corrected image is input into a classification model, and the classification model determines whether the target corrected image needs to be inverted or mirrored. If it is determined that the target correction image needs to be inverted or mirrored, the target correction image is inverted or mirrored to obtain the final correction image.

9. An image tilt angle correction device, characterized in that, The device includes: The acquisition module is used to acquire multiple first target detection boxes in the image to be corrected. The first target detection boxes are obtained by performing target detection on the image to be corrected through a target detection model. The target detection model outputs the coordinates of the four vertices of the multiple first target detection boxes, and the position of each first target detection box is determined based on the vertex coordinates. The determining module is used to determine the tilt angle of each of the plurality of first target detection boxes relative to the first coordinate axis of the preset coordinate system in the preset coordinate system, thereby obtaining a set of tilt angles; The closed-loop clustering module is used to perform closed-loop clustering on the tilt angles in the tilt angle set to obtain multiple angle subsets. The selection module is used to select the angle subset with the largest number of elements from the plurality of angle subsets to obtain the target angle subset. An angle conversion module is used to convert the angles in the target angle subset that are less than a preset angle threshold to obtain the target angle subset after angle conversion. The rotation module is used to rotate the image to be corrected based on the average tilt angle of the target angle subset after angle conversion, so as to obtain the target corrected image.

10. An electronic device, characterized in that, The electronic device includes: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, it implements the image tilt angle correction method as described in any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer program instructions that, when executed by a processor, implement the image tilt angle correction method as described in any one of claims 1 to 8.

12. A computer program product, characterized in that, When the instructions in the computer program product are executed by the processor of the electronic device, the electronic device performs the image tilt angle correction method as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Inclination correction device for document image

    JP2014230119A