Image processing method, image processing device, electronic equipment and storage medium

By performing super-pixel division and feature point processing on smartphone multi-camera images, a homography matrix is ​​generated, which solves the problem of improved image alignment accuracy and clarity, and achieves a more precise image alignment effect.

CN118644400APending Publication Date: 2024-09-13GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202310220369.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-08
Publication Date
2024-09-13

AI Technical Summary

Technical Problem

In image alignment technology, how to accurately align images output by multiple cameras, especially in smartphone photography, existing technology is difficult to effectively solve the problem of improving the accuracy and clarity of image alignment.

Method used

By dividing the first image into superpixels, the matching feature points are determined, divided into multiple planes to generate a homography matrix, the alignment residuals and weights are calculated, and then the homography matrix of the target superpixel area is determined to achieve image alignment.

Benefits of technology

It improves the accuracy and clarity of image alignment, avoids fault problems, and improves the smoothness of homography matrices in adjacent superpixel areas, reducing the impact of erroneous feature points within a single superpixel area.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118644400A
    Figure CN118644400A
Patent Text Reader

Abstract

The invention discloses an image processing method, an image processing device, electronic equipment and a computer readable storage medium. The image processing method comprises the following steps: carrying out superpixel division on a first image to obtain a plurality of superpixel regions; determining matching feature points between the first image and the second image; determining a calculation weight of the matched feature point according to the first alignment residual error and the second alignment residual error; and determining a homography matrix of the target super-pixel region according to the matched feature points and the calculation weight, wherein the homography matrix of the target super-pixel region is used for aligning the first image and the second image. In the technical scheme of the invention, the matching feature points are divided into the plurality of planes, so that the homography matrix of the target super-pixel region can be determined according to the relationship between the homography matrix of each plane and the matching feature points, the calculation of the homography matrix of the target super-pixel region can be ensured to be more accurate, and an accurate image alignment effect is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of image processing, and more specifically, to an image processing method, an image processing device, an electronic device, and a computer-readable storage medium. Background Art

[0002] In related technologies, image alignment technology is widely used in various computer vision tasks. In particular, the current smartphone photography has shown a development trend from single camera to dual camera and multi-camera. Through multi-camera zoom fusion, the images output by two cameras can be optimized and combined, thereby significantly improving the clarity of the final output image. How to accurately align images is a technical problem that needs to be solved in this field. Summary of the invention

[0003] Embodiments of the present application provide an image processing method, an image processing device, an electronic device, and a computer-readable storage medium.

[0004] An embodiment of the present application provides an image processing method, which includes: performing superpixel division on a first image to obtain multiple superpixel regions, wherein the multiple superpixel regions include a target superpixel region; determining matching feature points between the first image and the second image, wherein the first image and the second image correspond to the same shooting scene, and each of the superpixel regions includes at least one matching feature point; dividing the matching feature points into multiple planes and generating homography matrices for each of the planes; calculating a first alignment residual based on the homography matrices of each pair of the matching feature points and all the planes; calculating a second alignment residual based on the homography matrices of the matching feature points in the target superpixel region and all the planes; determining a calculation weight for the matching feature points based on the first alignment residual and the second alignment residual; determining a homography matrix for the target superpixel region based on the matching feature points and the calculation weight, wherein the homography matrix for the target superpixel region is used to align the first image and the second image.

[0005] An embodiment of the present application provides an image processing device, which includes: a first division module, a first determination module, a second division module, a first processing module, a second processing module, a second determination module and a third determination module. The first division module is used to perform superpixel division on the first image to obtain multiple superpixel areas, and the multiple superpixel areas include a target superpixel area; the first determination module is used to determine the matching feature points between the first image and the second image, the first image and the second image correspond to the same shooting scene, and each superpixel area includes at least one matching feature point; the second division module is used to divide the matching feature points into multiple planes and generate the homography matrix of each plane; the first processing module is used to calculate the first alignment residual according to each pair of the matching feature points and the homography matrix of all the planes; the second processing module is used to calculate the second alignment residual according to the matching feature points in the target superpixel area and the homography matrix of all the planes; the second determination module is used to determine the calculation weight of the matching feature points according to the first alignment residual and the second alignment residual; the third determination module is used to determine the homography matrix of the target superpixel area according to the matching feature points and the calculation weight, and the homography matrix of the target superpixel area is used to align the first image and the second image.

[0006] An embodiment of the present application provides an electronic device, which includes one or more processors and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the steps of the image processing method of the above embodiment are implemented.

[0007] An embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon. When the program is executed by a processor, the steps of the image processing method of the above embodiment are implemented.

[0008] In the image processing method, image processing device, electronic device and computer-readable storage medium of the present application, the matching feature points are divided into multiple planes, so that the homography matrix of the target superpixel area can be determined according to the relationship between the homography matrix and the matching feature points of each plane, which can ensure that the calculation of the homography matrix of the target superpixel area is more accurate, thereby achieving an accurate image alignment effect. When calculating the homography matrix of the target superpixel area, the influence of all matching feature points on the homography matrix of the target superpixel area is considered to avoid the fault problem after image alignment mapping, and the smoothness of the homography matrix of the adjacent superpixel area can be improved. At the same time, it is not easily affected by the wrong matching feature points in a single superpixel area and cause homography matrix errors.

[0009] Additional aspects and advantages of the embodiments of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the embodiments of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:

[0011] Figure 1 is a flowchart of an image processing method of certain embodiments of the present application;

[0012] Figure 2 is a schematic diagram of an image processing device in some embodiments of the present application;

[0013] Figure 3 is a schematic diagram of an electronic device according to some embodiments of the present application;

[0014] Figure 4 is a flowchart of an image processing method of certain embodiments of the present application;

[0015] Figure 5 is a schematic diagram of dividing a first image into superpixel regions in certain embodiments of the present application;

