Image correction method, device, camera and storage medium

By screening and correcting qualified images, using multi-focus evaluation and similarity judgment, combined with Hough line detection and target detection, the problem of long correction time for continuous images is solved, and the image correction efficiency and clarity are improved.

CN115170419BActive Publication Date: 2025-09-12SHENZHEN CHUANGAN SHIXUN TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210783648.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-05
Publication Date
2025-09-12
Estimated Expiration
2042-07-05

AI Technical Summary

Technical Problem

In the prior art, continuous image correction requires processing a large number of unclear images, resulting in a long correction time and high difficulty.

Method used

By obtaining the focus evaluation of the initial image, qualified images are screened out and corrected. Multiple focus evaluation algorithms and similarity judgments are used to reduce the number of images to be corrected. Accurate correction is performed by combining Hough line detection and target detection.

Benefits of technology

It effectively reduces the number and time of corrected images, improves the clarity and accuracy of corrected images, and simplifies user waiting time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115170419B_ABST
    Figure CN115170419B_ABST
Patent Text Reader

Abstract

This application relates to the field of image processing, and more particularly to an image correction method, device, camera, and storage medium. The method comprises, after triggering a correction instruction, acquiring at least one initial image and obtaining a focus evaluation for each initial image, where the focus evaluation is used to characterize the clarity of the corresponding initial image; then screening all initial images and retaining qualified images, where a qualified image is an initial image with a focus evaluation greater than or equal to a preset qualified threshold; and then correcting the qualified images to obtain a corrected image. This application reduces the waiting time for users when correcting images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing, and in particular to an image correction method, device, camera, and storage medium. Background Art

[0002] In real life, to capture dynamic objects, people often need to capture multiple images through continuous shooting, then filter out the clearest ones from the continuous images. However, due to the need to track the target during continuous shooting, the camera may be unstable, or the limited viewing angle may cause the captured image content to be tilted, requiring the photographer to rotate the photo to obtain a correct viewing angle.

[0003] Tilt photos need to be corrected. When correcting, people usually select all photos taken by the camera for correction. However, for some unclear photos, it is difficult to correct them, which means that users need to wait more time to get the corrected images. Summary of the Invention

[0004] In order to reduce the waiting time of users when correcting images, the present application provides an image correction method, device, camera and storage medium.

[0005] In a first aspect, the present application provides an image correction method, which adopts the following technical solution:

[0006] An image correction method, comprising:

[0007] After triggering the correction instruction, obtaining at least one initial image;

[0008] Obtaining a focus evaluation of each of the initial images, where the focus evaluation is used to represent the clarity of the corresponding initial image;

[0009] Screening all the initial images and retaining qualified images, wherein the qualified images are initial images whose focus evaluation is greater than or equal to a preset qualified threshold;

[0010] Correcting the qualified image to obtain a corrected image.

[0011] By adopting the above technical solution, after acquiring the initial images, the focus evaluation of each initial image is determined. All initial images are then screened using the focus evaluation and a preset pass threshold to obtain qualified images, i.e., relatively clear images. These qualified images are then corrected to obtain relatively clear corrected images. By screening the images before correction, the number of images requiring correction is reduced, and compared to related technologies, the time required for correction is shortened.

[0012] In a possible implementation, obtaining a focus evaluation of each of the initial images, for any of the initial images, includes:

[0013] Calculating any of the initial images based on N preset focusing evaluation algorithms to obtain N initial focusing evaluations corresponding to any of the initial images, where N is an integer greater than or equal to 2;

[0014] An average value of the N focus evaluations corresponding to any of the initial images is determined as the focus evaluation corresponding to any of the initial images.

[0015] By adopting the above technical solution, for any initial image, N focus evaluation algorithms are used to obtain N focus evaluation values, and then the average of these N focus evaluation values ​​is used as the focus evaluation corresponding to the image, thereby improving the reliability and accuracy of the focus evaluation.

[0016] In one possible implementation, the correcting the qualified image includes:

[0017] Obtaining the shooting time of each qualified image;

[0018] Determining the similarity between the qualified images taken at adjacent times;

