Image correction method and related equipment

By dividing the image into regions and calculating coordinate points, and using matrix or proportional relationships to correct the image, the problems of image tilt and deformation obtained by a camera or still camera are solved, and high-accuracy image correction is achieved.

CN114693532BActive Publication Date: 2025-10-03FU TAI HUA IND SHENZHEN +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011585212.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-28
Publication Date
2025-10-03
Estimated Expiration
2040-12-28

AI Technical Summary

Technical Problem

In the prior art, images captured by a camera or a still camera may be tilted or deformed due to factors such as lens angle and light, and an effective image correction method is needed to improve the correction accuracy.

Method used

By obtaining the original image and the standard image, dividing them into multiple areas, selecting coordinate points to calculate the correspondence, using matrix or proportional relationship to perform correction, and splicing the corrected areas, an image without deformation is obtained.

Benefits of technology

Improved the accuracy of image correction to ensure images are free of tilt and deformation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114693532B_ABST
    Figure CN114693532B_ABST
Patent Text Reader

Abstract

The present invention provides an image correction method and related equipment. The image correction method divides an original image into multiple original image areas and a standard image into multiple plane image areas; selects multiple first coordinate points from each original image area, records the plane image area corresponding to the original image area in the multiple plane image areas as a target plane image area, and selects multiple second coordinate points corresponding to the multiple first coordinate points from the target plane image area; calculates the correspondence between the original image area and the target plane area based on the multiple first coordinate points and the multiple second coordinate points; corrects the multiple original image areas based on the correspondence between the multiple original image areas and the multiple plane image areas to obtain multiple corrected original image areas; and splices the multiple corrected original image areas to obtain a corrected image of the original image. The present invention improves the accuracy of the corrected image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to an image correction method, apparatus, computer equipment, and computer-readable storage medium. Background Art

[0002] Image correction plays an important role in application scenarios such as image comparison and component damage detection.

[0003] Typically, images captured by a camera or video camera may be tilted or distorted due to external factors such as lens angle and light, and the images need to be corrected.

[0004] How to correct the image becomes a problem to be solved. Summary of the Invention

[0005] In view of the above, it is necessary to propose an image correction method, apparatus, computer device and computer-readable storage medium, which can correct an image and improve the accuracy of the corrected image.

[0006] A first aspect of the present application provides an image correction method, the image correction method comprising:

[0007] Acquire a deformed original image and a deformed standard image corresponding to the original image;

[0008] Dividing the original image into a plurality of original image regions and dividing the standard image into a plurality of plane image regions;

[0009] For each of the plurality of original image areas, selecting a plurality of first coordinate points from the original image area, recording a plan area corresponding to the original image area in the plurality of plan areas as a target plan area, and selecting a plurality of second coordinate points corresponding to the plurality of first coordinate points from the target plan area;

[0010] Calculating a correspondence between the original image area and the target plane area according to the plurality of first coordinate points and the plurality of second coordinate points;

[0011] Correcting the plurality of original image regions according to the correspondence between the plurality of original image regions and the plurality of planar image regions to obtain a plurality of corrected original image regions;

[0012] The multiple corrected original image regions are spliced ​​together to obtain a corrected image of the original image.

[0013] In another possible implementation, calculating the correspondence between the original image area and the target plane area according to the multiple first coordinate points and the multiple second coordinate points includes:

[0014] Calculating a matrix correspondence between the original image area and the target plane area according to the plurality of first coordinate points and the plurality of second coordinate points; and / or

[0015] The proportional correspondence between the original image area and the target plane area is calculated according to the multiple first coordinate points and the multiple second coordinate points.

[0016] In another possible implementation, the correcting the multiple original image regions according to the correspondence between the multiple original image regions and the multiple plan view regions includes:

[0017] For each original image region, determining the type of correspondence between the original image region and the target plane region;

[0018] When the type of the correspondence between the original image area and the target plane area is a matrix correspondence, calculating the transformed coordinates of each pixel point in the original image area according to the transformation matrix, and correcting the pixel value of each pixel point in the original image area according to the transformed coordinates of each pixel point in the original image area;

[0019] When the type of correspondence between the original image area and the target plane area is a proportional correspondence, the x destination coordinates and y destination coordinates of each pixel point in the original image area are calculated one by one according to the proportional correspondence; and the pixel values ​​of each pixel point in the original image area are corrected according to the x destination coordinates and y destination coordinates of each pixel point in the original image area.

[0020] In another possible implementation, calculating the proportional correspondence relationship of the original image area according to the multiple first coordinate points and the multiple second coordinate points includes:

[0021] Determine the x-axis and y-axis of the original image area;

[0022] Determine a plurality of first boundary points from the original image region according to the plurality of first coordinate points, and determine a plurality of second boundary points from the target plane region according to the plurality of second coordinate points;

[0023] Calculate a first distance between each first boundary point and the x-axis and a second distance between each first boundary point and the y-axis;

[0024] Calculate a third distance between each second boundary point and the x-axis and a fourth distance between each second boundary point and the y-axis;