[0016] Figure 6 is a flowchart of an image processing method of certain embodiments of the present application;

[0017] Figure 7 is a flowchart of an image processing method of certain embodiments of the present application;

[0018] Figure 8 is a schematic diagram of an image processing device in some embodiments of the present application;

[0019] Fig. 9 is a flowchart of an image processing method of certain embodiments of the present application;

[0020] Fig.10 is a schematic diagram of an image processing device in some embodiments of the present application;

[0021] Fig.11 is a flowchart of an image processing method of certain embodiments of the present application;

[0022] Fig.12 is a schematic diagram of plane division of certain embodiments of the present application;

[0023] Fig.13 is a flowchart of an image processing method of certain embodiments of the present application;

[0024] Fig.14is a flowchart of an image processing method of certain embodiments of the present application;

[0025] Fig.15 is a flowchart of an image processing method of certain embodiments of the present application;

[0026] Fig.16 is a flowchart of an image processing method of certain embodiments of the present application;

[0027] Fig.17 is a flowchart of an image processing method of certain embodiments of the present application;

[0028] Fig.18 is a schematic diagram of an image processing device in some embodiments of the present application;

[0029] Fig.19 is a flowchart of an image processing method of certain embodiments of the present application;

[0030] Fig. 20 is a schematic diagram of an image processing device in some embodiments of the present application;

[0031] Fig.21 It is a flowchart of the image processing method of certain embodiments of the present application. DETAILED DESCRIPTION

[0032] The embodiments of the present application are described in detail below, examples of the embodiments are shown in the drawings, and the same or similar reference numerals represent the same or similar elements or elements with the same or similar functions from beginning to end. The embodiments described below with reference to the drawings are exemplary and are only used to explain the present application, and cannot be understood as limiting the present application.

[0033] The disclosure below provides many different embodiments or examples to realize the different structures of the embodiments of the present application. In order to simplify the disclosure of the embodiments of the present application, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present application.

[0034] In related technologies, image alignment technology is widely used in various computer vision tasks. In particular, the current smartphone photography has shown a development trend from single camera to dual camera and multi-camera. Through multi-camera zoom fusion, the images output by two cameras can be optimized and combined, thereby significantly improving the clarity of the final output image. How to accurately align images is a technical problem that needs to be solved in this field.

[0035] See also Figure 1 The present application provides an image processing method, the image processing method comprising:

[0036] 001: performing superpixel division on the first image to obtain a plurality of superpixel regions, wherein the plurality of superpixel regions include a target superpixel region;

[0037] 002: Determine matching feature points between a first image and a second image, where the first image and the second image correspond to the same shooting scene, and each superpixel region includes at least one matching feature point;

[0038] 003: Divide the matching feature points into multiple planes and generate the homography matrix of each plane;

[0039] 004: Calculate the first alignment residual based on the homography matrix of each pair of matching feature points and all planes;

[0040] 005: Calculate the second alignment residual according to the homography matrix of the matching feature points and all planes in the target superpixel area;

[0041] 006: Determine the calculation weight of the matching feature points according to the first alignment residual and the second alignment residual;

[0042] 007: Determine a homography matrix of the target superpixel region according to the matched feature points and the calculated weights, and the homography matrix of the target superpixel region is used to align the first image and the second image.

[0043] See also Figure 2 An embodiment of the present application provides an image processing device 100, which includes a first division module 11, a first determination module 12, a second division module 13, a first processing module 14, a second processing module 15, a second determination module 16 and a third determination module 17.

[0044] The image processing method of the embodiment of the present application can be implemented by the image processing device 100 of the embodiment of the present application. Among them, step 001 can be implemented by the first division module 11, step 002 can be implemented by the first determination module 12, step 003 can be implemented by the second division module 13, step 004 can be implemented by the first processing module 14, step 005 can be implemented by the second processing module 15, step 006 can be implemented by the second determination module 16, and step 007 can be implemented by the third determination module 17. That is, the first division module 11 can be used to perform superpixel division on the first image to obtain multiple superpixel areas, and the multiple superpixel areas include a target superpixel area; the first determination module 12 can be used to determine the matching feature points between the first image and the second image, the first image and the second image correspond to the same shooting scene, and each superpixel area includes at least one matching feature point; the second division module 13 can be used to divide the matching feature points into multiple planes and generate the homography matrix of each plane; the first processing module 14 can be used to calculate the first alignment residual according to the homography matrix of each pair of matching feature points and all planes; the second processing module 15 can be used to calculate the second alignment residual according to the matching feature points in the target superpixel area and the homography matrix of all planes; the second determination module 16 can be used to determine the calculation weight of the matching feature points according to the first alignment residual and the second alignment residual; the third determination module 17 can be used to determine the homography matrix of the target superpixel area according to the matching feature points and the calculation weight, and the homography matrix of the target superpixel area is used to align the first image and the second image.

[0045] In the image processing method and image processing device 100 of the embodiment of the present application, the matching feature points are divided into multiple planes, so that the homography matrix of the target superpixel area can be determined according to the relationship between the homography matrix and the matching feature points of each plane, which can ensure that the calculation of the homography matrix of the target superpixel area is more accurate, thereby achieving an accurate image alignment effect. When calculating the homography matrix of the target superpixel area, the influence of all matching feature points on the homography matrix of the target superpixel area is considered to avoid the fault problem after image alignment mapping, and the smoothness of the homography matrix of the adjacent superpixel area can be improved. At the same time, it is not easy to be affected by the wrong matching feature points in a single superpixel area and cause homography matrix errors.

[0046] See also Figure 3 , the image processing device 100 can be applied to an electronic device 1000. The electronic device 1000 may include a smart phone, a tablet computer, a smart watch, a smart bracelet, etc., which are not specifically limited here. The electronic device 1000 of the embodiment of the present application is illustrated by taking a smart phone as an example, which cannot be understood as a limitation of the present application.