[0019] If the similarity is greater than or equal to a preset similarity threshold, determining the image with a larger focus evaluation value between the two qualified images taken adjacently in time as the image to be corrected;

[0020] Correcting the image to be corrected.

[0021] By adopting the above technical solution, through similarity judgment, the image with a lower focus evaluation is screened out between two adjacent qualified images with higher similarity, that is, the image with higher clarity is retained as the image to be corrected, thereby further reducing the number of images to be corrected and thus reducing the correction time.

[0022] In a possible implementation, the correcting the image to be corrected includes, for each image to be corrected,:

[0023] Performing Hough line detection on the image to be corrected to determine all straight lines in the image to be corrected;

[0024] determining an inclination angle for each straight line and determining an average inclination angle based on all of the inclination angles;

[0025] The image to be corrected is corrected based on the average tilt angle.

[0026] By adopting the above technical solution, all straight lines in the image to be corrected are determined, and the inclination angle of each straight line is obtained. Then, the average inclination angle is determined as the angle to be corrected for the image to be corrected, and a corrected image can be obtained.

[0027] In a possible implementation, determining the average tilt angle based on all the tilt angles includes:

[0028] Performing target detection on the image to be corrected to determine a target area within the image to be corrected;

[0029] Screening all straight lines to determine a valid straight line, where the valid straight line is a straight line passing through the target area;

[0030] Based on all said valid straight lines, an average tilt angle is determined.

[0031] By adopting the above technical solution, straight lines that do not pass through the target area are filtered out, and only straight lines that pass through the target area are retained, which can further improve the reliability and accuracy of the obtained average tilt angle.

[0032] In one possible implementation, the method further includes:

[0033] Generating a preview image from each of the corrected images and the initial image corresponding to the corrected image;

[0034] The preview image also includes annotation information for the corrected image and the initial image.

[0035] By adopting the above technical solution, a preview image is generated for the initial image corresponding to the corrected image, and the corrected image and the initial image are distinguished by standard information, which is convenient for users to view intuitively.

[0036] In one possible implementation, it also includes:

[0037] Performing grayscale processing and binarization processing on any of the corrected images to obtain a preprocessed image;

[0038] Performing contour detection on the preprocessed image to determine the contour of the target in the preprocessed image;

[0039] Determining a minimum bounding rectangle of the contour;

[0040] Determining whether the angle between the side of the minimum circumscribed rectangle and the edge of the image is within a preset range;

[0041] If so, it is determined that the rectified image corresponding to the preprocessed image is a correct image.

[0042] By adopting the above technical solution, after obtaining the corrected image, each corrected image is verified by judging the inclination angle of the edge line of the minimum circumscribed rectangle of the target area in the corrected image. If it is within the preset range, it means that the correction is correct, that is, the image is correct.

[0043] In a second aspect, the present application provides an image correction device, which adopts the following technical solution:

[0044] An image correction device, comprising:

[0045] An initial image acquisition module, configured to acquire at least one initial image;

[0046] a focus evaluation acquisition module, configured to acquire a focus evaluation of each of the initial images, wherein the focus evaluation is used to characterize the clarity of the corresponding initial image;

[0047] a screening module, configured to screen all the initial images and retain qualified images, wherein the qualified images are initial images having a focus evaluation greater than or equal to a preset qualified threshold;

[0048] The correction module is used to correct the qualified image to obtain a corrected image.

[0049] By employing the above technical solution, after acquiring the initial images, the device determines the focus rating of each initial image. Using the focus rating and a preset pass threshold, all initial images are screened to obtain qualified images (i.e., relatively clear images). These qualified images are then corrected to obtain relatively clear corrected images. By screening the images before correction, the number of images requiring correction is reduced, and compared to related technologies, the time required for correction is shortened.

[0050] In a possible implementation, when the focus evaluation acquisition module acquires the focus evaluation of each of the initial images, for any of the initial images, it is specifically configured to:

[0051] Calculating any of the initial images based on N preset focusing evaluation algorithms to obtain N initial focusing evaluations corresponding to any of the initial images, where N is an integer greater than or equal to 2;

