Image registration method and device, electronic equipment and computer readable storage medium
By redetermining the ownership of feature points and updating the motion model in image registration, the error problem existing in traditional image registration methods is solved and higher accuracy and adaptability are achieved.
Patent Information
- Application Number
- CN202310893185.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-19
- Publication Date
- 2025-01-21
AI Technical Summary
Traditional image registration methods have errors in registration due to factors such as different distances and lens distortions in the subject, and there is a problem of inaccurate image registration.
By determining the correlation value between the feature point and the reference point for the feature points of each image block in the first image, the image block to which the feature point belongs is re-determined; then, the motion model of each image block is updated. , obtain a new motion model; based on these new motion models, determine the motion model of each pixel, and finally register the first image and the second image.
It improves the accuracy of image allocation, can adjust the image more accurately, and compares and analyzes it under the same coordinated system. It is suitable for complicated scenarios and severe scenes of lens distortion.
Smart Images

Figure CN119338868A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of imaging technology, and in particular to an image registration method, device, electronic device and computer-readable storage medium. Background Art
[0002] Image registration (alignment) is a basic technology of image algorithm. It refers to the adjustment of the spatial position and direction of two or more images so that they can be compared and analyzed in the same coordinate system. It is often used in medical imaging, satellite imaging, geographic information systems, robot navigation, visual sensors and other fields.
[0003] However, traditional image registration methods have the problem of inaccurate image registration due to factors such as the different distances of the objects being photographed or lens distortion, which may lead to errors in registration. Summary of the invention
[0004] The embodiments of the present application provide an image registration method, apparatus, electronic device, computer-readable storage medium, and computer program product, which can improve the accuracy of image registration.
[0005] In a first aspect, the present application provides an image registration method. The method comprises:
[0006] For a feature point belonging to each image block in the first image, determining a correlation value between the feature point and a reference point in each image block in the first image, and determining a new image block to which the feature point belongs based on each correlation value;
[0007] After the image blocks to which each feature point in the first image belongs are determined, for each image block, a motion model of the image block is updated according to each feature point belonging to the image block to obtain a new motion model of the image block;
[0008] Determining a motion model for each pixel in the first image based on the new motion model of each image block;
[0009] The first image and the second image are registered based on a motion model of each pixel in the first image.
[0010] In a second aspect, the present application also provides an image registration device. The device comprises:
[0011] a feature point attribution determination module, configured to determine, for each feature point in the first image belonging to each image block, association values between the feature point and a reference point in each image block in the first image, and determine, based on each association value, the image block to which the feature point is newly attributed;
[0012] an image block motion model updating module, configured to update the motion model of each image block according to each feature point belonging to the image block after the image block to which each feature point in the first image belongs is determined, so as to obtain a new motion model of the image block;
[0013] A pixel motion model determination module, used to determine the motion model of each pixel in the first image based on the new motion model of each image block;
[0014] A registration module is used to register the first image and the second image based on a motion model of each pixel in the first image.
[0015] In a third aspect, the present application further provides an electronic device. The electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
[0016] For a feature point belonging to each image block in the first image, determining a correlation value between the feature point and a reference point in each image block in the first image, and determining a new image block to which the feature point belongs based on each correlation value;
[0017] After the image blocks to which each feature point in the first image belongs are determined, for each image block, a motion model of the image block is updated according to each feature point belonging to the image block to obtain a new motion model of the image block;
[0018] Determining a motion model for each pixel in the first image based on the new motion model of each image block;
[0019] The first image and the second image are registered based on a motion model of each pixel in the first image.
[0020] In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0021] For a feature point belonging to each image block in the first image, determining a correlation value between the feature point and a reference point in each image block in the first image, and determining a new image block to which the feature point belongs based on each correlation value;
[0022] After the image blocks to which each feature point in the first image belongs are determined, for each image block, a motion model of the image block is updated according to each feature point belonging to the image block to obtain a new motion model of the image block;
[0023] Determining a motion model for each pixel in the first image based on the new motion model of each image block;
[0024] The first image and the second image are registered based on a motion model of each pixel in the first image.
[0025] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0026] For a feature point belonging to each image block in the first image, determining a correlation value between the feature point and a reference point in each image block in the first image, and determining a new image block to which the feature point belongs based on each correlation value;
[0027] After the image blocks to which each feature point in the first image belongs are determined, for each image block, a motion model of the image block is updated according to each feature point belonging to the image block to obtain a new motion model of the image block;
[0028] Determining a motion model for each pixel in the first image based on the new motion model of each image block;
[0029] The first image and the second image are registered based on a motion model of each pixel in the first image.
[0030] The above-mentioned image registration method, device, electronic device, computer-readable storage medium and computer program product determine the correlation values between the feature points and the reference points in each image block in the first image for the feature points belonging to each image block in the first image, and based on the respective correlation values, the image block to which the feature points newly belong can be accurately determined; after the image block to which each feature point in the first image belongs is determined, for each image block, the motion model of the image block is updated according to the respective feature points belonging to the image block, and a more accurate new motion model of the image block can be obtained, so that the motion model of each pixel in the first image can be determined, and then the first image and the second image can be more accurately registered, thereby improving the accuracy of image registration. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0032] Figure 1 is a flow chart of an image registration method in one embodiment;
[0033] Figure 2 is a schematic diagram of feature point detection in one embodiment;
[0034] Figure 3 is a schematic diagram of corner point detection in one embodiment;
[0035] Figure 4 is a schematic diagram of image division in one embodiment;
[0036] Figure 5 A schematic diagram of re-determining an image block to which a feature point belongs in one embodiment;
[0037] Figure 6 is a schematic diagram of the least squares method in one embodiment;
[0038] Figure 7 is a schematic diagram of image transformation in one embodiment;
[0039] Figure 8 is a structural block diagram of an image registration device in one embodiment;
[0040] Fig. 9 FIG. 4 is a diagram showing the internal structure of an electronic device in one embodiment. DETAILED DESCRIPTION
[0041] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0042] In one embodiment, Figure 1As shown, an image registration method is provided. This embodiment uses the method applied to an electronic device as an example. The electronic device can be a terminal or a server. It can be understood that the method can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. Among them, the terminal can be but not limited to various personal computers, laptops, smart phones, tablets, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, smart cars, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server can be implemented as an independent server or a server cluster consisting of multiple servers.
[0043] In this embodiment, the image registration method includes the following steps:
[0044] Step S102, for the feature points belonging to each image block in the first image, determine the association values between the feature points and the reference points in each image block in the first image, and determine the image block to which the feature points newly belong based on the association values.
[0045] The first image is the image to be registered, and the first image can be a reference image of the two images to be registered, or any one of the two images to be registered. The first image and the second image to be registered can be adjacent images obtained by shooting, or can be images obtained by two camera modules simultaneously shooting.
[0046] The feature point may be an edge, a corner point, a spot, etc. The reference point is a point in the image block that represents the entire image block. Optionally, the reference point may be the centroid of the image block or the center point, which is not limited here.
[0047] The association value represents the association relationship between the feature point and the reference point. The association value is positively correlated with the probability that the feature point belongs to the image block. It can be understood that the larger the association value between the feature point and the reference point in the image block, the stronger the association relationship between the feature point and the image block, and the greater the probability that the feature point belongs to the image block.
[0048] Alternatively, if Figure 2 As shown, the electronic device performs feature extraction on the first image to obtain various feature points 202 in the first image.
[0049] Alternatively, if Figure 3As shown in the figure, the principle of Harris corner detection is: in places where the grayscale changes slowly (flat area), the grayscale integral remains unchanged when the window moves in any direction, which is defined as "flat"; in the edge area of the image, when the window moves along the edge, the grayscale integral remains approximately unchanged, and when it moves in other directions, the grayscale integral changes dramatically, which is defined as "edge"; at the corner point, the grayscale integral changes dramatically when the window moves in any direction, which is defined as "corner".
[0050] The electronic device uses the Harris corner point algorithm to calculate the feature points, as follows:
[0051]
[0052] R = det(M) - k(trace(M)) 2
[0053] det(M)=λ 1 λ 2
[0054] trace(M)=λ 1 +λ 2
[0055] Among them, M can be equivalent to an ellipse, and is the major and minor axis of the ellipse. 1 and λ 2 are relatively small, the point (x, y) is in the plane area; when λ 1 >>λ 2 or 1 <<λ 2 When , the point (x, y) is in the edge area; when λ 1 and λ 2 When both are relatively large, the point (x, y) is a corner point.
[0056] Optionally, the electronic device divides the first image into blocks to obtain each image block in the first image, wherein each image block includes each feature point, that is, each feature point belongs to the image block. Optionally, the electronic device may also divide all feature points into blocks according to positions.
[0057] like Figure 4 As shown, the electronic device divides the first image into 4x4 image blocks, and the image blocks include feature points.
[0058] Optionally, the electronic device determines, from among the correlation values, the image block where the reference point corresponding to the maximum correlation value is located as the new image block to which the feature point belongs.
[0059] Optionally, the electronic device determines, from among the association values, an image block where a reference point corresponding to a second largest association value is located as the new image block to which the feature point belongs.
[0060] Optionally, the electronic device may also randomly determine an image block where a reference point corresponding to an associated value is located from various associated values, and determine it as the new image block to which the feature point belongs.
[0061] In one embodiment, Figure 5 As shown, for the feature points of each image block in the first image, the association values between the feature points and the reference points in each image block are determined, and the new image block to which the feature points belong is determined based on the respective association values, so that the image block to which each feature point belongs can be re-determined.
[0062] Step S104, after the image blocks to which each feature point in the first image belongs are determined, for each image block, the motion model of the image block is updated according to each feature point belonging to the image block to obtain a new motion model of the image block.
[0063] The motion model is a model used to register the images to be registered. The images to be registered include a first image and a second image.
[0064] Optionally, the electronic device obtains a motion model for each image block, and after the image block to which each feature point in the first image belongs is determined, for each image block, the motion model of the image block is updated according to each feature point belonging to the image block to obtain a new motion model of the image block.
[0065] After the image blocks to which each feature point in the first image belongs are determined, the feature points in each image block in the first image may all change, that is, each image block changes; the feature points in each image block in the first image may not change, that is, each image block does not change; in the first image, there may be image blocks where the feature points change or where the feature points do not change, that is, there may be image blocks where the attribution of feature points changes, and there may be image blocks where the attribution of feature points does not change.
[0066] It can be understood that when there are both image blocks whose feature point attribution has changed and image blocks whose feature point attribution has not changed in the first image, and after the image blocks to which each feature point in the first image belongs are determined, the electronic device updates the motion model of each image block, that is, updates the motion models of both the image blocks whose feature point attribution has changed and the image blocks whose feature point attribution has not changed.
[0067] Optionally, the electronic device matches the feature points of the first image and the second image, and establishes a correspondence between the first image and the second image, wherein the correspondence includes a matching feature point pair; the feature point pair includes a feature point in the first image and a feature point in the second image; after the image block to which each feature point in the first image belongs is determined, for each image block, the electronic device determines the feature point pairs of each feature point belonging to the image block, calculates each feature point pair using the least squares method, obtains a new motion model of the image block, and updates the original motion model of the image block. Among them, the least squares method is a model obtained by fitting a large number of feature points, which can ensure that the fitting error (matching error) of all points is minimized.
[0068] like Figure 6 As shown, the electronic device calculates the motion model using the least square method, which can ensure a smaller matching error.
[0069] Step S106: determining the motion model of each pixel in the first image based on the new motion model of each image block.
[0070] Optionally, based on the new motion models of each image block, the motion model of each pixel in the first image is determined, including: for each pixel in the first image, based on the position of the pixel, determining the feature points adjacent to the pixel; and determining the motion model of the pixel from the motion models of the image blocks to which each adjacent feature point belongs.
[0071] Optionally, for each pixel in the first image, the position of the pixel is determined, as well as the feature points adjacent to the pixel, and a motion model of the image block to which the feature points closest to the pixel belong is selected and determined as the motion model of the pixel.
[0072] In other optional embodiments, the electronic device may also select a motion model of an image block to which other feature points adjacent to the pixel point belong, and determine it as the motion model of the pixel point, which is not limited here.
[0073] Step S108: registering the first image and the second image based on the motion model of each pixel in the first image.
[0074] Optionally, the electronic device inputs each pixel in the first image into the corresponding motion model, performs affine transformation on the pixel, calculates the movement of each pixel, obtains the first image after affine transformation, and aligns the first image after radial transformation with the second image.
[0075] Exemplarily, the electronic device obtains the first image image1, randomly generates a transformation matrix recorded as mat1, performs dot product between each pixel in the first image image1 and the transformation matrix mat1 to obtain the first image after the image transformation, and aligns the first image after the image transformation with the second image. The inverse transformation matrix of the transformation matrix mat1 is mat2.
[0076] The electronic device uses the following formula to perform image transformation on the first image to obtain the first image after image transformation:
[0077]
[0078] in, is the transformation matrix mat1, is the pixel value of the pixel in the first image, is the pixel value of the pixel in the first image after the image transformation. The transformation matrix is also the motion model.
[0079] like Figure 7 As shown, the electronic device multiplies the pixels of the pixels in the first image by the corresponding motion model to obtain the first image after image transformation.
[0080] The above-mentioned image registration method determines, for the feature points belonging to each image block in the first image, the association values between the feature points and the reference points in each image block in the first image, and based on the respective association values, the image block to which the feature points newly belong can be accurately determined; after the image block to which each feature point in the first image belongs is determined, for each image block, the motion model of the image block is updated according to the respective feature points belonging to the image block, and a more accurate new motion model of the image block can be obtained, so that the motion model of each pixel in the first image can be determined, and then the first image and the second image can be more accurately registered, thereby improving the accuracy of image registration.
[0081] The above-mentioned image registration method can use an adaptive method to determine more accurate image blocks, thereby determining a more accurate motion model of the image blocks. Even for some complex scenes, such as a mixture of far and near objects, or some scenes with severe lens distortion, more accurate image blocks can be obtained. Compared with the traditional method of rigidly dividing image blocks, the above-mentioned image registration method has stronger adaptability and robustness.
[0082] In one embodiment, after registering the first image and the second image, the electronic device can also estimate the scene depth for the registered first image and the second image, and the fit for the object depth information is better than other global models.
[0083] In one embodiment, after determining the new image block to which the feature point belongs based on each correlation value, the method further includes: determining the changed feature points of the first image to which the image block belongs; if the statistical parameters of the feature points belonging to the changed image block do not meet the preset termination conditions, continuing to execute the step of updating the motion model of the image block according to the feature points belonging to the image block.
[0084] The preset termination condition can be set as needed. For example, the preset termination condition is that the number of feature points belonging to the changed image block is less than the preset number, the ratio of the feature points belonging to the changed image block to the number of all pixels in the first image is less than the preset ratio threshold, etc.
[0085] Optionally, the electronic device determines the changed feature points belonging to the image block in the first image, and determines the statistical parameters of the changed feature points belonging to the image block; if the statistical parameters do not meet the preset termination conditions, then after the image block to which each feature point in the first image belongs is determined, for each image block, according to each feature point belonging to the image block, the motion model of the image block is updated to obtain a new motion model of the image block; if the statistical parameters meet the preset termination conditions, the motion model of each pixel in the first image is determined based on the new motion models of each image block.
[0086] Optionally, after obtaining the new motion model of the image block, the method further includes: returning to execute the step of determining, for the feature points belonging to each image block in the first image, the correlation values between the feature points and the reference points in each image block in the first image.
[0087] It can be understood that if the statistical parameters do not meet the preset termination conditions, then after the image blocks to which the various feature points in the first image belong are determined, for each image block, the motion model of the image block is updated according to the various feature points belonging to the image block to obtain a new motion model of the image block, and the execution is returned to the feature points belonging to each image block in the first image to determine the association values between the feature points and the reference points in each image block in the first image, thereby re-determining the new motion model of the image block.
[0088] In this embodiment, when the electronic device determines that the statistical parameters of the feature points belonging to the changed image block do not meet the preset termination conditions, it continues to update the motion model of the image block and can iteratively update the motion model to obtain a more accurate motion model of the image block.
[0089] In one embodiment, for feature points belonging to each image block in the first image, association values between the feature points and reference points in each image block in the first image are determined, including: for feature points belonging to each image block in the first image, traversing the reference points in each image block and determining the distance and matching error between the feature points and the reference points; and determining the association value between the feature points and the reference points based on the distance and the matching error.
[0090] Optionally, the association value between the feature point and the reference point is negatively correlated with the distance; the association value between the feature point and the reference point is negatively correlated with the matching error.
[0091] Optionally, for each image block, the electronic device determines each feature point belonging to the image block, determines the average position of each feature point of the image block, and uses the pixel point of the average position as the reference point of the image block. The pixel point of the average position of each feature point of the image block is the center of gravity of the image block.
[0092] Optionally, for the feature points belonging to each image block in the first image and the reference points within each image block, the electronic device uses the following formula to calculate the association value between the feature points and the reference points: w=1 / (E(PN,A)+d*α); wherein w is the association value, which can also be considered as the probability (weight) that the feature point belongs to the image block where the reference point is located, E(PN,A) is the matching error between the feature point and the reference point, d is the distance between the feature point and the reference point, and α is a pre-adjusted coefficient.
[0093] Exemplarily, for the reference point CA of image block A and the reference point CB of image block B, for any feature point in the first image, the matching error between the feature point and the reference point CA is determined to be E(PN, A), the distance between the feature point and the reference point CA is dA, and the correlation value between the feature point and the reference point CA of image block A is w1=1 / (E(PN, A)+dA*α); the matching error between the feature point and the reference point CB is determined to be E(PN, B), the distance between the feature point and the reference point CB is dB, and the correlation value between the feature point and the reference point CB of image block B is w2=1 / (E(PN, B)+dB*α); the electronic device can compare the size of the correlation values w1 and w2, and use the image block where the reference point corresponding to the larger correlation value is located as the new image block to which the feature point belongs.
[0094] In this embodiment, the electronic device traverses the reference points in each image block for the feature points belonging to each image block in the first image, and determines the distance and matching error between the feature points and the reference points. Based on the distance and matching error, the association value between the feature points and the reference points can be accurately determined.
[0095] In one embodiment, before updating the motion model of the image block, it also includes: matching feature points in the first image with feature points in the second image to determine matching feature point pairs; the feature point pairs include feature points in the first image and feature points in the second image; for each image block in the first image, determining the motion model of the image block based on the matching feature point pairs in the image block.
[0096] Optionally, the electronic device divides the first image into blocks to obtain at least two image blocks; for each image block, based on corresponding pixel pairs in the image block, a motion model of the image block is calculated using a least squares method.
[0097] In this embodiment, the electronic device matches the feature points in the first image with the feature points in the second image to determine matching feature point pairs. For each image block in the first image, the motion model of the image block can be accurately determined based on the matching feature point pairs in the image block.
[0098] In one embodiment, another image registration method is provided, which is applied to an electronic device and includes the following steps:
[0099] Step A1, matching feature points in the first image with feature points in the second image to determine matching feature point pairs; the feature point pairs include feature points in the first image and feature points in the second image.
[0100] Step A2: for each image block in the first image, determine a motion model of the image block based on matching feature point pairs in the image block.
[0101] Step A3, for the feature points belonging to each image block in the first image, traverse the reference points in each image block, and determine the distance and matching error between the feature points and the reference points; based on the distance and matching error, determine the association value between the feature points and the reference points, and determine the new image block to which the feature points belong based on each association value; the association value between the feature points and the reference points is negatively correlated with the distance; the association value between the feature points and the reference points is negatively correlated with the matching error.
[0102] Step A4, after the image blocks to which each feature point in the first image belongs are determined, feature points in the first image whose image blocks are changed are determined.
[0103] Step A5: If the statistical parameters of the feature points belonging to the changed image blocks do not meet the preset termination conditions, then for each image block, the motion model of the image block is updated according to the feature points belonging to the image block to obtain a new motion model of the image block, and the process returns to step A3.
[0104] Step A6: for each pixel in the first image, based on the position of the pixel, determine the feature points adjacent to the pixel.
[0105] Step A7, determining the motion model of the pixel point from the motion models of the image blocks to which each adjacent feature point belongs.
[0106] Step A8: registering the first image and the second image based on the motion model of each pixel in the first image.
[0107] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0108] Based on the same inventive concept, the embodiment of the present application also provides an image registration device for implementing the above-mentioned image registration method. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above-mentioned method, so the specific limitations in one or more image registration device embodiments provided below can refer to the limitations of the image registration method above, and will not be repeated here.
[0109] In one embodiment, Figure 8 As shown, an image registration device is provided, comprising: a feature point attribution determination module 802, an image block motion model update module 804, a pixel point motion model determination module 806 and a registration module 808, wherein:
[0110] The feature point attribution determination module 802 is used to determine the association values between the feature points and the reference points in each image block in the first image for the feature points belonging to each image block in the first image, and determine the new image block to which the feature points belong based on each association value.
[0111] The image block motion model updating module 804 is used to update the motion model of the image block according to each feature point belonging to the image block after the image block to which each feature point in the first image belongs is determined, so as to obtain a new motion model of the image block.
[0112] The pixel motion model determination module 806 is used to determine the motion model of each pixel in the first image based on the new motion model of each image block.
[0113] The registration module 808 is used to register the first image and the second image based on the motion model of each pixel in the first image.
[0114] The above-mentioned image registration device determines, for the feature points belonging to each image block in the first image, the association values between the feature points and the reference points in each image block in the first image, and based on the respective association values, can accurately determine the image block to which the feature points newly belong; after the image block to which each feature point in the first image belongs is determined, for each image block, according to each feature point belonging to the image block, the motion model of the image block is updated, and a more accurate new motion model of the image block can be obtained, so that the motion model of each pixel in the first image can be determined, and then the first image and the second image can be more accurately registered, thereby improving the accuracy of image registration.
[0115] In one embodiment, the motion model update module 804 of the image block is also used to determine the feature points of the first image that belong to the changed image block; if the statistical parameters of the feature points belonging to the changed image block do not meet the preset termination conditions, the motion model of the image block is updated according to the feature points belonging to the image block.
[0116] In one embodiment, after obtaining a new motion model of the image block, the feature point attribution determination module 802 is further used to determine the association values between the feature points and the reference points in each image block in the first image, for the feature points belonging to each image block in the first image.
[0117] In one embodiment, the feature point attribution determination module 802 is also used to traverse the reference points in each image block for the feature points attributable to each image block in the first image, and determine the distance and matching error between the feature points and the reference points; based on the distance and matching error, determine the association value between the feature points and the reference points.
[0118] In one embodiment, the correlation value between the feature point and the reference point is negatively correlated with the distance; the correlation value between the feature point and the reference point is negatively correlated with the matching error.
[0119] In one embodiment, the pixel motion model determination module 806 is also used to determine, for each pixel in the first image, feature points adjacent to the pixel based on the position of the pixel; and to determine the motion model of the pixel from the motion models of the image blocks to which each adjacent feature point belongs.
[0120] In one embodiment, the motion model update module 804 of the above-mentioned image block is also used to match the feature points in the first image and the feature points in the second image to determine matching feature point pairs; the feature point pairs include feature points in the first image and feature points in the second image; for each image block in the first image, the motion model of the image block is determined based on the matching feature point pairs in the image block.
[0121] Each module in the above-mentioned image registration device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in an electronic device in the form of hardware, or can be stored in a memory in an electronic device in the form of software, so that the processor can call and execute operations corresponding to each module above.
[0122] In one embodiment, an electronic device is provided. The electronic device may be a terminal, and its internal structure diagram may be as follows: Fig. 9 As shown. The electronic device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the electronic device is used to exchange information between the processor and an external device. The communication interface of the electronic device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, an image registration method is implemented. The display unit of the electronic device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the electronic device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the electronic device casing, or an external keyboard, touchpad or mouse.
[0123] Those skilled in the art will understand that Fig. 9The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the electronic device to which the scheme of the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0124] The embodiment of the present application further provides a computer-readable storage medium, one or more non-volatile computer-readable storage media containing computer-executable instructions, which, when executed by one or more processors, enable the processors to perform the steps of the image registration method.
[0125] An embodiment of the present application also provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the image registration method.
[0126] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
[0127] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0128] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0129] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. An image registration method, characterized in that: include: For a feature point belonging to each image block in the first image, determining a correlation value between the feature point and a reference point in each image block in the first image, and determining a new image block to which the feature point belongs based on each correlation value; After the image blocks to which each feature point in the first image belongs are determined, for each image block, a motion model of the image block is updated according to each feature point belonging to the image block to obtain a new motion model of the image block; Determining a motion model for each pixel in the first image based on the new motion model of each image block; The first image and the second image are registered based on a motion model of each pixel in the first image.
2. The method according to claim 1, characterized in that After determining the new image block to which the feature point belongs based on each correlation value, the method further includes: Determine a feature point in the first image where the attributed image block changes; If the statistical parameters of the feature points belonging to the changed image block do not meet the preset termination condition, the step of updating the motion model of the image block according to the feature points belonging to the image block is continued.
3. The method according to claim 2, characterized in that After obtaining the new motion model of the image block, the method further includes: Return to the step of determining, for each feature point in the first image belonging to each image block, the association value between the feature point and the reference point in each image block in the first image.
4. The method according to claim 1, characterized in that: The step of determining, for each feature point in the first image belonging to each image block, an association value between the feature point and a reference point in each image block in the first image, comprises: For a feature point belonging to each image block in the first image, traverse the reference point in each image block, and determine the distance and matching error between the feature point and the reference point; Based on the distance and the matching error, an association value between the feature point and the reference point is determined.
5. The method according to claim 4, characterized in that The association value between the feature point and the reference point is negatively correlated with the distance; the association value between the feature point and the reference point is negatively correlated with the matching error.
6. The method according to claim 1, characterized in that The determining the motion model of each pixel in the first image based on the new motion model of each image block includes: For each pixel in the first image, determining a feature point adjacent to the pixel based on the position of the pixel; The motion model of the pixel point is determined from the motion models of the image blocks to which each adjacent feature point belongs.
7. The method according to any one of claims 1 to 6, characterized in that: Before updating the motion model of the image block, the method further includes: Matching feature points in the first image and feature points in the second image to determine a matching feature point pair; the feature point pair includes a feature point in the first image and a feature point in the second image; For each image block in the first image, a motion model of the image block is determined based on matching feature point pairs in the image block.
8. An image registration device, characterized in that: include: a feature point attribution determination module, configured to determine, for each feature point in the first image belonging to each image block, association values between the feature point and a reference point in each image block in the first image, and determine, based on each association value, the image block to which the feature point is newly attributed; an image block motion model updating module, configured to update the motion model of each image block according to each feature point belonging to the image block after the image block to which each feature point in the first image belongs is determined, so as to obtain a new motion model of the image block; A pixel motion model determination module, used to determine the motion model of each pixel in the first image based on the new motion model of each image block; A registration module is used to register the first image and the second image based on a motion model of each pixel in the first image.
9. An electronic device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the computer program is executed by the processor, the processor is caused to perform the steps of the image registration method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.