Image correction method and electronic equipment

By selecting multiple source control points and target points in the image and determining the mapping function for image correction, the problem that the homography method cannot correct the depth parallax image is solved, and accurate image correction and feature extraction are achieved.

CN118710564BActive Publication Date: 2025-08-08HANGZHOU YUNJIA DIGITAL TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410876796.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-02
Publication Date
2025-08-08
Estimated Expiration
2044-07-02

AI Technical Summary

Technical Problem

The existing homography transformation method cannot accurately correct the image to be corrected with depth parallax, resulting in inaccurate image feature extraction.

Method used

By selecting multiple source control points and target points, the mapping function is determined, image correction is performed based on multiple pixel points, and depth information of the image to be corrected is retained.

Benefits of technology

Accurate correction of images to be corrected with depth parallax is achieved, and the accuracy and consistency of image feature extraction are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118710564B_ABST
    Figure CN118710564B_ABST
Patent Text Reader

Abstract

The present invention discloses an image correction method and electronic device, the method comprising: obtaining a reference image and an image to be corrected; selecting multiple source control points in the image to be corrected and multiple target points in the reference image; determining at least one mapping function representing a mapping relationship between pixel points in the image to be corrected and corresponding pixel points in the reference image based on the multiple source control points and the multiple target points corresponding to the multiple source control points; determining an offset corresponding to each pixel point in the image to be corrected based on the mapping function; and correcting the image to be corrected based on the offset corresponding to each pixel point in the image to be corrected to obtain a corrected image. By determining at least one mapping function based on the multiple source control points and the multiple target points, the present application can determine the mapping function based on multiple pixel pairs. Compared to a method of correcting based on a mapping relationship between the planes where two images are located, this method can accurately correct an image to be corrected that has depth parallax.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to an image correction method and electronic equipment. Background Art

[0002] In applications requiring precise image analysis and feature extraction (such as medical or satellite image processing), image quality directly impacts the accuracy and efficiency of subsequent processing. During the actual recording process, issues with the camera's lens cutouts or adhesive distribution can cause varying degrees of distortion in the captured image, affecting feature extraction. Therefore, image correction is necessary.

[0003] Currently, a common image correction method is the homography method. This method performs geometric correction on the image to be corrected by establishing a mapping relationship between the plane of the image to be corrected and the plane of the reference image.

[0004] However, the fundamental assumption of homography is that there is a simple perspective relationship between two planes. This assumption no longer holds when the image to be corrected contains depth information, meaning that different objects are located at different distances. Therefore, homography often fails to accurately correct images with depth parallax. Summary of the Invention

[0005] In response to the shortcomings of the existing technology, the present application provides an image correction method and a core electronic device, which determines at least one mapping function representing the mapping relationship between pixel points in the image to be corrected and corresponding pixel points in the reference image based on multiple source control points and multiple target points. At least one mapping function can be determined based on multiple pixel pairs. Compared with the correction method based on the mapping relationship between the planes where the two images are located, the accurate depth information of the image to be corrected can be retained, thereby accurately correcting the image to be corrected with depth parallax.

[0006] In order to solve the above problems, the present invention provides the following technical solutions:

[0007] In a first aspect, an embodiment of the present application provides an image correction method, comprising:

[0008] Acquire a reference image and an image to be corrected;

[0009] Selecting a plurality of source control points in the image to be corrected and a plurality of target points in the reference image, wherein the source control points correspond to the target points one-to-one;

[0010] Determining at least one mapping function representing a mapping relationship between pixel points in the image to be corrected and corresponding pixel points in the reference image based on the plurality of source control points and the plurality of target points corresponding to the plurality of source control points;

[0011] Determine the offset corresponding to each pixel in the image to be corrected according to the mapping function;

[0012] The image to be corrected is corrected according to the offset corresponding to each pixel point in the image to be corrected to obtain a corrected image.

[0013] In some embodiments, the reference image and the image to be corrected include characteristic patterns, and selecting a plurality of source control points in the image to be corrected and a plurality of target points in the reference image includes:

[0014] Selecting the plurality of source control points in the image to be corrected;

[0015] The plurality of target points in the reference image corresponding one-to-one to the plurality of source control points are selected based on the characteristic pattern in the reference image, the characteristic pattern in the image to be corrected, and the plurality of source control points.

[0016] In some embodiments, selecting a plurality of source control points in the image to be corrected and a plurality of target points in the reference image includes:

[0017] Dividing the image to be corrected into a plurality of first image blocks;

[0018] randomly selecting at least one source control point in each of the first image blocks to obtain the plurality of source control points;

[0019] dividing the reference image into a plurality of second image blocks corresponding to the first image blocks;

[0020] For each source control point in the first image block, a corresponding target point is selected in the second image block corresponding to the first image block.

[0021] In some embodiments, the at least one mapping function includes a plurality of image block mapping functions, and determining, based on the plurality of source control points and the plurality of target points corresponding one-to-one to the plurality of source control points, the at least one mapping function representing a mapping relationship between pixels in the image to be corrected and corresponding pixels in the reference image includes:

[0022] Constructing a pending image block mapping function representing a mapping relationship between each first image block and the corresponding second image block, to obtain a plurality of the pending image block mapping functions, wherein the pending image block mapping function includes a pending rotation matrix and a pending translation matrix;

[0023] constructing a corresponding cost function according to the coordinates of all source control points in each of the first image blocks, the target points corresponding to all the source control points in each of the first image blocks, and the undetermined image block mapping function corresponding to each of the first image blocks;

[0024] A rotation matrix and a translation matrix in the undetermined image block mapping function that minimizes the value of the cost function are determined based on the cost function, the coordinates of all source control points in each of the first image blocks, and the coordinates of the target points corresponding to all the source control points, to obtain a final image block mapping function corresponding to each of the first image blocks.

[0025] In some embodiments, constructing a corresponding cost function according to the coordinates of all source control points in each of the first image blocks, the target points corresponding to all the source control points in each of the first image blocks, and the undetermined image block mapping function corresponding to each of the first image blocks includes:

[0026] Calculating the distance from each source control point to the preset calculation point according to the coordinates of the source control point in each first image block and the coordinates of the preset calculation point;

[0027] determining a weight coefficient of each source control point in the first image block according to a distance from each source control point to the preset calculation point and a smoothing coefficient;

[0028] A corresponding cost function is constructed according to the coordinates of all source control points in each of the first image blocks, the target points corresponding to all the source control points in each of the first image blocks, the weight coefficients of all the source control points in each of the first image blocks, and the undetermined image block mapping function corresponding to each of the first image blocks.