[0025] Calculating a first ratio of a first distance of each first boundary point to a third distance of a second boundary point corresponding to the first boundary point;

[0026] A second ratio of the second distance of each first boundary point to the fourth distance of the second boundary point corresponding to the first boundary point is calculated.

[0027] In another possible implementation, the plurality of first coordinate points are two-dimensional coordinate points, and calculating the matrix correspondence relationship of the original image region according to the plurality of first coordinate points and the plurality of second coordinate points includes:

[0028] determining a three-dimensional representation of the plurality of first coordinate points by a transformation matrix composed of transformation parameters;

[0029] Constructing a system of equations based on the three-dimensional representation of each first coordinate point and the second coordinate point corresponding to the first coordinate point to obtain multiple systems of equations;

[0030] The transformation parameters are calculated according to the multiple equation groups to obtain the transformation matrix.

[0031] In another possible implementation, calculating the transformed coordinates of each pixel point in the original image area according to the transformation matrix includes:

[0032] Converting a two-dimensional representation of each pixel into a three-dimensional representation of the pixel according to the transformation parameters in the transformation matrix;

[0033] Dimensionality reduction is performed on the three-dimensional representation of the pixel point to obtain the transformed coordinates of the pixel point.

[0034] In another possible implementation, the image correction method further includes:

[0035] For each pixel point in the original image area, determining a first boundary point corresponding to the pixel point;

[0036] Determining a target first ratio of a first boundary point corresponding to the pixel point from the proportional correspondence;

[0037] Obtaining a fifth distance between the pixel point and the x-axis of the original image region, and obtaining a sixth distance between the first boundary point corresponding to the pixel point and the x-axis;

[0038] When the fifth distance is less than or equal to the sixth distance, the square of the inverse of the target first ratio is calculated, and the product of the square and the y coordinate of the pixel point is calculated to obtain the y destination coordinate of the pixel point.

[0039] A second aspect of the present application provides an image correction device, comprising:

[0040] An acquisition module, configured to acquire an original image and a standard image of the original image;

[0041] a division module, configured to divide the original image into a plurality of original image regions and the standard image into a plurality of plane image regions;

[0042] a selection module configured to select, for each of the plurality of original image areas, a plurality of first coordinate points from the original image area, record a plan area corresponding to the original image area in the plurality of plan areas as a target plan area, and select a plurality of second coordinate points corresponding to the plurality of first coordinate points from the target plan area;

[0043] a calculation module, configured to calculate a correspondence between the original image area and the target plane area according to the plurality of first coordinate points and the plurality of second coordinate points;

[0044] a correction module, configured to correct the plurality of original image regions according to a correspondence between the plurality of original image regions and the plurality of planar image regions, to obtain a plurality of corrected original image regions;

[0045] The stitching module is used to stitch the multiple corrected original image regions to obtain a corrected image of the original image.

[0046] A third aspect of the present application provides a computer device, comprising a processor, wherein the processor is configured to implement the image correction method when executing a computer program stored in a memory.

[0047] A fourth aspect of the present application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the image correction method when executed by a processor.

[0048] According to the above technical solution, the present invention can improve the accuracy of image correction. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 This is a flow chart of an image correction method provided by an embodiment of the present invention.

[0050] Figure 2 4 is a structural diagram of an image correction device provided by an embodiment of the present invention.

[0051] Figure 3 Schematic diagram of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0052] In order to more clearly understand the above-mentioned objects, features and advantages of the present invention, the present invention is described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that, in the absence of conflict, the embodiments of the present application and the features therein may be combined with each other.

[0053] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. The described embodiments are only some, rather than all, embodiments of the present invention.

[0054] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention.

[0055] Preferably, the image correction method of the present invention is applied to one or more computer devices. The computer device is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to a microprocessor, an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a digital signal processor (DSP), an embedded device, etc.

[0056] The computer device may be a desktop computer, notebook computer, PDA, cloud server, etc. The computer device may interact with the user via a keyboard, mouse, remote control, touchpad, or voice control device.

[0057] Example 1

[0058] Figure 1 The flowchart of the image correction method provided in the first embodiment of the present invention is shown in FIG.

[0059] like Figure 1 As shown, the image correction method includes:

[0060] 101. Acquire an original image and a standard image of the original image.

[0061] The original image is an image that needs to be corrected, and the standard image is a standard image without deformation.

[0062] The original image may be obtained by a camera or a photographic device, or may be read from a local database.

[0063] The original image and the standard image include the same image content.

[0064] 102 : Divide the original image into a plurality of original image regions, and divide the standard image into a plurality of planar image regions.

[0065] The original image is divided into a plurality of original image regions, and the standard image is divided into a plurality of plane image regions using the same division method.

[0066] For example, the original image is divided into two original image areas in a vertical direction, and the standard image is divided into two plane image areas in a vertical direction.

[0067] 103. For each of the multiple original image areas, select multiple first coordinate points from the original image area, record the plan area corresponding to the original image area in the multiple plan areas as the target plan area, and select multiple second coordinate points corresponding to the multiple first coordinate points from the target plan area.