[0047] Step 001 performs superpixel division on the first image to obtain a plurality of superpixel regions, wherein the plurality of superpixel regions include a target superpixel region. Specifically, before determining matching feature points between the first image and the second image, the first image is superpixel divided to obtain a plurality of superpixel regions, wherein the plurality of superpixel regions include a target superpixel region.

[0048] In this way, by performing superpixel division on the first image and obtaining a plurality of superpixel regions, a basis can be provided for determining matching feature points between the first image and the second image.

[0049] Step 002 determines the matching feature points between the first image and the second image, the first image and the second image correspond to the same shooting scene, and each superpixel region includes at least one matching feature point. Specifically, after obtaining multiple superpixel regions, the matching feature points between the first image and the second image can be determined, the first image and the second image correspond to the same shooting scene, and the same shooting scene includes dual-camera images captured by the camera, wherein the field of view of the first camera is greater than the field of view of the second camera, such as the image captured by the wide-angle camera as the first image, and the image captured by the telephoto camera as the second image. Each superpixel region includes at least one matching feature point.

[0050] In this way, by determining the matching feature points between the first image and the second image, preparation can be made for the subsequent generation of the homography matrix.

[0051] Step 003: Divide the matching feature points into multiple planes and generate homography matrices for each plane. Specifically, after the matching feature points between the first image and the second image are determined, the matching feature points may be divided into multiple planes and generate homography matrices for each plane.

[0052] In this way, by generating the homography matrix of each plane, preparation can be made for the subsequent calculation of the first alignment residual.

[0053] Step 004 calculates the first alignment residual according to the homography matrices of each pair of matching feature points and all planes. Specifically, after the homography matrices of each plane are generated, the first alignment residual can be calculated according to the homography matrices of each pair of matching feature points and all planes.

[0054] In this way, by completing the calculation of the first alignment residual, a basis can be provided for the subsequent determination of the matching feature point calculation weights.

[0055] Step 005 calculates the second alignment residual according to the homography matrices of the matching feature points in the target superpixel region and all planes. Specifically, after generating the homography matrices of each plane, the second alignment residual can be calculated according to the homography matrices of the matching feature points in the target superpixel region and all planes.

[0056] In this way, by completing the calculation of the second alignment residual, a basis can be provided for the subsequent determination of the matching feature point calculation weights.

[0057] Step 006 determines the calculation weight of the matching feature point according to the first alignment residual and the second alignment residual. Specifically, after the calculation of the first alignment residual and the second alignment residual is completed, the calculation weight of the matching feature point can be determined according to the first alignment residual and the second alignment residual.

[0058] In this way, by completing the determination of the calculation weights, preparation can be made for the subsequent determination of the homography matrix of the target superpixel area.

[0059] Step 007 determines the homography matrix of the target superpixel region according to the matching feature points and the calculation weights, and the homography matrix of the target superpixel region is used to align the first image and the second image. Specifically, after the calculation weights are determined, the homography matrix of the target superpixel region can be determined according to the matching feature points and the calculation weights, and the homography matrix of the target superpixel region is used to align the first image and the second image.

[0060] In this way, by determining the homography matrix of the target superpixel region, the first image and the second image can be aligned according to the homography matrix of the target superpixel region.

[0061] See also Figure 4 In some embodiments, step 001 (dividing the first image into superpixels to obtain a plurality of superpixel regions) includes:

[0062] 0011: Divide the first image into multiple superpixel regions based on pixel proximity information of the first image.

[0063] See also Figure 2 In some implementations, step 011 may be implemented by a first segmentation module 11. That is, the first segmentation module 11 may be used to segment the first image into a plurality of super-pixel regions based on pixel proximity information of the first image.

[0064] In this way, the first image can be divided into multiple super-pixel regions based on the pixel proximity information of the first image.

[0065] Specifically, before determining the matching feature points between the first image and the second image, the first image may be segmented into superpixels based on a simple linear iterative clustering (SLIC) superpixel segmentation algorithm, and the image may be divided into a plurality of superpixel regions based on pixel proximity information (grayscale similarity) of the first image. Figure 5 To set the blocking effect of 500 super pixel areas.

[0066] See also Figure 6 In some embodiments, step 002 (determining matching feature points between the first image and the second image) includes:

[0067] 0021: extracting feature points of the first image and feature points of the second image respectively;

[0068] 0022: Match feature points of the first image with feature points of the second image to determine matching feature points.

[0069] See also Figure 2 In some embodiments, step 0021 and step 0022 can be implemented by the first determination module 12. That is, the first determination module 12 can be used to: extract feature points of the first image and feature points of the second image respectively; match the feature points of the first image and the feature points of the second image to determine matching feature points.

[0070] In this way, by extracting and matching the feature points of the first image and the second image, the matching feature points between the first image and the second image can be determined.

[0071] Specifically, after obtaining multiple super-pixel regions, feature points are extracted for the first image and the second image to be matched, respectively, and methods such as SURF, HARRIS, and SIFT can be used. It is necessary to ensure that each super-pixel region contains at least one feature point. Then the detected feature points are matched, and the matching method is not limited to matching based on the descriptor of the feature points, or tracking the feature points in another image using an optical flow algorithm (such as the LK algorithm) for the position of the feature points in a single image, and obtaining the matching relationship between the feature points in the two images to determine the matching feature points.

[0072] See also Figure 7 In some embodiments, the image processing method further comprises:

[0073] 008: Screen the matching feature points to remove erroneous matching feature points and / or redundant matching feature points.

[0074] See also Figure 8 In some embodiments, the image processing device 100 includes a third processing module 18, and step 008 can be implemented by the third processing module 18. That is, the third processing module 18 can be used to screen the matching feature points to remove erroneous matching feature points and / or redundant matching feature points.

[0075] In this way, by screening the matching feature points, the number of feature points in the image texture area can be guaranteed, and accurate matching feature points can be obtained.