[0029] In some embodiments, the first image block has at least one corresponding calculation point, the at least one calculation point includes a representative point of the first image block, the offset includes an offset on a first coordinate axis and an offset on a second coordinate axis, and determining the offset corresponding to each pixel in the image to be corrected according to the mapping function includes:

[0030] determining the coordinates of a mapping point corresponding to a representative point of each first image block according to a final image block mapping function corresponding to each first image block;

[0031] Subtract the coordinate on the first coordinate axis of the representative point from the coordinate on the first coordinate axis of the mapping point corresponding to the representative point to obtain an offset on the first coordinate axis corresponding to the representative point;

[0032] Subtract the coordinate on the second coordinate axis of the representative point from the coordinate on the second coordinate axis of the mapping point corresponding to the representative point to obtain an offset on the second coordinate axis corresponding to the representative point;

[0033] Obtaining offsets corresponding to all calculation points corresponding to all first image blocks according to the offset corresponding to the representative point of each first image block;

[0034] The offsets corresponding to the other pixel points in the image to be corrected except the plurality of the calculation points are calculated according to the offsets corresponding to all the calculation points corresponding to each of the first image blocks.

[0035] In some embodiments, the first image block includes a first calculation point, a second calculation point, a third calculation point, and a fourth calculation point, and calculating the offsets corresponding to other pixel points in the to-be-corrected image except for the plurality of calculation points based on the offsets corresponding to all the calculation points corresponding to each of the first image blocks includes:

[0036] determining an offset corresponding to each pixel point in the first image block except for the representative point of the first image block according to the coordinates of the first calculation point and the corresponding first offset corresponding to the first image block where each pixel point is located, the coordinates of the second calculation point and the corresponding second offset, the coordinates of the third calculation point and the corresponding third offset, the coordinates of the fourth calculation point and the corresponding fourth offset, and the coordinates of each pixel point;

[0037] The offsets corresponding to the other pixel points in the image to be corrected except the plurality of calculation points are obtained based on the offset corresponding to each pixel point in the first image block.

[0038] In some embodiments, determining the offset corresponding to each pixel point in the first image block other than the representative point of the first image block based on the coordinates of the first calculation point and the corresponding first offset corresponding to the first image block where each pixel point is located, the coordinates of the second calculation point and the corresponding second offset, the coordinates of the third calculation point and the corresponding third offset, the coordinates of the fourth calculation point and the corresponding fourth offset, and the coordinates of each pixel point includes:

[0039] Determine a first weight, a second weight, a third weight, and a fourth weight based on the coordinates of each pixel point, the coordinates of the first calculation point corresponding to the first image block where each pixel point is located, the coordinates of the second calculation point, the coordinates of the third calculation point, and the coordinates of the fourth calculation point;

[0040] The first weight multiplied by the first offset, the second weight multiplied by the second offset, the third weight multiplied by the third offset, and the fourth weight multiplied by the fourth offset are summed as the corresponding offset of each of the pixel points in the first image block except the representative point of the first image block.

[0041] In some embodiments, the offset includes an offset on a first coordinate axis and an offset on a second coordinate axis, and determining the offset corresponding to each pixel in the image to be corrected according to the mapping function includes:

[0042] Determine the mapping point corresponding to each pixel according to the mapping function;

[0043] Subtract the coordinate on the first coordinate axis of each pixel point from the coordinate on the first coordinate axis of the mapping point corresponding to each pixel point to obtain an offset on the first coordinate axis corresponding to each pixel point;

[0044] The coordinate on the second coordinate axis of each pixel point is subtracted from the coordinate on the second coordinate axis of the mapping point corresponding to each pixel point to obtain an offset on the second coordinate axis corresponding to each pixel point.

[0045] In a second aspect, an embodiment of the present application provides an electronic device, comprising:

[0046] at least one processor; and,

[0047] a memory communicatively connected to the at least one processor; wherein,

[0048] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the image correction method as described in the first aspect.

[0049] The present application provides an image correction method and an electronic device. The present application determines at least one mapping function representing the mapping relationship between pixel points in the image to be corrected and corresponding pixel points in the reference image based on multiple source control points and multiple target points. The present application can determine at least one mapping function based on multiple pixel pairs. Compared with the correction method based on the mapping relationship between the planes where the two images are located, the present application can retain the accurate depth information of the image to be corrected, thereby accurately correcting the image to be corrected with depth parallax. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] Figure 1 It is a flowchart of the image correction method provided in an embodiment of the present application.

[0051] Figure 2 yes Figure 1 Detailed flowchart of step S200.

[0052] Figure 3 3 is a schematic diagram of a plurality of first image blocks obtained by dividing the image to be corrected.

[0053] Figure 4 yes Figure 1 Detailed flowchart of step S300.

[0054] Figure 5 yes Figure 1 Detailed flow chart of step S400.

[0055] Figure 6A 3 is a schematic diagram of the second image before correction provided in an embodiment of the present application.

[0056] Figure 6B is a schematic diagram of the corrected second image provided in an embodiment of the present application.

[0057] Figure 7 This is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0058] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only 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.

[0059] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of the technical features being referred to. Thus, a feature identified as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, "plurality" means two or more, unless otherwise specifically defined.

[0060] The present application provides an image correction method and an electronic device. The present application determines at least one mapping function representing the mapping relationship between pixel points in the image to be corrected and corresponding pixel points in the reference image based on multiple source control points and multiple target points. The present application can determine at least one mapping function based on multiple pixel pairs. Compared with the correction method based on the mapping relationship between the planes where the two images are located, the present application can retain the accurate depth information of the image to be corrected, thereby accurately correcting the image to be corrected with depth parallax.

[0061] The image correction method provided by this application will be described in detail below with reference to the accompanying drawings.

[0062] See also Figure 1 , Figure 1 Schematic diagram of the image correction method provided in the embodiment of the present application. Figure 1 As shown, the image correction method includes: steps S100 to S500.

[0063] Step S100: Acquire a reference image and an image to be corrected.

[0064] In some embodiments, a reference camera is used to capture the target object at a fixed position to obtain a first image; and a camera to be calibrated is used to capture the target object at the fixed position to obtain a second image.

[0065] Optionally, the reference camera device and the camera device to be calibrated are of the same model.

[0066] Optionally, the first image and the second image are of the same size.

[0067] Optionally, the target object may be any object, such as a denture model or a cup.