[0068] For example, the original image region includes a table, and the four vertices of the table in the original image region are selected as first coordinate points. A plurality of second coordinate points corresponding to the plurality of first coordinate points are selected from the target plane region, namely, the four vertices of the table in the target plane region.

[0069] 104 : Calculate a correspondence between the original image area and the target plane area according to the multiple first coordinate points and the multiple second coordinate points.

[0070] In a specific embodiment, calculating the correspondence between the original image area and the target plane area according to the plurality of first coordinate points and the plurality of second coordinate points includes:

[0071] Calculating a matrix correspondence between the original image area and the target plane area according to the plurality of first coordinate points and the plurality of second coordinate points; and / or

[0072] The proportional correspondence between the original image area and the target plane area is calculated according to the multiple first coordinate points and the multiple second coordinate points.

[0073] In a specific embodiment, the plurality of first coordinate points are two-dimensional coordinate points, and calculating the matrix correspondence relationship of the original image region according to the plurality of first coordinate points and the plurality of second coordinate points includes:

[0074] determining a three-dimensional representation of the plurality of first coordinate points by a transformation matrix composed of transformation parameters;

[0075] Constructing a system of equations based on the three-dimensional representation of each first coordinate point and the second coordinate point corresponding to the first coordinate point to obtain multiple systems of equations;

[0076] The transformation parameters are calculated according to the multiple equation groups to obtain the transformation matrix.

[0077] For example, if any first coordinate point is (x1, y1), and the second coordinate point corresponding to the first coordinate point is (x2, y2), the transformation matrix is: Among them, a 11 to a33 is the transformation parameter, and the first coordinate point and the second coordinate point are known quantities.

[0078] Determine the three-dimensional representation of the first coordinate point through the transformation matrix:

[0079]

[0080] The three-dimensional representation of the first coordinate point is (x, y, z). 11 x1+a 12 y1+a 13 , y=a 21 x1+a 22 y1+a 23 , z=a 31 x1+a 32 y1+a 33 .

[0081] Construct a system of equations based on the three-dimensional representation of a first coordinate point and the second coordinate point corresponding to the first coordinate point:

[0082]

[0083] Multiple equation groups can be obtained from multiple first coordinate points. For example, four equation groups can be obtained from four first coordinate points and four second coordinate points corresponding to the four first coordinate points.

[0084] Calculate the transformation parameter a based on multiple equations 11 to a 33 , and get the transformation matrix.

[0085] In a specific embodiment, calculating the proportional correspondence relationship of the original image area according to the plurality of first coordinate points and the plurality of second coordinate points includes:

[0086] Determine the x-axis and y-axis of the original image area;

[0087] Determine a plurality of first boundary points from the original image region according to the plurality of first coordinate points, and determine a plurality of second boundary points from the target plane region according to the plurality of second coordinate points;

[0088] Calculate a first distance between each first boundary point and the x-axis and a second distance between each first boundary point and the y-axis;

[0089] Calculate a third distance between each second boundary point and the x-axis and a fourth distance between each second boundary point and the y-axis;

[0090] Calculating a first ratio of a first distance of each first boundary point to a third distance of a second boundary point corresponding to the first boundary point;

[0091] A second ratio of the second distance of each first boundary point to the fourth distance of the second boundary point corresponding to the first boundary point is calculated.

[0092] 105 , correct the multiple original image regions according to the correspondence between the multiple original image regions and the multiple planar image regions to obtain multiple corrected original image regions.

[0093] In a specific embodiment, the correcting the multiple original image regions according to the correspondence between the multiple original image regions and the multiple planar image regions includes:

[0094] For each original image region, determining the type of correspondence between the original image region and the target plane region;

[0095] When the type of the correspondence between the original image area and the target plane area is a matrix correspondence, calculating the transformed coordinates of each pixel point in the original image area according to the transformation matrix, and correcting the pixel value of each pixel point in the original image area according to the transformed coordinates of each pixel point in the original image area;

[0096] When the type of correspondence between the original image area and the target plane area is a proportional correspondence, the x destination coordinates and y destination coordinates of each pixel point in the original image area are calculated one by one according to the proportional correspondence; and the pixel values ​​of each pixel point in the original image area are corrected according to the x destination coordinates and y destination coordinates of each pixel point in the original image area.

[0097] In a specific embodiment, calculating the transformed coordinates of each pixel point in the original image area according to the transformation matrix includes:

[0098] Converting a two-dimensional representation of each pixel into a three-dimensional representation of the pixel according to the transformation parameters in the transformation matrix;

[0099] Dimensionality reduction is performed on the three-dimensional representation of the pixel point to obtain the transformed coordinates of the pixel point.

[0100] In a specific embodiment, calculating the y destination coordinate of each pixel point in the original image area one by one according to the proportional correspondence includes:

[0101] For each pixel point in the original image area, determining a first boundary point corresponding to the pixel point;