[0076] Specifically, after the determination of the matching feature points between the first image and the second image is completed, in order to filter out the feature points that are incorrectly matched, the matching feature points need to be further screened. RANSAC (an algorithm that calculates the mathematical model parameters of the data based on a set of sample data sets containing abnormal data to obtain valid sample data) can be used to estimate the basic matrix of the matching feature points, and the feature points that exceed the threshold are removed. In addition, in order to improve the computational efficiency of subsequent modules, a feature point homogenization method can be selectively added here, which is not limited to SSC, Harris response non-maximum suppression, etc. By further screening the feature points through the feature point homogenization method, redundant feature points can be removed as much as possible.

[0077] See also Fig. 9 In some embodiments, the image processing method further comprises:

[0078] 009: When the superpixel region does not include a matching feature point, extract the feature points of the first image and the feature points of the second image again, and match the feature points of the first image and the feature points of the second image so that each superpixel region includes at least one matching feature point.

[0079] See also Fig.10 In some embodiments, the image processing device 100 includes a fourth processing module 19, and step 009 can be implemented by the fourth processing module 19. That is, the fourth processing module 19 can be used to extract feature points of the first image and feature points of the second image again when no matching feature points are included in the superpixel region, and match the feature points of the first image and the feature points of the second image so that each superpixel region includes at least one matching feature point.

[0080] In this way, by ensuring that each superpixel region includes at least one matching feature point, a basis can be provided for the subsequent generation of the homography matrix of each plane.

[0081] Specifically, after the feature point screening, it is still necessary to ensure that there is at least one pair of matching feature points in each superpixel region. If not, it is necessary to repeat the above steps 0021 and 0022 to extract and match feature points for the superpixel region lacking matching feature points, so that each superpixel region includes at least one matching feature point.

[0082] See also Fig.11 In some embodiments, step 003 (dividing the matching feature points into multiple planes and generating homography matrices for each plane) includes the following steps:

[0083] 0031: Determine the homography matrix of the current plane according to the current matching feature points, and the plane includes the current plane;

[0084] 0032: Calculate the current projection error based on the homography matrix of each pair of current matching feature points and the current plane;

[0085] 0033: Classify the current matching feature points whose current projection error is less than the current projection error threshold as the internal points of the homography matrix of the current plane;

[0086] 0034: Classify the current matching feature points whose current projection error is greater than the current projection error threshold as new current matching feature points.

[0087] The above steps (step 0031, step 0032, step 0033 and step 0034) are executed cyclically until the preset conditions are met. When the above steps are executed for the first time, the current matching feature points are all matching feature points.

[0088] See also Figure 2 In some embodiments, step 0031, step 0032, step 0033 and step 0034 can be implemented by the second division module 13. That is, the second division module 13 can be used to: determine the homography matrix of the current plane according to the current matching feature points, the plane including the current plane; calculate the current projection error according to the homography matrix of each pair of current matching feature points and the current plane; divide the current matching feature points whose current projection errors are less than the current projection error threshold into the inner points of the homography matrix of the current plane; divide the current matching feature points whose current projection errors are greater than the current projection error threshold into new current matching feature points.

[0089] Thus, by calculating each current projection error and comparing each current projection error with the current projection error threshold, the homography matrix of each plane can be generated. Fig.12 As shown, multiple homography matrices are generated in a cyclic manner, and each pair of matching feature points is divided into different planes so that they can correspond to different homography matrices.

[0090] Specifically, after the determination of the matching feature points between the first image and the second image is completed, the homography matrix of the current plane can be determined according to the current matching feature points (when executed for the first time, the current matching feature points are all matching feature points, that is, when calculating the first plane, all matching feature points are used to calculate the homography matrix), wherein the plane includes the current plane. Then, the current projection error is calculated according to the homography matrix of each pair of current matching feature points and the current plane, and the current matching feature points whose current projection error is less than the current projection error threshold are divided into the inner points of the homography matrix of the current plane, and the current matching feature points whose current projection error is greater than the current projection error threshold are divided into new current matching feature points. If the RANSAC method is used, the projection error threshold of the current matching feature point is set to t, and the matching feature points whose projection error is less than the threshold are classified as the inner point set of the current homography matrix h; according to the matching feature points whose projection error is greater than the error threshold t, a new homography matrix is ​​calculated. The above steps are executed repeatedly until the preset conditions are met.

[0091] In some embodiments, the preset condition includes at least one of the following:

[0092] The number of planes reaches a first preset number;

[0093] The number of inner points in the current division is less than a second preset number;

[0094] The ratio of the number of new current matching feature points divided at the current time to the number of all matching feature points is smaller than a preset ratio.

[0095] Specifically, in the step of generating the homography matrices of all planes, the conditions for the end of the loop include: the number of planes reaches a first preset number, which may be 5 planes; the number of inner halls currently divided is less than a second preset number, which may be 8 points; the ratio of the number of new current matching feature points of the current division to the number of all matching feature points is less than a preset ratio, which may be 2%.

[0096] In this way, multiple homography matrices are generated in a cyclic manner, and each pair of matching feature points is divided into different planes, corresponding to different homography matrices.

[0097] See also Fig.13 In some embodiments, the current matching feature point includes a first current feature point in the first image and a second current feature point in the second image. Step 0032 (calculating the current projection error according to the homography matrix between each pair of current matching feature points and the current plane) includes:

[0098] 00321: transform the first current feature point using the homography matrix of the current plane to determine the current transformed feature point;

[0099] 00322: Calculate the position error between the current transformed feature point and the second current feature point as the current projection error.

[0100] See also Figure 2 In some implementations, step 00321 and step 00322 can be implemented by the second division module 13. That is, the second division module 13 can be used to: transform the first current feature point using the homography matrix of the current plane to determine the current transformed feature point; calculate the position error between the current transformed feature point and the second current feature point as the current projection error.