[0052] An average value of the N focus evaluations corresponding to any of the initial images is determined as the focus evaluation corresponding to any of the initial images.

[0053] In one possible implementation, when the correction module corrects the qualified image, it is specifically configured to:

[0054] Obtaining the shooting time of each qualified image;

[0055] Determining the similarity between the qualified images taken at adjacent times;

[0056] If the similarity is greater than or equal to a preset similarity threshold, determining the image with a larger focus evaluation value between the two qualified images taken adjacently in time as the image to be corrected;

[0057] Correcting the image to be corrected.

[0058] In one possible implementation, when the correction module corrects the image to be corrected, for each image to be corrected, the correction module is specifically configured to:

[0059] Performing Hough line detection on the image to be corrected to determine all straight lines in the image to be corrected;

[0060] determining an inclination angle for each straight line and determining an average inclination angle based on all of the inclination angles;

[0061] In one possible implementation, when the correction module determines the average tilt angle based on all the tilt angles, the correction module is specifically configured to:

[0062] Performing target detection on the image to be corrected to determine a target area within the image to be corrected;

[0063] Screening all straight lines to determine a valid straight line, where the valid straight line is a straight line passing through the target area;

[0064] Based on all said valid straight lines, an average tilt angle is determined.

[0065] In one possible implementation, the device further includes:

[0066] A preview image generating module, configured to generate a preview image from each of the corrected images and the initial image corresponding to the corrected image;

[0067] The preview image also includes annotation information for the corrected image and the initial image.

[0068] In one possible implementation, the device further includes:

[0069] A preprocessing module, configured to perform grayscale processing and binarization processing on any of the rectified images to obtain a preprocessed image;

[0070] A contour detection module, configured to perform contour detection on the preprocessed image to determine the contour of the target in the preprocessed image;

[0071] A bounding rectangle determining module, configured to determine the minimum bounding rectangle of the outline;

[0072] a determination module, configured to determine whether an angle between a side of the minimum circumscribed rectangle and an edge of the image is within a preset range;

[0073] The correct image determination module is used to determine that the rectified image corresponding to the pre-processed image is the correct image.

[0074] In a third aspect, the present application provides a camera that adopts the following technical solution:

[0075] A camera, the electronic device comprising:

[0076] at least one processor;

[0077] Memory;

[0078] At least one application, wherein the at least one application is stored in a memory and configured to be executed by at least one processor, and the at least one application is configured to: execute the above-mentioned image correction method.

[0079] In a fourth aspect, the present application provides a computer-readable storage medium, which adopts the following technical solution:

[0080] A computer-readable storage medium includes: a computer program that can be loaded by a processor and execute the above-mentioned image correction method.

[0081] In summary, this application includes at least one of the following beneficial technical effects:

[0082] 1. After acquiring the initial images, the focus evaluation of each initial image is determined. All initial images are screened using the focus evaluation and a preset qualified threshold to obtain qualified images, i.e., relatively clear images. These qualified images are then corrected to obtain relatively clear corrected images. By screening the images before correction, the number of images requiring correction is reduced, and compared to related technologies, the time required for correction is shortened.

[0083] 2. For any initial image, N focus evaluation algorithms are used to obtain N focus evaluation values, and the average of these N focus evaluation values ​​is used as the focus evaluation corresponding to the image, thereby improving the reliability and accuracy of the focus evaluation;

[0084] 3. By judging the similarity, the image with a lower focus score is filtered out between two adjacent qualified images with higher similarity. In other words, the image with higher clarity is retained as the image to be corrected, further reducing the number of images to be corrected and thus shortening the correction time. BRIEF DESCRIPTION OF THE DRAWINGS

[0085] Figure 11 is a flow chart of the image correction method in an embodiment of the present application;

[0086] Figure 2 is a schematic structural diagram of an image correction device in an embodiment of the present application;

[0087] Figure 3 It is a simplified structural diagram of the camera in the embodiment of the present application. DETAILED DESCRIPTION

[0088] The following is combined with Figure 1 -Attached Figure 3 This application is described in further detail.