[0102] Determining a target first ratio of a first boundary point corresponding to the pixel point from the proportional correspondence;

[0103] Obtaining a fifth distance between the pixel point and the x-axis of the original image region, and obtaining a sixth distance between the first boundary point corresponding to the pixel point and the x-axis;

[0104] When the fifth distance is less than or equal to the sixth distance, calculating the product of the inverse of the first target ratio and the y coordinate of the pixel point to obtain the y destination coordinate of the pixel point;

[0105] When the fifth distance is greater than the sixth distance, obtain the y coordinate of the second boundary point corresponding to the pixel point, the y coordinate of the first boundary point corresponding to the pixel point, the y boundary coordinate of the original image area, and the y boundary coordinate of the target plane area, and calculate the y destination coordinate of the pixel point based on the y coordinate of the second boundary point corresponding to the pixel point, the y coordinate of the first boundary point corresponding to the pixel point, the y boundary coordinate of the original image area, the y boundary coordinate of the target plane area, and the y coordinate of the pixel point.

[0106] Specifically, the y destination coordinate of the pixel point is calculated according to the y coordinate of the second boundary point corresponding to the pixel point, the y coordinate of the first boundary point corresponding to the pixel point, the y boundary coordinate of the original image area, the y boundary coordinate of the target plane area, and the y coordinate of the pixel point using the following formula:

[0107]

[0108] Among them, O y Indicates the y destination coordinate of the pixel point, E y represents the y coordinate of the second boundary point corresponding to the pixel point, P y Indicates the y coordinate of the pixel point, F y Indicates the y coordinate of the first boundary point corresponding to the pixel point, V y represents the y boundary coordinate of the original image area, W y Indicates the y-boundary coordinate of the target plane area.

[0109] In another embodiment, when the fifth distance is less than or equal to the sixth distance, the image correction method further includes:

[0110] The square value of the inverse of the target first ratio is calculated, and the product of the square value and the y coordinate of the pixel point is calculated to obtain the y destination coordinate of the pixel point.

[0111] 106 , stitching the multiple corrected original image regions to obtain a corrected image of the original image.

[0112] For example, in the above example, two original image areas are obtained by dividing the image vertically, and the two corrected original image areas are spliced ​​into the original image (the two corrected original image areas correspond to the left and right halves of the original image respectively) to obtain a corrected image of the original image.

[0113] The image correction method of embodiment 1 obtains an original image and a standard image of the original image; divides the original image into multiple original image areas, and divides the standard image into multiple plane image areas; for each original image area in the multiple original image areas, selects multiple first coordinate points from the original image area, records the plane image area corresponding to the original image area in the multiple plane image areas as the target plane image area, and selects multiple second coordinate points corresponding to the multiple first coordinate points from the target plane image area; calculates the correspondence between the original image area and the target plane area based on the multiple first coordinate points and the multiple second coordinate points; corrects the multiple original image areas based on the correspondence between the multiple original image areas and the multiple plane image areas to obtain multiple corrected original image areas; splices the multiple corrected original image areas to obtain a corrected image of the original image, thereby improving the accuracy of image correction.

[0114] Example 2

[0115] Figure 2 FIG2 is a structural diagram of an image correction device provided in a second embodiment of the present invention. The image correction device 20 is applied to a computer device and is used to correct an image.

[0116] like Figure 2 As shown, the image correction device 20 may include an acquisition module 201 , a division module 202 , a selection module 203 , a calculation module 204 , a correction module 205 , and a stitching module 206 .

[0117] The acquisition module 201 is configured to acquire an original image and a standard image of the original image.

[0118] The original image is an image that needs to be corrected, and the standard image is a standard image without deformation.

[0119] The original image may be obtained by a camera or a photographic device, or may be read from a local database.

[0120] The original image and the standard image include the same image content.

[0121] The division module 202 is configured to divide the original image into a plurality of original image regions and divide the standard image into a plurality of plane image regions.

[0122] The original image is divided into a plurality of original image regions, and the standard image is divided into a plurality of plane image regions using the same division method.

[0123] For example, the original image is divided into two original image areas in a vertical direction, and the standard image is divided into two plane image areas in a vertical direction.

[0124] The selection module 203 is used to select multiple first coordinate points from each of the multiple original image areas, record the plan area corresponding to the original image area in the multiple plan areas as the target plan area, and select multiple second coordinate points corresponding to the multiple first coordinate points from the target plan area.

[0125] For example, the original image region includes a table, and the four vertices of the table in the original image region are selected as first coordinate points. A plurality of second coordinate points corresponding to the plurality of first coordinate points are selected from the target plane region, namely, the four vertices of the table in the target plane region.

[0126] The calculation module 204 is configured to calculate a correspondence between the original image region and the target plane region according to the plurality of first coordinate points and the plurality of second coordinate points.

[0127] In a specific embodiment, calculating the correspondence between the original image area and the target plane area according to the plurality of first coordinate points and the plurality of second coordinate points includes:

[0128] Calculating a matrix correspondence between the original image area and the target plane area according to the plurality of first coordinate points and the plurality of second coordinate points; and / or

[0129] The proportional correspondence between the original image area and the target plane area is calculated according to the multiple first coordinate points and the multiple second coordinate points.

[0130] In a specific embodiment, the plurality of first coordinate points are two-dimensional coordinate points, and calculating the matrix correspondence relationship of the original image region according to the plurality of first coordinate points and the plurality of second coordinate points includes:

[0131] determining a three-dimensional representation of the plurality of first coordinate points by a transformation matrix composed of transformation parameters;

[0132] Constructing a system of equations based on the three-dimensional representation of each first coordinate point and the second coordinate point corresponding to the first coordinate point to obtain multiple systems of equations;

[0133] The transformation parameters are calculated according to the multiple equation groups to obtain the transformation matrix.

[0134] For example, if any first coordinate point is (x1, y1), and the second coordinate point corresponding to the first coordinate point is (x2, y2), the transformation matrix is: Among them, a 11 to a 33 is the transformation parameter, and the first coordinate point and the second coordinate point are known quantities.

[0135] Determine the three-dimensional representation of the first coordinate point through the transformation matrix:

[0136]

[0137] The three-dimensional representation of the first coordinate point is (x, y, z). 11 x1+a 12 y1+a 13 , y=a 21 x1+a 22 y1+a 23 , z=a 31 x1+a 32 y1+a 33 .

[0138] Construct a system of equations based on the three-dimensional representation of a first coordinate point and the second coordinate point corresponding to the first coordinate point:

[0139]

[0140] Multiple equation groups can be obtained from multiple first coordinate points. For example, four equation groups can be obtained from four first coordinate points and four second coordinate points corresponding to the four first coordinate points.

[0141] Calculate the transformation parameter a based on multiple equations 11 to a 33 , and get the transformation matrix.

[0142] In a specific embodiment, calculating the proportional correspondence relationship of the original image area according to the plurality of first coordinate points and the plurality of second coordinate points includes:

[0143] Determine the x-axis and y-axis of the original image area;

[0144] Determine a plurality of first boundary points from the original image region according to the plurality of first coordinate points, and determine a plurality of second boundary points from the target plane region according to the plurality of second coordinate points;

[0145] Calculate a first distance between each first boundary point and the x-axis and a second distance between each first boundary point and the y-axis;

[0146] Calculate a third distance between each second boundary point and the x-axis and a fourth distance between each second boundary point and the y-axis;

[0147] Calculating a first ratio of a first distance of each first boundary point to a third distance of a second boundary point corresponding to the first boundary point;

[0148] A second ratio of the second distance of each first boundary point to the fourth distance of the second boundary point corresponding to the first boundary point is calculated.

[0149] The correction module 205 is configured to correct the multiple original image regions according to the correspondence between the multiple original image regions and the multiple planar image regions to obtain multiple corrected original image regions.

[0150] In a specific embodiment, the correcting the multiple original image regions according to the correspondence between the multiple original image regions and the multiple planar image regions includes:

[0151] For each original image region, determining the type of correspondence between the original image region and the target plane region;

[0152] When the type of the correspondence between the original image area and the target plane area is a matrix correspondence, calculating the transformed coordinates of each pixel point in the original image area according to the transformation matrix, and correcting the pixel value of each pixel point in the original image area according to the transformed coordinates of each pixel point in the original image area;

[0153] When the type of correspondence between the original image area and the target plane area is a proportional correspondence, the x destination coordinates and y destination coordinates of each pixel point in the original image area are calculated one by one according to the proportional correspondence; and the pixel values ​​of each pixel point in the original image area are corrected according to the x destination coordinates and y destination coordinates of each pixel point in the original image area.

[0154] In a specific embodiment, calculating the transformed coordinates of each pixel point in the original image area according to the transformation matrix includes:

[0155] Converting a two-dimensional representation of each pixel into a three-dimensional representation of the pixel according to the transformation parameters in the transformation matrix;

[0156] Dimensionality reduction is performed on the three-dimensional representation of the pixel point to obtain the transformed coordinates of the pixel point.

[0157] In a specific embodiment, calculating the y destination coordinate of each pixel point in the original image area one by one according to the proportional correspondence includes:

[0158] For each pixel point in the original image area, determining a first boundary point corresponding to the pixel point;

[0159] Determining a target first ratio of a first boundary point corresponding to the pixel point from the proportional correspondence;

[0160] Obtaining a fifth distance between the pixel point and the x-axis of the original image region, and obtaining a sixth distance between the first boundary point corresponding to the pixel point and the x-axis;

[0161] When the fifth distance is less than or equal to the sixth distance, calculating the product of the inverse of the first target ratio and the y coordinate of the pixel point to obtain the y destination coordinate of the pixel point;