[0101] In this way, the projection error can be calculated through the current transformation feature point.

[0102] Specifically, after the homography matrix of the current plane is determined, the first current feature point can be transformed using the homography matrix of the current plane to determine the current transformed feature point, and then the position error between the current transformed feature point and the second current feature point is calculated as the current projection error.

[0103] See also Fig.14 In some embodiments, the matching feature points include first feature points in the first image and second feature points in the second image. Step 004 (calculating a first alignment residual according to homography matrices of each pair of matching feature points and all planes) includes:

[0104] 0041: transform the first feature point using the homography matrix of the plane to determine the transformed feature point;

[0105] 0042: Calculate the position error between the transformed feature point and the second feature point as the first projection error;

[0106] 0043: Determine the first projection error corresponding to the homography matrix of each pair of matching feature points and all planes as the first alignment residual.

[0107] See also Figure 2 In some embodiments, step 0041, step 0042, and step 0043 may be implemented by the first processing module 14. That is, the first processing module 14 may be used to: transform the first feature point using the homography matrix of the plane to determine the transformed feature point; calculate the position error between the transformed feature point and the second feature point as the first projection error; determine the first projection error corresponding to each pair of matching feature points and the homography matrix of all planes as the first alignment residual.

[0108] In this way, by determining the first projection error corresponding to each pair of matching feature points and the homography matrix for determining all planes, the calculation of the first alignment residual can be completed.

[0109] Specifically, after the generation of the homography matrix of each plane is completed, the above-mentioned image matching feature points can be used to solve the homography matrix of each superpixel area. Among them, each matching feature point has a different weight calculated for the current superpixel area, and the calculation of this weight for the superpixel area includes: whether the matching feature point and the current superpixel area are in the same plane (same depth). The closer to the same plane, the greater the weight of the matching feature point. Calculate the alignment residual r of each pair of matching feature points corresponding to the multiple plane homography matrices calculated above, that is, the first alignment residual. Assuming the number of matching points is K and the number of homography matrices is M, the dimension of the first alignment residual r is K*M.

[0110] See also Fig.15 In some embodiments, the target superpixel region includes multiple pairs of matching feature points, the matching feature points being first feature points in the first image and second feature points in the second image. Step 005 (calculating the second alignment residuals based on the matching feature points in the target superpixel region and the homography matrices of all planes) includes:

[0111] 0051: transform the first feature point using the homography matrix of the plane to determine the transformed feature point;

[0112] 0052: Calculate the position error between the transformed feature point and the second feature point as the second projection error;

[0113] 0053: determining a projection error of a target superpixel region according to second projection errors corresponding to multiple pairs of matching feature points in the target superpixel region;

[0114] 0054: Determine the projection error corresponding to the homography matrix of the target superpixel area and all planes as the second alignment residual.

[0115] See also Figure 2 In some embodiments, step 0051, step 0052, step 0053 and step 0054 can be implemented by the second processing module 15. That is, the second processing module 15 can be used to: transform the first feature point using the homography matrix of the plane to determine the transformed feature point; calculate the position error between the transformed feature point and the second feature point as the second projection error; determine the projection error of the target superpixel region according to the second projection errors corresponding to multiple pairs of matching feature points in the target superpixel region; determine the projection error corresponding to the homography matrix of the target superpixel region and all planes as the second alignment residual.

[0116] In this way, by determining the projection error corresponding to the homography matrix of the target superpixel area and all planes as the second alignment residual, a basis can be provided for the subsequent determination of the calculation weights of the matching feature points.

[0117] Specifically, after the generation of the homography matrices of each plane is completed, the alignment residual R of the matching points in each superpixel region corresponding to the multiple plane homography matrices calculated above, that is, the second alignment residual, will be calculated. Assuming that the number of superpixel regions is N and the number of homography matrices is M, the dimension of the alignment parameter R is N*M. Considering that the number of matching points in each superpixel region is not less than 1 pair, for superpixel regions with more than 1 pair of matching feature points, the mean of the alignment residuals of all matching points in the superpixel region can be taken as the alignment residual value R of the superpixel region; for superpixel regions with equal to 1 pair of matching feature points, the alignment residual values ​​of all matching feature points in the superpixel region are directly taken as the alignment residual value R of the superpixel region.

[0118] Taking the conventional solution of the homography matrix as an example, assuming x = [x1, x2, 1] T and y = [y1,y2,1] T represents a pair of matching feature points in two images, then the homography matrix between these two matching feature points can be expressed as

[0119] y~Hx (1)

[0120] By linearizing equation (1), we can obtain

[0121]

[0122] For K pairs of matching feature points, by linearizing (2) through direct linear transformation (DLT), we can obtain the optimal homography matrix by minimizing the algebraic distance of the following formula:

[0123]

[0124] Where ‖h‖=1, the coefficient matrix It is constructed row by row through K pairs of matching feature points.

[0125] In this way, the homography matrix can be solved by formula (3), and the homography matrices of each plane mentioned above can also be calculated by this formula.

[0126] In some embodiments, the calculation formula of the homography matrix of the target superpixel region is:

[0127]

[0128] in, is the homography matrix of the target superpixel region, W i is the calculation weight of the target superpixel area, G is the coefficient matrix constructed according to all matching feature points, and h is the homography matrix.

[0129] Specifically, the above formula represents the homography matrix for the i-th superpixel region: When solving the homography matrix of each superpixel region, each pair of feature points is assigned a different weight, considering whether the matching feature point is at a similar depth to the superpixel region of the homography matrix to be solved. The closer the depth, the greater the weight.

[0130] In certain embodiments, the weights are calculated as a diagonal weight matrix, which is:

[0131] W i =diag([w i,1 w i,1 w i,2 w i,2 …w i,K w i,K ])