[0068] Optionally, the target object is a calibration plate. In this way, it is possible to facilitate subsequent selection of target points in the reference image corresponding to source control points in the image to be corrected based on characteristic patterns of the calibration plate in the image.

[0069] In some embodiments, the first image is a reference image, the second image is an image to be corrected, and both the first image and the second image are single-channel images, which only include one channel component image.

[0070] In some embodiments, both the first image and the second image are multi-channel images.

[0071] Optionally, the multi-channel image includes multiple channel component images.

[0072] Optionally, the multi-channel image is an RGB (Red, Green, Blue) image, and the RGB image includes a red channel component image, a green channel component image, and a blue channel component image.

[0073] Optionally, the single-channel image is any one of a red channel component image, a green channel component image, and a blue channel component image in an RGB image.

[0074] Optionally, the multi-channel image is an HSV (Hue, Saturation, Value) image, and the HSV image includes a hue channel component image, a saturation channel component image, and a brightness channel component image.

[0075] Optionally, the single-channel image is any one of a hue channel component image, a saturation channel component image, and a brightness channel component image in the HSV image.

[0076] In some embodiments, the reference image is a channel component image in the first image, and the image to be corrected is a channel component image in the second image corresponding to the channel component of the reference image. For example, the reference image is a red channel component image in the first image, and the image to be corrected is a red channel component image in the second image.

[0077] In some embodiments, a color separation prism of the imaging device to be calibrated is used to capture multiple channel component images, and then the multiple channel component images are merged to obtain a final captured image. However, the multiple channel component images captured by the imaging device to be calibrated may be distorted to varying degrees, and thus the final captured image may exhibit chromatic aberration, which may affect subsequent image processing.

[0078] In some embodiments, the image correction method of the present application is used to correct each channel component image in the second image separately, and the multiple corrected channel component images are combined to obtain a corrected second image. In this way, the corrected second image can be free of dispersion, thereby improving the accuracy of subsequent image processing.

[0079] Step S200: selecting a plurality of source control points in the image to be corrected and a plurality of target points in the reference image.

[0080] Among them, the source control points correspond one to one with the target points.

[0081] Optionally, the target point is considered to be the same pixel as the source control point in the real world.

[0082] For example, the position of the source control point on the first calibration plate when acquiring the image to be corrected and the position of the target point on the second calibration plate when acquiring the reference image are considered to be the same.

[0083] In some embodiments, the reference image and the image to be corrected include characteristic patterns.

[0084] Optionally, the characteristic pattern refers to a significant visual element that can identify and distinguish different objects from an image.

[0085] Optionally, the characteristic pattern is a pattern on a calibration plate.

[0086] Optionally, step S200 includes the following steps.

[0087] (1) Select multiple source control points in the image to be corrected.

[0088] Optionally, multiple source control points are randomly selected in the image to be corrected. In this way, multiple pairs of source control points and target points can be evenly distributed, so that at least one mapping function determined subsequently can better represent the mapping relationship between pixels in the image to be corrected and corresponding pixels in the reference image.

[0089] Optionally, the number of the multiple source control points is greater than 3, for example, 3, 4, 5, 6, 10, 16, 32, 64, 100 or 1000.

[0090] (2) Based on the characteristic pattern in the reference image, the characteristic pattern in the image to be corrected, and the plurality of source control points, a plurality of target points in the reference image corresponding one-to-one to the plurality of source control points are selected.

[0091] Optionally, according to a first characteristic position of the source control point in the characteristic pattern in the image to be corrected, a pixel point at a position corresponding to the first characteristic position in the characteristic pattern is selected in the reference image as a target point corresponding to the source control point.

[0092] It should be noted that because images captured by each camera may exhibit varying degrees of distortion, the target point is not necessarily a pixel with the same coordinates as the source control point in the reference image. Rather, it is a pixel with the same characteristics as the source control point. For example, if the source control point is located at the center of a circular pattern, the center pixel of the corresponding circular pattern in the reference image is selected as the target point corresponding to the source control point.

[0093] In some implementations, feature detection is performed on the image to be corrected and the reference image, and the matched feature point pairs are used as source control point and target point pairs, which are also pixel pairs.

[0094] In some embodiments, both the image to be corrected and the reference image are divided into multiple image blocks of equal size, and then multiple source control points in the image to be corrected and multiple target points in the reference image are selected. This method can further evenly distribute the multiple source control point and target point pairs, thereby enabling the at least one subsequently determined mapping function to better represent the mapping relationship between pixels in the image to be corrected and corresponding pixels in the reference image.

[0095] See also Figure 2 , Figure 2 yes Figure 1 Detailed flow chart of step S200. Figure 2 As shown, step S200 includes steps S210 to S240.

[0096] Step S210: Divide the image to be corrected into a plurality of first image blocks.

[0097] Optionally, the multiple first image blocks are of the same size.

[0098] Optionally, the number of the plurality of first image blocks is greater than 3, for example, 3, 4, 5, 6, 10, 16, 32 or 64, etc.

[0099] See also Figure 3 , Figure 3 is a schematic diagram of a plurality of first image blocks obtained by dividing the image to be corrected. Figure 3 As shown, in some embodiments, the image 1 to be corrected is divided into 9 first image blocks, and the 9 first image blocks include block 1, block 2, block 3, block 4, block 5, block 6, block 7, block 8 and block 9.

[0100] Step S220: randomly selecting at least one source control point in each first image block to obtain a plurality of source control points.

[0101] Step S230: Divide the reference image into a plurality of second image blocks corresponding to the first image blocks.

[0102] Optionally, the division rule of the second image block is the same as the division rule of the first image block.

[0103] Optionally, the size of the second image block is the same as that of the first image block.

[0104] Optionally, the number of the second image blocks is the same as the number of the first image blocks.

[0105] By adopting the above-mentioned method, it is possible to easily correspond the positions of the second image block to the first image block, thereby facilitating the subsequent selection of a corresponding target point in the second image block corresponding to the first image block.

[0106] Step S240: For each source control point in the first image block, a corresponding target point is selected in the second image block corresponding to the first image block.

[0107] Optionally, each pixel point in the second image block has a corresponding pixel point in the corresponding first image block, and the coordinates of the corresponding pixel points in the two image blocks are the same. For example, the pixel point with coordinates (1, 1) in the second image block also has coordinates (1, 1) for the corresponding pixel point in the first image block.

[0108] Optionally, a target point corresponding to the source control point in the reference image is selected based on the characteristic pattern in the reference image, the characteristic pattern in the image to be corrected, and the source control point, and the method is as described above.