[0162] When the fifth distance is greater than the sixth distance, obtain the y coordinate of the second boundary point corresponding to the pixel point, the y coordinate of the first boundary point corresponding to the pixel point, the y boundary coordinate of the original image area, and the y boundary coordinate of the target plane area, and calculate the y destination coordinate of the pixel point based on the y coordinate of the second boundary point corresponding to the pixel point, the y coordinate of the first boundary point corresponding to the pixel point, the y boundary coordinate of the original image area, the y boundary coordinate of the target plane area, and the y coordinate of the pixel point.

[0163] Specifically, the y destination coordinate of the pixel point is calculated according to the y coordinate of the second boundary point corresponding to the pixel point, the y coordinate of the first boundary point corresponding to the pixel point, the y boundary coordinate of the original image area, the y boundary coordinate of the target plane area, and the y coordinate of the pixel point using the following formula:

[0164]

[0165] Among them, O y Indicates the y destination coordinate of the pixel point, E y represents the y coordinate of the second boundary point corresponding to the pixel point, P y Indicates the y coordinate of the pixel point, F y Indicates the y coordinate of the first boundary point corresponding to the pixel point, V y represents the y boundary coordinate of the original image area, W y Indicates the y-boundary coordinate of the target plane area.

[0166] In another embodiment, when the fifth distance is less than or equal to the sixth distance, the calculation module is also used to calculate the square value of the inverse of the target first ratio, calculate the product of the square value and the y coordinate of the pixel point, and obtain the y destination coordinate of the pixel point.

[0167] The stitching module 206 is configured to stitch the multiple corrected original image regions to obtain a corrected image of the original image.

[0168] For example, in the above example, two original image areas are obtained by dividing the image vertically, and the two corrected original image areas are spliced ​​into the original image (the two corrected original image areas correspond to the left and right halves of the original image respectively) to obtain a corrected image of the original image.

[0169] The image correction device 20 of the second embodiment obtains an original image and a standard image of the original image; divides the original image into multiple original image areas, and divides the standard image into multiple plane image areas; for each original image area in the multiple original image areas, selects multiple first coordinate points from the original image area, records the plane image area corresponding to the original image area in the multiple plane image areas as the target plane image area, and selects multiple second coordinate points corresponding to the multiple first coordinate points from the target plane image area; calculates the correspondence between the original image area and the target plane area based on the multiple first coordinate points and the multiple second coordinate points; corrects the multiple original image areas based on the correspondence between the multiple original image areas and the multiple plane image areas to obtain multiple corrected original image areas; splices the multiple corrected original image areas to obtain a corrected image of the original image, thereby improving the accuracy of image correction.

[0170] Example 3

[0171] This embodiment provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps in the above-mentioned image correction method embodiment are implemented, for example: Figure 1 Steps 101-106 shown:

[0172] 101, obtaining a deformed original image and a deformed standard image corresponding to the original image;

[0173] 102, dividing the original image into a plurality of original image regions, and dividing the standard image into a plurality of planar image regions;

[0174] 103. For each of the multiple original image areas, select a plurality of first coordinate points from the original image area, record a plan area corresponding to the original image area in the multiple plan areas as a target plan area, and select a plurality of second coordinate points corresponding to the plurality of first coordinate points from the target plan area.

[0175] 104. Calculate a correspondence between the original image region and the target plane region based on the plurality of first coordinate points and the plurality of second coordinate points;

[0176] 105 , correcting the multiple original image regions according to the correspondence between the multiple original image regions and the multiple planar image regions to obtain multiple corrected original image regions;

[0177] 106 , stitching the multiple corrected original image regions to obtain a corrected image of the original image.

[0178] Alternatively, when the computer program is executed by a processor, the functions of each module in the above-mentioned device embodiment are realized, for example Figure 2 Modules 201-206:

[0179] An acquisition module 201 is configured to acquire an original image and a standard image of the original image;

[0180] a division module, configured to divide the original image into a plurality of original image regions and the standard image into a plurality of plane image regions;

[0181] a selection module configured to select, for each of the plurality of original image areas, a plurality of first coordinate points from the original image area, record a plan area corresponding to the original image area in the plurality of plan areas as a target plan area, and select a plurality of second coordinate points corresponding to the plurality of first coordinate points from the target plan area;

[0182] a calculation module, configured to calculate a correspondence between the original image area and the target plane area according to the plurality of first coordinate points and the plurality of second coordinate points;

[0183] a correction module, configured to correct the plurality of original image regions according to a correspondence between the plurality of original image regions and the plurality of planar image regions, to obtain a plurality of corrected original image regions;

[0184] The stitching module is used to stitch the multiple corrected original image regions to obtain a corrected image of the original image.

[0185] Example 4

[0186] Figure 3 Schematic diagram of a computer device provided in Embodiment 3 of the present invention. The computer device 30 includes a memory 301, a processor 302, and a computer program 303 stored in the memory 301 and executable on the processor 302, such as an image correction program. When the processor 302 executes the computer program 303, the steps in the above-mentioned image correction method embodiment are implemented, such as Figure 1 101-106 shown:

[0187] 101, obtaining a deformed original image and a deformed standard image corresponding to the original image;