[0132] Among them, W i is the diagonal weight matrix of the target superpixel region, w i,k is the weight of the kth pair of matching feature points.

[0133] Specifically, w i,k It represents the weight coefficient when solving the homography matrix of the k-th matching feature point for the i-th superpixel region. The weight is related to whether the k-th matching feature point is at the same depth as the i-th superpixel region. Whether the measurement is at the same depth is determined by the difference between the alignment residuals r and R. If the two values ​​are close, it means they are at the same depth.

[0134] Thus, the diagonal weights within the target superpixel region can be determined by this formula.

[0135] See also Fig.16 In some embodiments, step 006 (determining the calculation weight of the matching feature point according to the first alignment residual and the second alignment residual) includes:

[0136] 0061: Determine the weight of each pair of matching feature points according to the deviation between the first alignment residual and the second alignment residual;

[0137] 0062: Determine the calculation weight based on the weights of all matching feature points.

[0138] See also Figure 2 In some embodiments, step 061 and step 062 may be implemented by the second determination module 16. That is, the second determination module 16 may be used to: determine the weight of each pair of matching feature points according to the deviation between the first alignment residual and the second alignment residual; and determine the calculation weight according to the weights of all matching feature points.

[0139] In this way, the calculation weight can be determined by the weight of each pair of matching feature points.

[0140] Specifically, after the first alignment residual and the second alignment residual are determined, the homography matrix of each superpixel area is calculated. The calculation of the homography matrix h of each superpixel area is related to the matching feature points of the entire image, but the calculation weight of each matching point for the final homography matrix h is different. The calculation of the weight here is related to whether the matching feature point and the superpixel area belong to the same plane, that is, it is related to the deviation of the aforementioned r and R.

[0141] In some embodiments, the weight of each pair of matching feature points is calculated as follows:

[0142]

[0143] Among them, w i,k is the weight of the kth pair of matching feature points, R i is the second alignment residual of the target superpixel region, r k is the first alignment residual of the kth pair of matching feature points, σ ​​and γ are preset constants.

[0144] Specifically, R i represents the alignment residual vector of the i-th superpixel region (relative to the M homography matrices), r k Represents the alignment residual vector of the kth feature point (relative to M homography matrices). The smaller σ is, the less the solution of the homography matrix of each superpixel region is affected by feature points outside the superpixel region, which is equivalent to calculating the homography matrix of each superpixel region using only the matching feature points in the current block. The larger γ is, the more easily the homography matrix calculation of each superpixel region is affected by feature points in other regions. The preset constants can be selected as σ=4 and γ=0.01.

[0145] In this way, the degree to which the homography matrix of each superpixel area is affected by the current plane matching feature points can be calculated through this formula.

[0146] See also Fig.17 In some embodiments, the image processing method further comprises:

[0147] 010: Determine the offset map according to the homography matrix of all target superpixel regions;

[0148] 011: Transform the first image according to the offset map to obtain an aligned image, and align the aligned image with the second image.

[0149] See also Fig.18In some embodiments, the image processing device 100 includes a fourth determination module 20 and an image transformation module 21, step 010 can be implemented by the fourth determination module 20, and step 011 can be implemented by the image transformation module 21. That is, the fourth determination module 20 can be used to determine the offset map according to the homography matrix of all target superpixel regions, and the image transformation module 011 can be used to transform the first image according to the offset map to obtain an aligned image, and the aligned image is aligned with the second image.

[0150] In this way, by completing the determination of the offset map and transforming the first image according to the offset map to obtain the aligned image, preparation can be made for subsequently obtaining the fused image, thereby achieving an effect of improving the image clarity.

[0151] Specifically, after the homography matrix of the target superpixel region is determined, the image of the corresponding area of ​​the matching image is homographed according to the calculated homography matrix of each superpixel region to obtain a sub-region mapping map of the matching image corresponding to each superpixel region. In this way, the image alignment of the two images is achieved, and the matched images can be fused later.

[0152] See also Fig.19 In some embodiments, the image processing method further comprises:

[0153] 012: Determine the occluded area where the foreground and background meet in the aligned image;

[0154] 013: Fuse the aligned image and the second image to obtain a fused image;

[0155] When the aligned image and the second image are fused, the occluded area is not fused.

[0156] See also Fig. 20 In some embodiments, the image processing device 100 includes a fifth determination module 22 and an image fusion module 23, step 012 can be implemented by the fifth determination module 22, and step 013 can be implemented by the image fusion module 23. That is, the fifth determination module 22 can be used to determine the occlusion area where the foreground and background meet in the aligned image, and the image fusion module 23 can be used to fuse the aligned image and the second image to obtain a fused image.

[0157] In this way, by fusing the aligned image and the second image to obtain a fused image, the alignment of the first image and the second image can be completed.

[0158] Specifically, due to the existence of parallax, it is difficult to use the method of calculating the homography matrix by superpixel blocks to achieve image alignment at the intersection of the foreground and background. Therefore, the pixel-by-pixel offset relationship of the mapping image can be used to detect the danger of distortion or fault in the image alignment of the occluded area, which can be used as a mask for subsequent image fusion, while the occluded area is not fused.

[0159] See also Fig.21 In some embodiments, step 012 (determining the occluded area where the foreground and background meet in the aligned image) includes:

[0160] 0121: Determine the offset difference of multiple pixels in a preset area according to the offset of each pixel in the offset map;

[0161] 0122: When the offset difference is greater than the preset difference, the preset area is determined as the occlusion area.

[0162] See also Fig. 20 In some embodiments, step 0121 and step 0122 may be implemented by the fifth determining module 22. That is, the fifth determining module 22 may be used to: determine the offset difference of multiple pixels in the preset area according to the offset of each pixel in the offset map; and determine the preset area as the occlusion area when the offset difference is greater than the preset difference.