[0089] After reading this specification, those skilled in the art may make non-creative modifications to this embodiment as needed, but such modifications are protected by patent law as long as they fall within the scope of the claims of this application.

[0090] To make the purpose, technical solutions, and advantages of the embodiments of this application more clear, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0091] In this document, the term "and / or" simply describes a relationship between related objects, indicating that three possible relationships exist. For example, "A and / or B" can represent: A exists alone, A and B exist simultaneously, or B exists alone. Furthermore, the character " / " in this document, unless otherwise specified, generally indicates an "or" relationship between the related objects.

[0092] The embodiment of the present application provides an image correction method, which is executed by a camera, referring to Figure 1 The method includes steps S101 to S104, wherein:

[0093] Step S101: After triggering a correction instruction, obtain at least one initial image.

[0094] In the embodiment of the present application, the triggering conditions for the correction instruction can be: when the camera enters continuous shooting mode, when the user inputs the correction instruction, or after capturing at least one photo. Furthermore, capturing at least one image can be capturing a local image or an image downloaded from the Internet. That is, the method in the embodiment of the present application can be executed by a processor installed inside the camera. After the camera captures the image, the processor corrects the captured initial image. Furthermore, the camera can also be provided with a data transmission module capable of data transmission with a server. The server is the executing body of the image correction method in the embodiment of the present application. The initial image captured by the camera is transmitted via the Internet and is captured by the server for correction.

[0095] Step S102 : Obtain a focus evaluation of each initial image, where the focus evaluation is used to represent the clarity of the corresponding initial image.

[0096] In the embodiments of the present application, the focus rating can be used to describe the degree of image cleanliness. A higher focus rating indicates a clearer image. During continuous shooting, unclear focus may occur, or the object's motion frequency may be greater than the shutter frequency, resulting in a blurred image.

[0097] Step S103: Screen all initial images and retain the images. Qualified images are initial images whose focus evaluation is greater than or equal to a preset qualified threshold.

[0098] In the embodiment of the present application, by screening all initial images based on the focus evaluation, a clearer initial image can be obtained, that is, an initial image with a focus evaluation greater than a qualified threshold; wherein, the specific value of the qualified threshold is not specifically limited in the embodiment of the present application, and the data of the relevant laboratory can be directly used, or it can be set by the user.

[0099] Step S104: Correct the qualified image to obtain a corrected image.

[0100] Correct qualified images so that the corrected images are clearer.

[0101] In the related art, when shooting continuously, all acquired images are corrected. However, relatively blurry images may be acquired during continuous shooting. For correcting blurred images, on the one hand, it is difficult to accurately identify the target, which makes it difficult and the correction time is too long. On the other hand, even if the image is corrected, it is a meaningless image, which will increase the waiting time of the user. The solution of the embodiment of the present application, after acquiring the initial image, determines the focus evaluation of each initial image, and screens all the initial images according to the focus evaluation and the preset qualified threshold to obtain qualified images, that is, relatively clear images. The qualified images are then corrected to obtain relatively clear corrected images. By screening the images before image correction, the number of images that need to be corrected is reduced, and compared with the related art, the time required for correction is reduced.

[0102] In step S102, there are multiple ways to obtain the focus evaluation of each initial image, such as through the sum of absolute grayscale differences (SMD) function, the energy gradient function (EOG), or the variance function. Furthermore, the scenes used for continuous shooting are diverse, such as scenes with large light contrasts or scenes with a lot of colors. To obtain a more accurate and reference-based focus evaluation, step S102 may include step S1021 (not shown) and step S1022 (not shown). Step S102 includes:

[0103] Step S1021: For any image, calculate any initial image based on N preset focusing evaluation algorithms to obtain N initial focusing evaluations corresponding to any initial image, where N is an integer greater than or equal to 2;

[0104] Step S1022: Determine the average value of N focus evaluations corresponding to any initial image as the focus evaluation corresponding to the initial image.