[0188] 102, dividing the original image into a plurality of original image regions, and dividing the standard image into a plurality of planar image regions;

[0189] 103. For each of the multiple original image areas, select a plurality of first coordinate points from the original image area, record a plan area corresponding to the original image area in the multiple plan areas as a target plan area, and select a plurality of second coordinate points corresponding to the plurality of first coordinate points from the target plan area.

[0190] 104. Calculate a correspondence between the original image region and the target plane region based on the plurality of first coordinate points and the plurality of second coordinate points;

[0191] 105 , correcting the multiple original image regions according to the correspondence between the multiple original image regions and the multiple planar image regions to obtain multiple corrected original image regions;

[0192] 106 , stitching the multiple corrected original image regions to obtain a corrected image of the original image.

[0193] Alternatively, when the computer program is executed by a processor, the functions of each module in the above-mentioned device embodiment are realized, for example Figure 2 Modules 201-206:

[0194] An acquisition module 201 is configured to acquire an original image and a standard image of the original image;

[0195] a division module, configured to divide the original image into a plurality of original image regions and the standard image into a plurality of plane image regions;

[0196] a selection module configured to select, for each of the plurality of original image areas, a plurality of first coordinate points from the original image area, record a plan area corresponding to the original image area in the plurality of plan areas as a target plan area, and select a plurality of second coordinate points corresponding to the plurality of first coordinate points from the target plan area;

[0197] a calculation module, configured to calculate a correspondence between the original image area and the target plane area according to the plurality of first coordinate points and the plurality of second coordinate points;

[0198] a correction module, configured to correct the plurality of original image regions according to a correspondence between the plurality of original image regions and the plurality of planar image regions, to obtain a plurality of corrected original image regions;

[0199] The stitching module is used to stitch the multiple corrected original image regions to obtain a corrected image of the original image.

[0200] Exemplarily, the computer program 303 may be divided into one or more modules, which are stored in the memory 301 and executed by the processor 302 to complete the method. The one or more modules may be a series of computer program instruction segments that can complete specific functions, and the instruction segments are used to describe the execution process of the computer program 303 in the computer device 30. For example, the computer program 303 may be divided into Figure 2 The acquisition module 201, the division module 202, the selection module 203, the calculation module 204, the correction module 205, and the splicing module 206 in the embodiment are described in detail in the second embodiment.

[0201] Those skilled in the art will understand that the schematic Figure 3 This is merely an example of the computer device 30 and does not constitute a limitation of the computer device 30 . The computer device 30 may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the computer device 30 may also include input and output devices, network access devices, buses, etc.

[0202] The processor 302 may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor, or the processor 302 may be any conventional processor. The processor 302 is the control center of the computer device 30 and connects various parts of the entire computer device 30 using various interfaces and lines.

[0203] The memory 301 can be used to store the computer program 303. The processor 302 implements the various functions of the computer device 30 by running or executing the computer programs or modules stored in the memory 301 and accessing the data stored in the memory 301. The memory 301 may mainly include a program storage area and a data storage area. The program storage area may store an operating system and at least one application required for a function (such as a sound playback function or an image playback function); the data storage area may store data created based on the use of the computer device 30. In addition, the memory 301 may include non-volatile memory, such as a hard disk, internal memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a flash card, at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device.

[0204] If the module integrated in the computer device 30 is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the process in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and when the computer program is executed by the processor, it can implement the steps of the above-mentioned various method embodiments. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device that can carry the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory).

[0205] In the several embodiments provided herein, it should be understood that the disclosed systems, devices, and methods may be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the module division is merely a logical functional division, and actual implementation may employ other division methods.

[0206] The modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed across multiple network elements. Some or all of the modules may be selected to achieve the purpose of the solution of this embodiment according to actual needs.

[0207] In addition, the functional modules in various embodiments of the present invention may be integrated into a single processing module, each module may exist physically separately, or two or more modules may be integrated into a single module. The aforementioned integrated modules may be implemented in the form of hardware or hardware plus software functional modules.

[0208] The integrated modules implemented as software functional modules can be stored in a computer-readable storage medium. The software functional modules stored in the storage medium include instructions for causing a computer device (such as a personal computer, server, or network device) or a processor to execute some of the steps of the image correction method described in various embodiments of the present invention.

[0209] It is obvious to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential features of the invention. Therefore, from any point of view, the embodiments should be regarded as exemplary and non-restrictive, and the scope of the invention is defined by the appended claims rather than the above description, and it is intended that all changes that fall within the meaning and scope of the equivalent elements of the claims be included in the present invention. Any accompanying figure marks in the claims should not be regarded as limiting the claims involved. In addition, it is obvious that the word "comprising" does not exclude other modules or steps, and the singular does not exclude the plural. Multiple modules or devices stated in the system claims may also be implemented by one module or device through software or hardware. Words such as first and second are used to indicate names and do not indicate any particular order.

[0210] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not limiting. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention.

Claims