[0163] In this way, by completing the determination of the occluded area in the aligned image, preparation can be made for the subsequent acquisition of the fused image.

[0164] Specifically, after obtaining the aligned image, the detection of the occluded area of ​​the image can be solved by using the method of pixel-by-pixel offset in the local area. The more consistent the local offset is, the more it indicates that the area is approximately a plane and there is no occlusion problem between the foreground and background. For areas with large local offset variance, it means that there is a different offset relationship between the foreground and background at this location, and it can be detected as an occlusion mask.

[0165] See also Figure 3 The image processing method of the embodiment of the present application can be implemented by the electronic device 1000 of the embodiment of the present application. Specifically, the electronic device 1000 includes one or more processors 200 and a memory 300. The memory 300 stores a computer program. When the computer program is executed by the processor 200, the steps of the image processing method of any of the above embodiments are implemented.

[0166] For example, when the computer program is executed by the processor 200, the following steps of the image processing method are implemented:

[0167] 001: performing superpixel division on the first image to obtain a plurality of superpixel regions, wherein the plurality of superpixel regions include a target superpixel region;

[0168] 002: Determine matching feature points between a first image and a second image, where the first image and the second image correspond to the same shooting scene, and each superpixel region includes at least one matching feature point;

[0169] 003: Divide the matching feature points into multiple planes and generate the homography matrix of each plane;

[0170] 004: Calculate the first alignment residual based on the homography matrix of each pair of matching feature points and all planes;

[0171] 005: Calculate the second alignment residual according to the homography matrix of the matching feature points and all planes in the target superpixel area;

[0172] 006: Determine the calculation weight of the matching feature points according to the first alignment residual and the second alignment residual;

[0173] 007: Determine a homography matrix of the target superpixel region according to the matched feature points and the calculated weights, and the homography matrix of the target superpixel region is used to align the first image and the second image.

[0174] An embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of the image processing method of any of the above embodiments are implemented.

[0175] For example, when the program is executed by the processor 200, the following steps of the image processing method are implemented:

[0176] 001: performing superpixel division on the first image to obtain a plurality of superpixel regions, wherein the plurality of superpixel regions include a target superpixel region;

[0177] 002: Determine matching feature points between a first image and a second image, where the first image and the second image correspond to the same shooting scene, and each superpixel region includes at least one matching feature point;

[0178] 003: Divide the matching feature points into multiple planes and generate the homography matrix of each plane;

[0179] 004: Calculate the first alignment residual based on the homography matrix of each pair of matching feature points and all planes;

[0180] 005: Calculate the second alignment residual according to the homography matrix of the matching feature points and all planes in the target superpixel area;

[0181] 006: Determine the calculation weight of the matching feature points according to the first alignment residual and the second alignment residual;

[0182] 007: Determine a homography matrix of the target superpixel region according to the matched feature points and the calculated weights, and the homography matrix of the target superpixel region is used to align the first image and the second image.

[0183] In the image processing method, image processing device 100, electronic device 1000 and computer-readable storage medium of the embodiment of the present application, each algorithm channel and each algorithm unit in the photo algorithm list is checked to enhance the robustness of the code, thereby avoiding algorithm execution failure. In addition, by automatically checking whether there is an abnormality, the development workload can be reduced.

[0184] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.

[0185] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processing module, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (control method), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.

[0186] It should be understood that the various parts of the embodiments of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0187] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.

[0188] In addition, each functional unit in each embodiment of the present application may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.

[0189] The storage medium mentioned above can be a read-only memory, a magnetic disk or an optical disk, etc.

[0190] In the description of this specification, the description of reference terms such as "certain embodiments" means that the specific features, structures or characteristics described in conjunction with the embodiments or examples are included in at least one embodiment of the present application. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment. Moreover, the specific features, structures or characteristics described can be combined in any one or more embodiments in a suitable manner.

[0191] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations on the present application. Ordinary technicians in this field can change, modify, replace and modify the above embodiments within the scope of the present application.

Claims

1. An image processing method, characterized in that: The image processing method comprises: Performing superpixel division on the first image to obtain a plurality of superpixel regions, wherein the plurality of superpixel regions include a target superpixel region; Determining matching feature points between the first image and the second image, where the first image and the second image correspond to the same shooting scene, and each of the superpixel regions includes at least one matching feature point; Dividing the matching feature points into a plurality of planes and generating a homography matrix for each of the planes; Calculating a first alignment residual according to the homography matrix between each pair of the matching feature points and all the planes; Calculating a second alignment residual according to the homography matrices of the matching feature points in the target superpixel region and all the planes; Determining a calculation weight of the matching feature point according to the first alignment residual and the second alignment residual; The homography matrix of the target superpixel region is determined according to the matching feature points and the calculated weights, and the homography matrix of the target superpixel region is used to align the first image and the second image.

2. The image processing method according to claim 1, characterized in that: The step of performing superpixel division on the first image to obtain a plurality of superpixel regions comprises: The first image is divided into a plurality of superpixel regions based on pixel proximity information of the first image.

3. The image processing method according to claim 1, characterized in that: The determining of matching feature points between the first image and the second image includes: extracting feature points of the first image and feature points of the second image respectively; The feature points of the first image and the feature points of the second image are matched to determine the matching feature points.

4. The image processing method according to claim 3, characterized in that: The image processing method further comprises: The matching feature points are screened to remove erroneous matching feature points and / or redundant matching feature points.

5. The image processing method according to claim 4, characterized in that: The image processing method further comprises: When the matching feature point is not included in the superpixel area, the feature points of the first image and the feature points of the second image are extracted again, and the feature points of the first image and the feature points of the second image are matched so that each of the superpixel areas includes at least one matching feature point.