[0109] Step S300: determining at least one mapping function representing a mapping relationship between pixel points in the image to be corrected and corresponding pixel points in the reference image according to a plurality of source control points and a plurality of target points corresponding to the plurality of source control points.

[0110] In some embodiments, the mapping function is a linear transformation function or a nonlinear transformation function.

[0111] In some implementations, the image to be corrected and the reference image are not divided into image blocks, and the number of mapping functions is one.

[0112] Through the above method, a mapping function can be determined based on multiple pixel pairs. Compared with the correction method based on the mapping relationship between the planes where the two images are located, the accurate depth information of the image to be corrected can be retained, thereby accurately correcting the image to be corrected with depth parallax.

[0113] In some embodiments, both the image to be corrected and the reference image are divided into multiple image blocks, each of which has a corresponding mapping function, with the number of mapping functions being the same as the number of first image blocks. In this way, correction can be performed separately on each first image block of the image to be corrected, i.e., the image to be corrected can be discretized before correction. This can better preserve the depth information of the image to be corrected during the correction process, thereby enabling more accurate correction of images to be corrected that have depth parallax.

[0114] See also Figure 4 , Figure 4 yes Figure 1 Detailed flow chart of step S300 in FIG. Figure 4 As shown, step S300 includes steps S310 to S330.

[0115] Step S310: constructing a pending image block mapping function that represents a mapping relationship between each first image block and the corresponding second image block, and obtaining a plurality of pending image block mapping functions.

[0116] The undetermined image block mapping function includes the undetermined rotation matrix and translation matrix.

[0117] In some embodiments, the mapping relationship between each first image block and the corresponding second image block is considered to be a rigid body transformation relationship.

[0118] In some implementations, the formula for the to-be-determined image block mapping function is: ,in, A mapping point representing a source control point, represents the source control point, represents the rotation matrix, Represents the translation matrix.

[0119] Step S320: constructing a corresponding cost function according to the coordinates of all source control points in each first image block, the target points corresponding to all source control points in each first image block, and the undetermined image block mapping function corresponding to each first image block.

[0120] In some embodiments, step S320 includes the following steps.

[0121] (1) Calculating the distance from each source control point to the preset calculation point according to the coordinates of the source control point in each first image block and the coordinates of the preset calculation point.

[0122] Optionally, the preset calculation point is any point in the image to be corrected.

[0123] Optionally, the preset calculation point is a representative point of the first image block where the source control point is located.

[0124] Optionally, each first image block has a representative point in the first image block.

[0125] Optionally, the representative point of the first image block is any one of the four corner points of the first image block.

[0126] Optionally, the representative point of the first image block is any one of the upper left corner point, the lower left corner point, the upper right corner point and the lower right corner point of the first image block.

[0127] like Figure 3 As shown, optionally, the representative point of block 1 is point A.

[0128] Optionally, the representative point of each first image block has the same position within the first image block. For example, the representative point of each first image block is the upper left corner point of the first image block.

[0129] like Figure 3 As shown, optionally, when the representative point of block 1 is point A, the representative point of block 2 is point E, the representative point of block 3 is point J, and so on for the representative points of other blocks.

[0130] (2) Determine the weight coefficient of each source control point in the first image block according to the distance from each source control point to the preset calculation point and the smoothing coefficient.

[0131] In some implementations, the formula for calculating the weight coefficient of a source control point is:

[0132] ,

[0133] in, Indicates the The weight of the source control point, Indicates the Source control points, Indicates the preset calculation point, Indicates the The distance from the source control point to the preset calculation point, represents the smoothing coefficient.

[0134] (3) Constructing a corresponding cost function according to the coordinates of all source control points in each first image block, the target points corresponding to all source control points in each first image block, the weight coefficients of all source control points in each first image block, and the undetermined image block mapping function corresponding to each first image block.

[0135] In some embodiments, an initial cost function is constructed based on a point pair of a source control point and a target point in the first image block. The formula of the initial cost function is:

[0136] ,

[0137] in, Indicates the The mapping points of the source control points, Indicates the The target point corresponding to each source control point. and is a row vector.

[0138] According to the formula of the undetermined image block mapping function: ,get .

[0139] In the above way, the mapping function ensures that Direct one-to-one mapping to , the mapping function is smooth and consistent, so that the image to be corrected can be accurately corrected subsequently through the mapping function.

[0140] In order to simplify the solution process, it is known that when the initial cost function reaches its extreme value, the first-order derivative of the initial cost function is 0, so the initial cost function is solved. After taking the partial derivative, we get the first-order derivative , that is , the solution is ,in , and is the weight center. Eliminate in the undetermined image block mapping function Afterwards , the initial cost function is simplified to ,in .

[0141] In some embodiments, the initial cost function is vectorized according to all pairs of source control points and target points in the first image block to obtain a final cost function.

[0142] Optionally, the final cost function is formulated as:

[0143] ,

[0144] in, , , , 、 and All are matrices.

[0145] Please return to Figure 4 Step S330: Determine the rotation matrix and translation matrix in the undetermined image block mapping function that minimizes the cost function based on the cost function, the coordinates of all source control points in each first image block, and the coordinates of the target points corresponding to all the source control points, and obtain the final image block mapping function corresponding to each first image block.

[0146] In some embodiments, to minimize the final cost function, it is necessary to use the normal equation method to solve the least squares problem, which can be obtained , so , and Indicates the serial number of the source control point. have to ,in , due to the rigid body transformation is an orthogonal matrix, satisfying , assuming Can be divided into two column vectors ,but ,in is to make The two-dimensional vector operator of Zhong Ke De ,in .

[0147] At this point, the formula for the final image block mapping function of the first image block can be obtained as follows:

[0148] ,in, .

[0149] Please return to Figure 1 , step S400: determining the offset corresponding to each pixel point in the image to be corrected according to the mapping function.

[0150] In some embodiments, the first image block has a corresponding at least one calculation point.

[0151] Optionally, the number of the at least one calculation point is 1, 2, 3, 4 or 8, etc.

[0152] In some embodiments, the at least one calculated point corresponding to the first image block includes a representative point of the first image block.

[0153] In some embodiments, the at least one calculated point further includes representative points of other first image blocks adjacent to the current first image block.

[0154] In some embodiments, the offset includes an offset on a first coordinate axis and an offset on a second coordinate axis.

[0155] Optionally, the first coordinate axis is perpendicular to the second coordinate axis.

[0156] Optionally, the first coordinate axis is one of the X axis and the Y axis, and the second coordinate axis is the other one of the X axis and the Y axis that is different from the first coordinate axis.