[0105] In this embodiment of the present application, N ≥ 2, which is a positive integer. This means that for each initial image, its focus evaluation is calculated using at least N preset focus evaluation algorithms, resulting in N focus evaluations for each initial image. These N focus evaluations are then averaged as the focus evaluation corresponding to the initial image. Because the scene at the time of capture cannot be determined, and therefore, a specific focus evaluation function cannot be used, steps S1021 and S1022 can reduce the effect of the capture scene on the focus evaluation, thereby facilitating a more accurate focus evaluation.

[0106] Furthermore, during continuous shooting, the similarity between adjacent images may be high. To further reduce the number of images that require correction, and thereby shorten the correction time, step S104 may include steps S1041 (not shown) to S1044 (not shown), wherein:

[0107] Step S1041: Obtain the shooting time of each qualified image;

[0108] Step S1042: Determine the similarity between qualified images with adjacent shooting times.

[0109] Specifically, the information of each initial image should include the shooting time, and the initial images should be sorted in chronological order. At the same time, the similarity of any two adjacent images is obtained. The similarity acquisition function can be arbitrarily selected, and this is not specifically limited in the embodiments of the present application.

[0110] Step S1043: If the similarity is greater than or equal to a preset similarity threshold, the image with the larger focus evaluation value between the two qualified images taken adjacently in time is determined as the image to be corrected;

[0111] Step S1044: correct the image to be corrected.

[0112] Specifically, the similarity threshold can be set to 85% or 90%, which is not specifically limited in the embodiments of the present application. For two adjacent images whose similarity does not exceed the similarity threshold, both are retained as images to be corrected; for two adjacent images that exceed the similarity threshold, the image with the higher focus evaluation is selected and retained as the image to be corrected. For example, there are three qualified images in the order of 1, 2, and 3, and the similarity between 1 and 2 exceeds the similarity threshold, and the focus evaluation of 1 is greater than the focus evaluation of 2; the similarity between 2 and 3 also exceeds the similarity threshold, and the focus evaluation of 2 is less than the focus evaluation of 3, then image 1 and image 3 are retained as images to be corrected.

[0113] By screening similar images and eliminating images with lower focus evaluations among similar images, the number of images to be corrected can be further reduced, thus shortening the time for image correction.

[0114] Furthermore, step S1044 may include step SA (not shown in the figure) to step SC (not shown in the figure), wherein:

[0115] Step SA: perform Hough line detection on the image to be corrected to determine all straight lines in the image to be corrected.

[0116] Specifically, the Hough transform is one of the fundamental methods used in image processing to identify geometric shapes and is a method for finding straight lines. Before performing post-Hough line detection on the image to be corrected, the image must first be grayscaled and binarized to create a preprocessed image. Edge detection is then performed on this preprocessed image. Hough line detection can identify all straight lines in the preprocessed image.

[0117] Step SB: determine the inclination angle of each straight line, and determine the average inclination angle based on all the inclination angles.

[0118] Specifically, the inclination angle of each straight line is calculated, and then the inclination angles of all straight lines are averaged to obtain the inclination angle of the target in the preprocessed image, that is, the inclination angle of the preprocessed image.

[0119] Step SC: correct the image to be corrected based on the average tilt angle.

[0120] After obtaining the tilt angle of the pre-processed image, that is, the average tilt angle, the corresponding image to be corrected is corrected based on the average tilt angle to obtain a corrected image.

[0121] Furthermore, step SB may include step SB1 (not shown in the figure) to step SB3 (not shown in the figure), wherein:

[0122] Step SB1: Perform target detection on the image to be corrected to determine the target area in the image to be corrected.

[0123] Target detection is performed on the image to be corrected to obtain the target area in the image to be corrected. The target type can be selected by the user. For example, if the user selects the target type as human, the area corresponding to the human target is obtained as the target area during target detection. If the user does not select, all target types in the image to be corrected are obtained.

[0124] Step SB2: Screen all straight lines to determine valid straight lines, where valid straight lines are straight lines passing through the target area.