6. The image processing method according to claim 1, characterized in that: The step of dividing the matching feature points into a plurality of planes and generating a homography matrix of each of the planes comprises the following steps: Determine a homography matrix of a current plane according to current matching feature points, wherein the plane includes the current plane; Calculate the current projection error according to the homography matrix of each pair of the current matching feature points and the current plane; Classify the current matching feature points whose current projection errors are less than a current projection error threshold as internal points of the homography matrix of the current plane; Classify the current matching feature point whose current projection error is greater than the current projection error threshold as a new current matching feature point; The above steps are executed repeatedly until a preset condition is met; wherein, when the above steps are executed for the first time, the current matching feature points are all the matching feature points.

7. The image processing method according to claim 6, characterized in that: The preset condition includes at least one of the following: The number of the planes reaches a first preset number; The number of inner points in the current division is less than a second preset number; The ratio of the number of new current matching feature points divided at the current time to the number of all the matching feature points is smaller than a preset ratio.

8. The image processing method according to claim 6 or 7, characterized in that: The current matching feature point includes a first current feature point in the first image and a second current feature point in the second image; The calculating the current projection error according to the homography matrix of each pair of the current matching feature points and the current plane includes: Transforming the first current feature point using the homography matrix of the current plane to determine a current transformed feature point; A position error between the current transformed feature point and the second current feature point is calculated as the current projection error.

9. The image processing method according to claim 1, characterized in that: The matching feature points include a first feature point in the first image and a second feature point in the second image; The calculating the first alignment residual according to the homography matrix between each pair of the matching feature points and all the planes comprises: Transforming the first feature point using the homography matrix of the plane to determine a transformed feature point; Calculating a position error between the transformed feature point and the second feature point as a first projection error; The first projection error corresponding to the homography matrix of each pair of the matching feature points and all the planes is determined as the first alignment residual.

10. The image processing method according to claim 1, characterized in that: The target superpixel region includes a plurality of pairs of the matching feature points, wherein the matching feature points are first feature points in the first image and second feature points in the second image; The calculating the second alignment residual according to the homography matrix of the matching feature points in the target superpixel area and all the planes includes: Transforming the first feature point using the homography matrix of the plane to determine a transformed feature point; Calculating a position error between the transformed feature point and the second feature point as a second projection error; Determine the projection error of the target superpixel area according to the second projection errors corresponding to the multiple pairs of the matching feature points in the target superpixel area; The projection error corresponding to the homography matrix of the target superpixel region and all the planes is determined as the second alignment residual.

11. The image processing method according to claim 1, characterized in that: The determining the calculation weight of the matching feature point according to the first alignment residual and the second alignment residual includes: determining a weight of each pair of the matching feature points according to a deviation between the first alignment residual and the second alignment residual; The calculation weight is determined according to the weights of all the matching feature points.

12. The image processing method according to claim 11, characterized in that: The calculation formula for the weight of each pair of matching feature points is: Among them, w i,k is the weight of the kth pair of matching feature points, R i is the second alignment residual of the target superpixel region, r k is the first alignment residual of the kth pair of matching feature points, and σ and γ are preset constants.

13. The image processing method according to claim 11, characterized in that: The calculation weights are a diagonal weight matrix, which is: IN i =diag([in i,1 In i,1 In i,2 In i,2 …In i,K In i,K ]) Among them, W i is the diagonal weight matrix of the target superpixel region, w i,k is the weight of the kth pair of matching feature points.

14. The image processing method according to claim 1, characterized in that: The calculation formula of the homography matrix of the target superpixel area is: in, is the homography matrix of the target superpixel area, W i is the calculation weight of the target superpixel area, G is the coefficient matrix constructed according to all the matching feature points, and h is the homography matrix.

15. The image processing method according to claim 1, characterized in that: The image processing method further comprises: Determine an offset map according to the homography matrix of all the target superpixel regions; The first image is transformed according to the offset map to obtain an aligned image, and the aligned image is aligned with the second image.

16. The image processing method according to claim 15, characterized in that: The image processing method further comprises: Determine an occluded area where a foreground and background meet in the aligned image; fusing the aligned image and the second image to obtain a fused image; Wherein, when the aligned image and the second image are fused, the occluded area is not fused.

17. The image processing method according to claim 16, characterized in that: The determining of the blocked area where the foreground and background meet in the aligned image includes: Determining the offset difference of a plurality of pixels in a preset area according to the offset of each pixel in the offset map; When the offset difference is greater than a preset difference, the preset area is determined as the occlusion area.

18. An image processing device, characterized in that: The image processing device comprises: A first division module, the first division module is used to perform super-pixel division on the first image to obtain a plurality of super-pixel regions, wherein the plurality of super-pixel regions include a target super-pixel region; A first determining module, the first determining module is used to determine matching feature points between the first image and the second image, the first image and the second image correspond to the same shooting scene, and each of the superpixel regions includes at least one matching feature point; A second division module, the second division module is used to divide the matching feature points into a plurality of planes and generate a homography matrix of each of the planes; A first processing module, the first processing module is used to calculate a first alignment residual according to a homography matrix between each pair of the matching feature points and all the planes; A second processing module, the second processing module is used to calculate a second alignment residual according to the homography matrix of the matching feature points in the target superpixel area and all the planes; a second determining module, the second determining module being used to determine a calculation weight of the matching feature point according to the first alignment residual and the second alignment residual; A third determination module is used to determine the homography matrix of the target superpixel area according to the matching feature points and the calculated weights, and the homography matrix of the target superpixel area is used to align the first image and the second image.

19. An electronic device, characterized in that: The electronic device includes one or more processors and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the steps of the image processing method according to any one of claims 1 to 17 are implemented.

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

Citation Information

Patent Citations

  • Image alignment method and device, readable storage medium, and computer device

    CN109166077A

  • Image alignment method and device thereof, computer-readable storage medium and computer device

    CN109242811A

  • Image alignment method and device, electronic equipment and storage medium

    CN114298902A

  • Image fusion method and device, storage medium and electronic equipment

    CN118212146A