1. An image correction method, characterized in that: The image correction method comprises: Acquire a deformed original image and a deformed standard image corresponding to the original image; Dividing the original image into a plurality of original image regions and dividing the standard image into a plurality of plane image regions; For each of the plurality of original image areas, selecting a plurality of first coordinate points from the original image area, recording a plan area corresponding to the original image area in the plurality of plan areas as a target plan area, and selecting a plurality of second coordinate points corresponding to the plurality of first coordinate points from the target plan area; Calculating the correspondence between the original image area and the target plane area according to the plurality of first coordinate points and the plurality of second coordinate points, including: calculating a matrix correspondence between the original image area and the target plane area according to the plurality of first coordinate points and the plurality of second coordinate points; and / or calculating a proportional correspondence between the original image area and the target plane area according to the plurality of first coordinate points and the plurality of second coordinate points; Correcting the multiple original image areas according to the correspondence between the multiple original image areas and the multiple planar image areas to obtain multiple corrected original image areas, including: when the type of the correspondence is a matrix correspondence, calculating the transformation coordinates of each pixel point in the original image area according to the transformation matrix, and correcting the pixel value of each pixel point according to the transformation coordinates; or when the type of the correspondence is a proportional correspondence, calculating the x-destination coordinate and the y-destination coordinate of each pixel point in the original image area one by one according to the proportional correspondence; and correcting the pixel value of each pixel point according to the x-destination coordinate and the y-destination coordinate; The multiple corrected original image regions are spliced ​​together to obtain a corrected image of the original image.

2. The image correction method according to claim 1, wherein: Calculating the proportional correspondence of the original image area according to the plurality of first coordinate points and the plurality of second coordinate points includes: Determine the x-axis and y-axis of the original image area; Determine a plurality of first boundary points from the original image region according to the plurality of first coordinate points, and determine a plurality of second boundary points from the target plane region according to the plurality of second coordinate points; Calculate a first distance between each first boundary point and the x-axis and a second distance between each first boundary point and the y-axis; Calculate a third distance between each second boundary point and the x-axis and a fourth distance between each second boundary point and the y-axis; Calculating a first ratio of a first distance of each first boundary point to a third distance of a second boundary point corresponding to the first boundary point; A second ratio of the second distance of each first boundary point to the fourth distance of the second boundary point corresponding to the first boundary point is calculated.

3. The image correction method according to claim 1, wherein: The plurality of first coordinate points are two-dimensional coordinate points, and calculating the matrix correspondence relationship of the original image region according to the plurality of first coordinate points and the plurality of second coordinate points includes: determining a three-dimensional representation of the plurality of first coordinate points by a transformation matrix composed of transformation parameters; Constructing a system of equations based on the three-dimensional representation of each first coordinate point and the second coordinate point corresponding to the first coordinate point to obtain multiple systems of equations; The transformation parameters are calculated according to the multiple equation groups to obtain the transformation matrix.

4. The image correction method according to claim 3, wherein: Calculating the transformed coordinates of each pixel point in the original image area according to the transformation matrix includes: Converting a two-dimensional representation of each pixel into a three-dimensional representation of the pixel according to the transformation parameters in the transformation matrix; Dimensionality reduction is performed on the three-dimensional representation of the pixel point to obtain the transformed coordinates of the pixel point.

5. The image correction method according to claim 1, wherein: The image correction method further includes: For each pixel point in the original image area, determining a first boundary point corresponding to the pixel point; Determining a target first ratio of a first boundary point corresponding to the pixel point from the proportional correspondence; Obtaining a fifth distance between the pixel point and the x-axis of the original image region, and obtaining a sixth distance between the first boundary point corresponding to the pixel point and the x-axis; When the fifth distance is less than or equal to the sixth distance, the square of the inverse of the target first ratio is calculated, and the product of the square and the y coordinate of the pixel point is calculated to obtain the y destination coordinate of the pixel point.

6. An image correction device for implementing the image correction method according to claim 1, characterized in that: The image correction device comprises: An acquisition module, configured to acquire an original image and a standard image of the original image; a division module, configured to divide the original image into a plurality of original image regions and the standard image into a plurality of plane image regions; a selection module configured to select, for each of the plurality of original image areas, a plurality of first coordinate points from the original image area, record a plan area corresponding to the original image area in the plurality of plan areas as a target plan area, and select a plurality of second coordinate points corresponding to the plurality of first coordinate points from the target plan area; a calculation module, configured to calculate a correspondence between the original image area and the target plane area according to the plurality of first coordinate points and the plurality of second coordinate points; a correction module, configured to correct the plurality of original image regions according to a correspondence between the plurality of original image regions and the plurality of planar image regions, to obtain a plurality of corrected original image regions; The stitching module is used to stitch the multiple corrected original image regions to obtain a corrected image of the original image.

7. A computer device, characterized in that: The computer device includes a processor configured to execute a computer program stored in a memory to implement the image correction method according to any one of claims 1 to 5.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the image correction method according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Image distortion correction method and device, electronic equipment and storage medium

    CN111355863A

  • Image processing method and device and handheld camera

    CN111539880A