[0125] Specifically, in step SA, some of the multiple straight lines obtained by Hough line detection pass through the target area, while some do not. Therefore, the straight lines passing through the target area are more valuable and can better describe the inclination degree of the target. Therefore, in order to obtain a more accurate inclination angle, it is necessary to screen out the straight lines that do not pass through the target area, that is, to retain the valid straight lines.

[0126] Step SB3: Determine the average tilt angle based on all valid straight lines.

[0127] The average tilt angle of all valid straight lines is calculated to obtain the average tilt angle, which is the tilt angle corresponding to the image to be corrected.

[0128] Furthermore, after step SC, the corrected image is output to be displayed to the user. Thus, an image correction method further includes step SN (not shown in the figure) and step SM (not shown in the figure), wherein:

[0129] Step SN, generating a preview image from each corrected image and the initial image corresponding to the corrected image;

[0130] In step SN, the preview image also includes annotation information of the corrected image and the initial image.

[0131] When outputting the corrected image, the corresponding image to be corrected must be displayed on the same page. This means that the corrected image and the corresponding image to be corrected are scaled and then spliced ​​together to create a preview image, allowing the user to easily determine the correction effect. The preview image also includes annotation information. The specific content of this annotation information is not specifically limited in this embodiment of the application; it is sufficient for the user to easily distinguish between the image to be corrected and the corrected image.

[0132] After step SC, the corrected image needs to be verified to determine whether it is accurate. In an embodiment of the present application, an image correction method further includes steps SD (not shown in the figure) and SH (not shown in the figure), wherein:

[0133] Step SD, performing grayscale processing and binarization processing on any corrected image to obtain a preprocessed image;

[0134] Step SE: perform contour detection on the preprocessed image to determine the contour of the target in the preprocessed image.

[0135] Specifically, each corrected image is preprocessed, that is, grayscale processing is first performed and then binarization is performed to obtain a preprocessed image; contour detection is performed on the preprocessed image to obtain the target area in the preprocessed image.

[0136] Step SF, determining the minimum circumscribed rectangle of the contour;

[0137] Step SG: determining whether the angle between the side of the minimum circumscribed rectangle and the edge of the image is within a preset range;

[0138] Step SG: If yes, determine that the rectified image corresponding to the pre-processed image is the correct image.

[0139] Specifically, a preset algorithm is used to determine the minimum bounding rectangle (MBR) of the target's outline. A rectangular coordinate system is then established in the preprocessed image, and the included angles of the four sides of the MRB in that coordinate system are determined. The algorithm then determines whether the tilt angle is 0 or 90 degrees, or is within a preset range (the range allowed is within 10 degrees). For example, if the tilt angles of two adjacent sides are 95 and 180 degrees, respectively, this indicates that they are within the permissible deviation range, indicating that the corrected image corresponding to the preprocessed image is correct.

[0140] The above embodiment introduces an image correction method from the perspective of method flow, and the following embodiment introduces an image correction device from the perspective of a virtual module or a virtual unit. Please refer to the following embodiment for details.

[0141] The present application provides an image correction device, such as Figure 2 As shown, the image correction device 200 may specifically include an initial image acquisition module 201, a focus evaluation acquisition module 202, a screening module 203, and a correction module 204, wherein:

[0142] An initial image acquisition module 201 is used to acquire at least one initial image;

[0143] A focus evaluation acquisition module 202 is used to acquire a focus evaluation of each initial image, where the focus evaluation is used to represent the clarity of the corresponding initial image;

[0144] A screening module 203 is used to screen all initial images and retain qualified images, where qualified images are initial images having a focus evaluation greater than or equal to a preset qualified threshold;

[0145] The correction module 204 is used to correct the qualified image to obtain a corrected image.

[0146] In a possible implementation, when the focus evaluation acquisition module 202 acquires the focus evaluation of each initial image, for any initial image, it is specifically configured to:

[0147] Calculating any initial image based on N preset focusing evaluation algorithms to obtain N initial focusing evaluations corresponding to any initial image, where N is an integer greater than or equal to 2;

[0148] An average value of N focus evaluations corresponding to any initial image is determined as the focus evaluation corresponding to any initial image.

[0149] In one possible implementation, when the correction module 204 corrects the qualified image, it is specifically configured to:

[0150] Obtain the shooting time of each qualified image;

[0151] Determining the similarity between qualified images taken adjacently in time;

[0152] If the similarity is greater than or equal to a preset similarity threshold, the image with a larger focus evaluation value between the two qualified images with adjacent shooting times is determined to be the image to be corrected;

[0153] Correct the image to be corrected.

[0154] In one possible implementation, when the correction module 204 corrects the image to be corrected, for each image to be corrected, it is specifically configured to:

[0155] Perform Hough line detection on the image to be corrected to determine all the straight lines in the image to be corrected;

[0156] determining the inclination angle of each line and determining an average inclination angle based on all inclination angles;

[0157] In one possible implementation, when the correction module 204 determines the average tilt angle based on all tilt angles, the correction module 204 is specifically configured to:

[0158] Perform target detection on the image to be corrected to determine the target area within the image to be corrected;

[0159] Screen all straight lines and determine valid straight lines, which are straight lines passing through the target area;

[0160] Based on all valid straight lines, determine the average tilt angle.

[0161] In one possible implementation, the image correction device 200 further includes:

[0162] A preview image generation module, configured to generate a preview image from each corrected image and the initial image corresponding to the corrected image;

[0163] The preview image also includes annotation information for the rectified image and the original image.

[0164] In one possible implementation, the image correction device 200 further includes:

[0165] A preprocessing module is used to perform grayscale processing and binarization processing on any corrected image to obtain a preprocessed image;

[0166] A contour detection module is used to perform contour detection on the preprocessed image and determine the contour of the target in the preprocessed image;

[0167] A bounding rectangle determination module is used to determine the minimum bounding rectangle of the contour;

[0168] A determination module, configured to determine whether an angle between a side of a minimum circumscribed rectangle and an edge of the image is within a preset range;

[0169] The correct image determination module is used to determine that the rectified image corresponding to the preprocessed image is the correct image.

[0170] In an embodiment of the present application, a camera is provided, such as Figure 3 As shown, Figure 3 The illustrated camera 300 includes a processor 301 and a memory 303. The processor 301 and the memory 303 are connected, for example, via a bus 302. Optionally, the electronic device 300 may further include a transceiver 304. It should be noted that in practice, the number of transceivers 304 is not limited to one, and the structure of the electronic device 300 does not constitute a limitation on the embodiments of this application.

[0171] Processor 301 can be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic device, transistor logic device, hardware component, or any combination thereof. It can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 301 can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.

[0172] Bus 302 may include a path for transmitting information between the above components. Bus 302 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. Bus 302 may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, Figure 3 Only one thick line is used in the diagram, but this does not mean that there is only one bus or one type of bus.

[0173] The memory 303 may be a ROM (Read Only Memory) or other type of static storage device that can store static information and instructions, a RAM (Random Access Memory) or other type of dynamic storage device that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto.

[0174] The memory 303 is used to store the application code for executing the solution of the present application, and the execution is controlled by the processor 301. The processor 301 is used to execute the application code stored in the memory 303 to implement the content shown in the above method embodiment. Figure 3 The electronic device shown is only an example and should not limit the functions and scope of use of the embodiments of the present disclosure.

[0175] An embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer-readable storage medium is run on a computer, the computer can execute the corresponding contents of the aforementioned method embodiment.

[0176] It should be understood that although the steps in the flowcharts of the accompanying drawings are shown in sequence as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some of the steps in the flowcharts of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.