[0157] See also Figure 5 , Figure 5 yes Figure 1 Detailed flow chart of step S400 in FIG. Figure 5 As shown, in some embodiments, step S400 includes steps S410 to S450.

[0158] Step S410: determining the coordinates of the mapping point corresponding to the representative point of each first image block according to the final image block mapping function corresponding to each first image block.

[0159] As described above, each first image block has a corresponding final image block mapping function.

[0160] In some implementations, the coordinates of the representative point are substituted into the final image block mapping function of the current first image block to obtain the coordinates of the mapping point corresponding to the representative point.

[0161] like Figure 3 As shown, for example, point A is the representative point of block 1. Substitute the coordinates of point A into the final image block mapping function of block 1 to obtain the coordinates of the mapping point corresponding to point A. For example, point E is the representative point of block 2. Substitute the coordinates of point E into the final image block mapping function of block 2 to obtain the coordinates of the mapping point corresponding to point E. Point F is the representative point of block 4. Substitute the coordinates of point F into the final image block mapping function of block 4 to obtain the coordinates of the mapping point corresponding to point F. Point G is the representative point of block 5. Substitute the coordinates of point G into the final image block mapping function of block 5 to obtain the coordinates of the mapping point corresponding to point G. The calculation of the coordinates of the mapping points corresponding to other representative points refers to the above description.

[0162] Step S420: subtract the coordinate on the first coordinate axis of the representative point from the coordinate on the first coordinate axis of the mapping point corresponding to the representative point to obtain an offset on the first coordinate axis corresponding to the representative point.

[0163] Step S430: subtract the coordinate on the second coordinate axis of the representative point from the coordinate on the second coordinate axis of the mapping point corresponding to the representative point to obtain an offset on the second coordinate axis corresponding to the representative point.

[0164] Step S440: Obtain the offsets corresponding to all calculation points corresponding to all first image blocks according to the offset corresponding to the representative point of each first image block.

[0165] In some implementations, the first image block corresponds to four calculation points, and the calculation points corresponding to the first image block include a first calculation point, a second calculation point, a third calculation point, and a fourth calculation point.

[0166] Optionally, the representative point of the current first image block is used as the first calculation point of the current first image block, and the representative points of multiple first image blocks adjacent to the current first image block are selected as the second calculation point, the third calculation point and the fourth calculation point respectively.

[0167] In some embodiments, the first calculation point, the second calculation point, the third calculation point, and the fourth calculation point of the current first image block satisfy: all pixel points in the current first image block are located within a rectangle formed by the first calculation point, the second calculation point, the third calculation point, and the fourth calculation point (including the edges of the rectangle).

[0168] like Figure 3 As shown, optionally, the representative point of block 1 is point A, the representative point of block 2 is point E, the representative point of block 4 is point F, and the representative point of block 5 is point G. Then point A is the first calculation point of block 1, point E is selected as the second calculation point of block 1, point F is the third calculation point of block 1, and point G is the fourth calculation point of block 1.

[0169] In some embodiments, the first calculation point, the second calculation point, the third calculation point, and the fourth calculation point of the current first image block satisfy: a row or a column of pixel points in the current first image block is located on an edge of a rectangle formed by the first calculation point, the second calculation point, the third calculation point, and the fourth calculation point.

[0170] like Figure 3 As shown, optionally, the representative point of block 7 is point O, then point O is the first calculation point of block 7, point F is selected as the second calculation point of block 7, point G is the third calculation point of block 7, and point P is the fourth calculation point of block 6.

[0171] like Figure 3As shown, optionally, the representative point of block 8 is point P, the representative point of block 6 is point K, and the representative point of block 9 is point L, then point P is the first calculation point of block 8, point G is selected as the second calculation point of block 8, point K is the third calculation point of block 8, and point L is the fourth calculation point of block 8.

[0172] like Figure 3 As shown, optionally, the representative point of block 3 is point J, then point J is the first calculation point of block 3, point E is selected as the second calculation point of block 3, point G is the third calculation point of block 3, and point K is the fourth calculation point of block 3.

[0173] like Figure 3 As shown, optionally, the representative point of block 6 is point K, the representative point of block 8 is point P, and the representative point of block 9 is point L, then point K is the first calculation point of block 6, point G is selected as the second calculation point of block 6, point P is the third calculation point of block 6, and point L is the fourth calculation point of block 6.

[0174] In some implementations, the first image block corresponds to one calculation point, and a representative point of the first image block is used as the calculation point corresponding to the first image block.

[0175] like Figure 3 As shown, optionally, the representative point of block 9 is point H, and point H is used as the calculation point of block 9.

[0176] The offset corresponding to the representative point of each first image block has been obtained above, so the offsets corresponding to all calculation points corresponding to all first image blocks can be obtained.

[0177] Step S450: Calculate the offsets corresponding to other pixel points in the image to be corrected except for the multiple calculation points according to the offsets corresponding to all the calculation points corresponding to each first image block.

[0178] In some embodiments, an interpolation method is used to calculate the offsets corresponding to other pixel points in the image to be corrected except for the multiple calculation points based on the offsets corresponding to all calculation points corresponding to each first image block.

[0179] Optionally, the interpolation method includes a bilinear interpolation method, a linear interpolation method, a nearest neighbor interpolation method, a bicubic interpolation method, and the like.

[0180] As described above, in some embodiments, the first image block includes a first calculation point, a second calculation point, a third calculation point, and a fourth calculation point.

[0181] In some embodiments, the offset corresponding to each pixel point in the first image block except the representative point of the first image block is determined based on the coordinates of the first calculation point corresponding to the first image block where each pixel point is located and the corresponding first offset, the coordinates of the second calculation point and the corresponding second offset, the coordinates of the third calculation point and the corresponding third offset, the coordinates of the fourth calculation point and the corresponding fourth offset, and the coordinates of each pixel point.

[0182] Optionally, the interpolation method is a bilinear interpolation method.

[0183] In some embodiments, when the first calculation point, the second calculation point, the third calculation point, and the fourth calculation point of the first image block satisfy the following conditions: all pixel points in the current first image block are located within a rectangle formed by the first calculation point, the second calculation point, the third calculation point, and the fourth calculation point (including the edges of the rectangle), a bilinear interpolation method is used to calculate the offsets corresponding to the other pixel points in the current first image block except the representative point based on the offsets corresponding to all the calculation points corresponding to the current first image block.

[0184] like Figure 3 As shown, optionally, a bilinear interpolation method is used to calculate the offsets corresponding to the pixel points other than the calculation point in block 1, block 2, block 4 and block 5.

[0185] In some implementations, when the interpolation method is a bilinear interpolation method, step S450 includes the following steps.

[0186] (1) Determine a first weight, a second weight, a third weight, and a fourth weight based on the coordinates of each pixel point, the coordinates of a first calculation point corresponding to the first image block where each pixel point is located, the coordinates of a second calculation point, the coordinates of a third calculation point, and the coordinates of a fourth calculation point.

[0187] Optionally, the coordinates of the current pixel are expressed as ( , ), the coordinates of the first calculation point corresponding to the first image block where the current pixel is located are expressed as ( , ), the coordinates of the second calculated point are ( , ), the coordinates of the third calculation point are expressed as ( , ), the coordinates of the fourth calculation point are expressed as ( , It is understood that the coordinate representation of each calculation point here is only an example and does not limit the position or order of each calculation point.

[0188] Optionally, the calculation formula of the first weight is: .

[0189] Optionally, the calculation formula of the second weight is: .

[0190] Optionally, the calculation formula of the third weight is: .

[0191] Optionally, the calculation formula of the fourth weight is: .

[0192] (2) The sum of the first weight multiplied by the first offset, the second weight multiplied by the second offset, the third weight multiplied by the third offset, and the fourth weight multiplied by the fourth offset is used as the corresponding offset of each pixel point in the first image block except the representative point of the first image block.

[0193] In some embodiments, the offsets corresponding to the other pixel points in the image to be corrected except for the multiple calculation points are obtained based on the offset corresponding to each pixel point in the first image block.

[0194] In some embodiments, when the first, second, third, and fourth calculation points of the first image block satisfy the following condition: a row or column of pixels within the current first image block is located on an edge of a rectangle formed by the first, second, third, and fourth calculation points, a bilinear interpolation method is first used to calculate the offsets corresponding to the pixels in the row or column of pixels within the current first image block, excluding the calculation points, based on the offsets corresponding to all calculation points corresponding to the current first image block. The offsets of the remaining pixels within the current first image block are then calculated. In this case, step S450 includes the following steps.

[0195] (1) The bilinear interpolation method described above is used to calculate the offsets corresponding to the pixel points in a row or a column of pixels in the first image block except for the calculation point.

[0196] like Figure 3 As shown, optionally, the bilinear interpolation method as described above is used to calculate the offsets corresponding to the pixel points other than point J in a column of pixel points where point J and point R of block 3 are located.

[0197] like Figure 3 As shown, optionally, the bilinear interpolation method as described above is used to calculate the offsets corresponding to the pixel points other than point K in a column of pixel points where point K and point M of block 6 are located.

[0198] like Figure 3 As shown, optionally, the bilinear interpolation method as described above is used to calculate the offset corresponding to the pixel points other than point O in the row of pixel points where point O and point T of block 7 are located. Figure 3As shown, optionally, the bilinear interpolation method as described above is used to calculate the offsets corresponding to the pixel points other than point P in a row of pixel points where point P and point S of block 8 are located.

[0199] (2) Using a linear interpolation method, the offsets of other pixels in the first image block are calculated based on the offsets of a row or a column of pixels in the first image block.

[0200] Optionally, the current pixel coordinates are expressed as ,in Indicates the OK, Indicates the List.

[0201] In some embodiments, for each column of pixels in block 3 or block 6 where the offset is not calculated, the calculation formula for the offset of the current pixel is:

[0202] ,

[0203] in, Indicates the offset corresponding to the current pixel point, Indicates the offset of the current pixel on the x-axis. Indicates the offset of the current pixel on the y-axis. Indicates the Rank The offset corresponding to the pixel point of the column, Indicates the Rank The offset corresponding to the pixel point of the column. At this time, the current pixel point does not belong to the pixel points that have obtained the offset, and the column number of the current pixel point is greater than the column number of the pixel points that have obtained the offset.

[0204] In some embodiments, for each row of pixels in block 7 or block 8 where the offset is not calculated, the calculation formula for the offset of the current pixel is:

[0205] ,

[0206] in, Indicates the Rank The offset corresponding to the pixel point of the column, Indicates the Rank The offset corresponding to the pixel point of the column. At this time, the current pixel point does not belong to the pixel points that have obtained the offset, and the row number of the current pixel point is greater than the row number of the pixel points that have obtained the offset.

[0207] In some embodiments, when the first image block has only the representative point of the current first image block as the calculation point, the offset corresponding to other pixel points in the image to be corrected except for multiple calculation points is obtained based on the offset corresponding to each pixel point in the first image block, and step S450 includes the following steps.

[0208] (1) Determine the offset corresponding to the pixel points in other first image blocks adjacent to the current first image block.

[0209] like Figure 3 As shown, block 9 has only the representative point L of block 9 as the calculation point. First, the offset corresponding to the pixel points in blocks 6 and 8 adjacent to block 9 is determined according to the method described above.

[0210] (2) Determine the offset corresponding to the pixel point in the current first image block according to the offset corresponding to the pixel points in other first image blocks adjacent to the current first image block.

[0211] In some implementations, for pixels other than point L in block 9, the calculation formula for the offset of the current pixel is:

[0212] ,

[0213] in, Indicates the Rank The offset corresponding to the pixel point of the column, Indicates the Rank The offset corresponding to the pixel point of the column, Indicates the Rank The offset corresponding to the pixel point of the column. At this time, the row number of the current pixel point is greater than the row number of point L, and the column number of the current pixel point is greater than the column number of point L.

[0214] The above method reduces the computational effort by eliminating the need to substitute each pixel into a mapping function to determine the offset. Furthermore, because each first image block has a corresponding mapping function, the offsets corresponding to pixels other than the plurality of calculated points in the image to be corrected can be calculated based on the offsets corresponding to all calculated points. This allows the offsets corresponding to pixels in the plurality of first image blocks to be linked, resulting in a smooth transition between the offsets of the pixels in the plurality of first image blocks, thereby improving the visual quality of the corrected image. In other words, the corrected image appears more natural.

[0215] In some embodiments, when a pixel point is not a representative point of the current first image block and is a corner point of the image to be corrected, the coordinates of the pixel point are substituted into the final image block mapping function of the first image block where the pixel point is located to obtain the coordinates of the mapping point corresponding to the pixel point.

[0216] like Figure 3 As shown, optionally, point H is not a representative point of block 9, but a corner point of the image 1 to be corrected. The coordinates of point H are substituted into the final image block mapping function of block 9 to obtain the coordinates of the corresponding mapping point of point H.

[0217] In some implementations, the image to be corrected may not be divided into a plurality of first image blocks, and step S400 includes the following steps.

[0218] (1) Determine the mapping point corresponding to each pixel according to the mapping function.

[0219] Optionally, each pixel point is substituted into a final mapping function corresponding to the first image block where the pixel point is located to obtain the coordinates of a mapping point corresponding to each pixel point.

[0220] (2) Subtract the coordinate of each pixel on the first coordinate axis from the coordinate of the mapping point corresponding to each pixel point to obtain the offset on the first coordinate axis corresponding to each pixel point.

[0221] (3) Subtract the coordinate of each pixel on the second coordinate axis from the coordinate of the mapping point corresponding to each pixel point to obtain the offset on the second coordinate axis corresponding to each pixel point.

[0222] Step S500: Correcting the image to be corrected according to the offset corresponding to each pixel point in the image to be corrected to obtain a corrected image.

[0223] In some implementations, the value of each pixel in the image to be corrected is added to the corresponding offset value to obtain a corrected image.

[0224] Optionally, the coordinate value of each pixel point in the image to be corrected on the first coordinate axis is added to the offset on the first coordinate axis, and the coordinate value on the second coordinate axis is added to the offset on the second coordinate axis to obtain the value of each pixel point after correction, thereby obtaining a corrected image.

[0225] In some embodiments, the image to be corrected is represented by a matrix of pixels, and the offsets corresponding to the multiple pixels form an offset matrix. The corrected image is obtained by adding the offset matrix to the image to be corrected.

[0226] As described above, the image correction method of the present application can be used to correct each channel component image in the second image separately, and multiple corrected channel component images can be merged to obtain a corrected second image, which can prevent the corrected second image from exhibiting dispersion, thereby improving the accuracy of subsequent image processing.

[0227] See also Figure 6A and Figure 6B , Figure 6A 3 is a schematic diagram of the second image before correction provided in an embodiment of the present application. Figure 6B is a schematic diagram of the corrected second image provided in the embodiment of the present application. Figure 6A As shown, the second image before correction has dispersion (in Figure 6A (reflected as shadows in the figure) because the multiple channel component images are not aligned. Figure 6B As shown, the corrected second image is very clear and has no dispersion.

[0228] In summary, the image correction method provided by the embodiments of the present application has the following advantages:

[0229] 1. By determining at least one mapping function representing a mapping relationship between pixel points in the image to be corrected and corresponding pixel points in the reference image based on multiple source control points and multiple target points, at least one mapping function can be determined based on multiple pixel pairs. Compared with a correction method based on a mapping relationship between planes where two images are located, accurate depth information of the image to be corrected can be retained, thereby accurately correcting the image to be corrected with depth parallax.

[0230] 2. By dividing both the image to be corrected and the reference image into multiple image blocks, multiple pairs of source control points and target points can be evenly distributed, so that at least one mapping function determined subsequently can better represent the mapping relationship between the pixel points in the image to be corrected and the corresponding pixel points in the reference image.

[0231] 3. By dividing the image to be corrected and the reference image into multiple image blocks, each image block having a corresponding mapping function, each first image block of the image to be corrected can be corrected separately, that is, the image to be corrected is discretized before correction, which can better retain the depth information of the image to be corrected during the correction process, thereby being able to more accurately correct the image to be corrected with depth parallax.

[0232] 4. By calculating the offsets corresponding to pixels other than the multiple calculated points in the image to be corrected based on the offsets corresponding to all calculated points corresponding to each first image block, first, no pixel needs to be substituted into a mapping function to calculate the offset, which can reduce the amount of calculation. Second, because each first image block has a corresponding mapping function, by calculating the offsets corresponding to pixels other than the multiple calculated points in the image to be corrected based on the offsets corresponding to all calculated points, the offsets corresponding to pixels in multiple first image blocks can be linked, resulting in a smooth transition of the offsets of the pixels in the multiple first image blocks, thereby improving the visual effect of the corrected image. In other words, making the corrected image appear more natural.

[0233] See also Figure 7 , Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 7 As shown, the electronic device 400 includes: one or more processors 410 and a memory 420, Figure 7 A processor 410 is taken as an example.

[0234] In some embodiments, the processor 410 and the memory 420 may be connected via a bus or other means. Figure 7 The bus connection is taken as an example.

[0235] In some embodiments, the processor 410 is configured to acquire a reference image and an image to be corrected;

[0236] Selecting a plurality of source control points in the image to be corrected and a plurality of target points in the reference image, wherein the source control points correspond one-to-one to the target points;

[0237] Determining at least one mapping function representing a mapping relationship between pixel points in the image to be corrected and corresponding pixel points in the reference image based on the plurality of source control points and the plurality of target points corresponding to the plurality of source control points;

[0238] Determine the offset corresponding to each pixel in the image to be corrected according to the mapping function;

[0239] The image to be corrected is corrected according to the offset corresponding to each pixel point in the image to be corrected to obtain a corrected image.

[0240] In some embodiments, memory 420, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as the program instructions / modules of the image correction method in the embodiments of the present application. Processor 410 executes the non-volatile software programs, instructions, and modules stored in memory 420 to execute various functional applications and data processing of electronic device 400, thereby implementing the image correction method of the above-mentioned method embodiment.

[0241] In some embodiments, the memory 420 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and applications required for at least one function; the data storage area may store data created based on the use of the electronic device, etc. In addition, the memory 420 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 420 may optionally include a memory remotely located relative to the processor 410, and these remote memories may be connected to the controller via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0242] In some embodiments, one or more modules are stored in the memory 420 and, when executed by one or more processors 410, perform the image correction method in any of the above method embodiments, for example, performing the above described Figure 1 Method steps S100 to S500.

[0243] In summary, the present application provides an image correction method and electronic device, which determines at least one mapping function representing the mapping relationship between pixel points in the image to be corrected and corresponding pixel points in the reference image based on multiple source control points and multiple target points. At least one mapping function can be determined based on multiple pixel pairs. Compared with the correction method based on the mapping relationship between the planes where the two images are located, the accurate depth information of the image to be corrected can be retained, thereby accurately correcting the image to be corrected with depth parallax.

[0244] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. An image correction method, characterized in that: include: Acquire a reference image and an image to be corrected; Selecting a plurality of source control points in the image to be corrected and a plurality of target points in the reference image, wherein the source control points correspond to the target points one-to-one; The selecting of a plurality of source control points in the image to be corrected and a plurality of target points in the reference image comprises: Dividing the image to be corrected into a plurality of first image blocks; randomly selecting at least one source control point in each of the first image blocks to obtain the plurality of source control points; dividing the reference image into a plurality of second image blocks corresponding to the first image blocks; For each source control point in the first image block, selecting a corresponding target point in the second image block corresponding to the first image block; Determining at least one mapping function representing a mapping relationship between pixel points in the image to be corrected and corresponding pixel points in the reference image based on the plurality of source control points and the plurality of target points corresponding to the plurality of source control points; The at least one mapping function includes a plurality of image block mapping functions, and determining, based on the plurality of source control points and the plurality of target points corresponding one-to-one to the plurality of source control points, the at least one mapping function representing a mapping relationship between pixel points in the image to be corrected and corresponding pixel points in the reference image includes: Constructing a pending image block mapping function representing a mapping relationship between each first image block and the corresponding second image block, to obtain a plurality of the pending image block mapping functions, wherein the pending image block mapping function includes a pending rotation matrix and a pending translation matrix; constructing a corresponding cost function according to the coordinates of all source control points in each of the first image blocks, the target points corresponding to all the source control points in each of the first image blocks, and the undetermined image block mapping function corresponding to each of the first image blocks; determining, based on the cost function, the coordinates of all source control points in each of the first image blocks, and the coordinates of the target points corresponding to all the source control points, a rotation matrix and a translation matrix in the undetermined image block mapping function that minimizes the value of the cost function, and obtaining a final image block mapping function corresponding to each of the first image blocks; Determine the offset corresponding to each pixel in the image to be corrected according to the mapping function; The first image block has at least one corresponding calculation point, the at least one calculation point includes a representative point of the first image block, the offset includes an offset on a first coordinate axis and an offset on a second coordinate axis, and determining the offset corresponding to each pixel in the image to be corrected according to the mapping function includes: determining the coordinates of a mapping point corresponding to a representative point of each first image block according to a final image block mapping function corresponding to each first image block; Subtract the coordinate on the first coordinate axis of the representative point from the coordinate on the first coordinate axis of the mapping point corresponding to the representative point to obtain an offset on the first coordinate axis corresponding to the representative point; Subtract the coordinate on the second coordinate axis of the representative point from the coordinate on the second coordinate axis of the mapping point corresponding to the representative point to obtain an offset on the second coordinate axis corresponding to the representative point; Obtaining offsets corresponding to all calculation points corresponding to all first image blocks according to the offset corresponding to the representative point of each first image block; Calculating offsets corresponding to other pixel points in the image to be corrected except for the plurality of calculation points according to the offsets corresponding to all calculation points corresponding to each of the first image blocks; The image to be corrected is corrected according to the offset corresponding to each pixel point in the image to be corrected to obtain a corrected image.

2. The image correction method according to claim 1, wherein: The reference image and the image to be corrected include characteristic patterns, and selecting a plurality of source control points in the image to be corrected and a plurality of target points in the reference image includes: Selecting the plurality of source control points in the image to be corrected; The plurality of target points in the reference image corresponding one-to-one to the plurality of source control points are selected based on the characteristic pattern in the reference image, the characteristic pattern in the image to be corrected, and the plurality of source control points.

3. The image correction method according to claim 1, wherein: The constructing a corresponding cost function according to the coordinates of all source control points in each of the first image blocks, the target points corresponding to all the source control points in each of the first image blocks, and the undetermined image block mapping function corresponding to each of the first image blocks includes: Calculating the distance from each source control point to the preset calculation point according to the coordinates of the source control point in each first image block and the coordinates of the preset calculation point; determining a weight coefficient of each source control point in the first image block according to a distance from each source control point to the preset calculation point and a smoothing coefficient; A corresponding cost function is constructed according to the coordinates of all source control points in each of the first image blocks, the target points corresponding to all the source control points in each of the first image blocks, the weight coefficients of all the source control points in each of the first image blocks, and the undetermined image block mapping function corresponding to each of the first image blocks.

4. The image correction method according to claim 1, wherein: The first image block includes a first calculation point, a second calculation point, a third calculation point, and a fourth calculation point, and calculating the offsets corresponding to other pixel points in the to-be-corrected image except for the plurality of calculation points according to the offsets corresponding to all the calculation points corresponding to each of the first image blocks, includes: determining an offset corresponding to each pixel point in the first image block except for the representative point of the first image block according to the coordinates of the first calculation point and the corresponding first offset corresponding to the first image block where each pixel point is located, the coordinates of the second calculation point and the corresponding second offset, the coordinates of the third calculation point and the corresponding third offset, the coordinates of the fourth calculation point and the corresponding fourth offset, and the coordinates of each pixel point; The offsets corresponding to the other pixel points in the image to be corrected except the plurality of calculation points are obtained based on the offset corresponding to each pixel point in the first image block.

5. The image correction method according to claim 4, characterized in that: The determining, based on the coordinates of the first calculation point and the corresponding first offset corresponding to the first image block where each pixel point is located, the coordinates of the second calculation point and the corresponding second offset, the coordinates of the third calculation point and the corresponding third offset, the coordinates of the fourth calculation point and the corresponding fourth offset, and the coordinates of each pixel point, comprising: Determine a first weight, a second weight, a third weight, and a fourth weight based on the coordinates of each pixel point, the coordinates of the first calculation point corresponding to the first image block where each pixel point is located, the coordinates of the second calculation point, the coordinates of the third calculation point, and the coordinates of the fourth calculation point; The first weight multiplied by the first offset, the second weight multiplied by the second offset, the third weight multiplied by the third offset, and the fourth weight multiplied by the fourth offset are summed as the corresponding offset of each of the pixel points in the first image block except the representative point of the first image block.

6. The image correction method according to claim 1, wherein: The offset includes an offset on a first coordinate axis and an offset on a second coordinate axis, and determining the offset corresponding to each pixel in the image to be corrected according to the mapping function includes: Determine the mapping point corresponding to each pixel according to the mapping function; Subtract the coordinate on the first coordinate axis of each pixel point from the coordinate on the first coordinate axis of the mapping point corresponding to each pixel point to obtain an offset on the first coordinate axis corresponding to each pixel point; The coordinate on the second coordinate axis of each pixel point is subtracted from the coordinate on the second coordinate axis of the mapping point corresponding to each pixel point to obtain an offset on the second coordinate axis corresponding to each pixel point.

7. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the image correction method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Thin-plate spline primary function optimization-based incomplete model local deformation recovery method

    CN107146208A

  • Image correction method and related equipment

    CN114693532A