[0177] The above are only some of the implementation methods of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. An image correction method, characterized in that: include: After triggering a correction instruction, acquiring at least one initial image, wherein the conditions for triggering the correction instruction include being triggered when the camera enters a continuous shooting mode, being triggered when a user inputs a correction instruction, or being triggered after acquiring at least one photo; Obtaining a focus evaluation of each of the initial images, where the focus evaluation is used to represent the clarity of the corresponding initial image; Screening all the initial images and retaining qualified images, wherein the qualified images are initial images whose focus evaluation is greater than or equal to a preset qualified threshold; Correcting the qualified image to obtain a corrected image; The step of obtaining a focus evaluation of each of the initial images, wherein for any of the initial images, includes: Calculating any of the initial images based on N preset focusing evaluation algorithms to obtain N initial focusing evaluations corresponding to any of the initial images, where N is an integer greater than or equal to 2; Determine an average value of N initial focus evaluations corresponding to any of the initial images as the focus evaluation corresponding to any of the initial images; Performing grayscale processing and binarization processing on any of the corrected images to obtain a preprocessed image; Performing contour detection on the preprocessed image to determine the contour of the target in the preprocessed image; Determining the minimum bounding rectangle of the contour; Determining whether the angle between the side of the minimum circumscribed rectangle and the edge of the preprocessed image is within a preset range; If so, it is determined that the rectified image corresponding to the preprocessed image is a correct image.

2. The image correction method according to claim 1, characterized in that: The correcting the qualified image includes: Obtaining the shooting time of each qualified image; Determining the similarity between the qualified images taken at adjacent times; If the similarity is greater than or equal to a preset similarity threshold, determining the image with a larger focus evaluation value between the two qualified images taken adjacently in time as the image to be corrected; Correcting the image to be corrected.

3. The image correction method according to claim 2, characterized in that: The correcting the image to be corrected, wherein for each image to be corrected, the step includes: Performing Hough line detection on the image to be corrected to determine all straight lines in the image to be corrected; determining an inclination angle for each straight line and determining an average inclination angle based on all of the inclination angles; The image to be corrected is corrected based on the average tilt angle.

4. The image correction method according to claim 3, characterized in that: Determining an average tilt angle based on all the tilt angles comprises: Performing target detection on the image to be corrected to determine a target area within the image to be corrected; Screening all straight lines to determine a valid straight line, where the valid straight line is a straight line passing through the target area; Based on all said valid straight lines, an average tilt angle is determined.

5. The image correction method according to claim 1, wherein: Also includes: Generating a preview image from each of the corrected images and the initial image corresponding to the corrected image; The preview image also includes annotation information for the corrected image and the initial image.

6. An image correction device, characterized in that: include: An initial image acquisition module is used to trigger a correction instruction and acquire at least one initial image. The conditions for triggering the correction instruction include: triggering when the camera enters continuous shooting mode, triggering when the user inputs a correction instruction, and triggering after acquiring at least one photo; a focus evaluation acquisition module, configured to acquire a focus evaluation of each of the initial images, wherein the focus evaluation is used to characterize the clarity of the corresponding initial image; a screening module, configured to screen all the initial images and retain qualified images, wherein the qualified images are initial images having a focus evaluation greater than or equal to a preset qualified threshold; a correction module, configured to correct the qualified image to obtain a corrected image; The focus evaluation acquisition module acquires the focus evaluation of each of the initial images, wherein for any of the initial images, the module includes: Calculating any of the initial images based on N preset focusing evaluation algorithms to obtain N initial focusing evaluations corresponding to any of the initial images, where N is an integer greater than or equal to 2; Determine an average value of N initial focus evaluations corresponding to any of the initial images as the focus evaluation corresponding to any of the initial images; The correction module is also used for: Performing grayscale processing and binarization processing on any of the corrected images to obtain a preprocessed image; Performing contour detection on the preprocessed image to determine the contour of the target in the preprocessed image; Determining the minimum bounding rectangle of the contour; Determining whether the angle between the side of the minimum circumscribed rectangle and the edge of the preprocessed image is within a preset range; If so, it is determined that the rectified image corresponding to the preprocessed image is a correct image.

7. A camera, characterized in that: The camera includes: at least one processor; Memory; At least one application, wherein the at least one application is stored in a memory and configured to be executed by at least one processor, and the at least one application is configured to: execute the image correction method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that include: A computer program is stored which can be loaded by a processor and executes the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Picture processing method, mobile terminal and computer readable storage medium

    CN107589963A

  • High-dynamic-range image acquisition method, device and mobile terminal

    CN109040603A

  • Image correction processing method and device, storage medium and computer equipment

    CN111507908A