Image alignment method, device, electronic device and storage medium
By performing global image alignment on the processed images, extracting feature points from the region of interest for feature matching, and calculating the homography matrix, the problem of low image alignment accuracy in the existing technology is solved and higher image alignment accuracy is achieved.
Patent Information
- Application Number
- CN202111459872.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-02
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2041-12-02
AI Technical Summary
The feature-based image alignment method in the existing technology has poor scene adaptability and low accuracy due to uncertain factors such as lighting, depth of field and angle.
First, global image alignment is performed on the image to be processed. Then, feature points are extracted from the region of interest in the image to be processed and the region of interest in the reference image for feature matching. The homography matrix is calculated to achieve local alignment. Accurate alignment is achieved by aligning all regions of interest.
It reduces the influence of uncertain factors during image capture, can extract more feature points, improves the accuracy of image alignment, and is suitable for a variety of scenarios.
Smart Images

Figure CN114298902B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to an image alignment method, device, electronic device and storage medium. Background Art
[0002] Image alignment plays a vital role in image fusion, image stitching, and computer vision. It involves aligning two or more images captured at different times or angles to determine the mapping relationship between the spatial position, intensity, and other aspects of the images, thereby fusing multiple frames captured continuously over a short period of time into a single image. Existing feature-based image alignment methods first identify and match the feature points in the two images, then calculate a homography matrix to uniformly transform the pixel coordinates in the images for image alignment. However, in practice, due to uncertainties in the image capture process, such as lighting, depth of field, and angle, it is difficult to extract distinct feature points from the images being processed. This results in poor scene adaptability and low image alignment accuracy. Summary of the Invention
[0003] In order to solve the above technical problems or at least partially solve the above technical problems, the present application provides an image alignment method, device, electronic device and storage medium.
[0004] The present invention provides an image alignment method, which includes:
[0005] Acquire a first image and a second image, where the first image is the first image after global image alignment processing is performed based on the second image;
[0006] Extracting a plurality of first feature points from a first region of interest in the first image, and extracting a plurality of second feature points from a second region of interest in the second image; the first region of interest and the second region of interest have the same size and correspond in positions in the different images;
[0007] Performing feature matching on the plurality of first feature points and the plurality of second feature points, determining the coordinates of at least one first target feature point among the plurality of first feature points, and determining the coordinates of at least one second target feature point among the plurality of second feature points, and matching the at least one first target feature point with the at least one second target feature point;
[0008] Calculating a first homography matrix for pixel mapping according to the coordinates of at least one first target feature point and the coordinates of at least one second target feature point;
[0009] The pixel value of each pixel point in the first region of interest is mapped to the corresponding pixel point in the second region of interest based on the first homography matrix to obtain the first region of interest after image alignment.
[0010] In one embodiment, acquiring a first image includes:
[0011] Obtaining a histogram of the second image and determining a pixel value of each pixel in the second image;
[0012] According to the pixel value of each pixel in the second image, the pixel value of the pixel corresponding to the pixel position in the third image is set;
[0013] Extracting at least one first corner point in the third image and at least one second corner point in the second image according to the pixel value of each pixel in the second image and the set pixel value of each pixel in the third image;
[0014] Perform feature matching on at least one first corner point and at least one second corner point to determine a first target corner point among the at least one first corner point and a second target corner point among the at least one second corner point, and match the first target corner point with the second target corner point
[0015] Calculating a second homography matrix according to the coordinates of the first target corner point and the coordinates of the second target corner point;
[0016] Based on the second homography matrix, the pixel value of each pixel in the third image is mapped to the corresponding pixel in the second image to obtain the first image after global image alignment.
[0017] In one embodiment, the at least one feature matching is performed multiple times, and feature matching is performed on at least one first corner point and at least one second corner point, including:
[0018] Perform feature matching on at least one first corner point and at least one second corner point in units of N corner points;
[0019] Perform feature matching again on at least one first corner point and at least one second corner point, taking M corner points as a unit;
[0020] Wherein, N is a positive integer greater than M.
[0021] In one embodiment, calculating the second homography matrix according to the coordinates of the first target corner point and the coordinates of the second target corner point includes:
[0022] If the number of the first target corner points is greater than or equal to the preset number, calculating a second homography matrix according to the coordinates of the first target corner points and the coordinates of the second target corner points;
[0023] The method also includes:
[0024] If the number of the first target corner points is less than a preset number, extracting a plurality of first ORB feature points from the third image and extracting a plurality of second ORB feature points from the second image;
[0025] Performing feature matching on the plurality of first ORB feature points and the plurality of second ORB feature points, determining the coordinates of at least one first target ORB feature point among the plurality of first ORB feature points, and determining the coordinates of at least one second target ORB feature point among the plurality of second ORB feature points, and matching the at least one first target ORB feature point with the at least one second target ORB feature point;
[0026] A second homography matrix is calculated according to the coordinates of at least one first target ORB feature point and the coordinates of at least one second target ORB feature point.
[0027] In some embodiments, extracting a plurality of first feature points from a first region of interest in a first image, and extracting a plurality of second feature points from a second region of interest in a second image, comprises:
[0028] Performing target object detection on the first region of interest and the second region of interest;
[0029] determining a first target object map from the first region of interest, and determining a second target object map from the second region of interest;
[0030] A plurality of first feature points are extracted from the first target object graph, and a plurality of second feature points are extracted from the second target object graph.
[0031] In some embodiments, extracting a plurality of first feature points from the first target object graph and extracting a plurality of second feature points from the second target object graph includes:
[0032] identifying whether the first target object graph and the second target object graph contain the target object;
[0033] If the first target object graph and the second target object graph include a target object, a plurality of first ECC feature points are extracted from the first target object graph, and a plurality of second ECC feature points are extracted from the second target object graph.
[0034] In some embodiments, after determining the first target object graph from the first region of interest and determining the second target object graph from the second region of interest, the method further includes:
[0035] Obtaining a histogram of the second target object graph, and determining a pixel value of each pixel in the second target object graph;
[0036] According to the pixel value of each pixel in the second target object image, the pixel value of the pixel corresponding to the pixel position in the first target object image is set.
[0037] An embodiment of the present application provides an image alignment device, which includes:
[0038] An acquisition module, configured to acquire a first image and a second image, wherein the first image is a first image that has been subjected to global image alignment processing based on the second image;
[0039] an extraction module, configured to extract a plurality of first feature points from a first region of interest of the first image, and a plurality of second feature points from a second region of interest of the second image; the first region of interest and the second region of interest being of the same size and having corresponding positions in the different images;
[0040] a feature matching module, configured to perform feature matching on a plurality of first feature points and a plurality of second feature points, determine the coordinates of at least one first target feature point among the plurality of first feature points, and determine the coordinates of at least one second target feature point among the plurality of second feature points, and match the at least one first target feature point with the at least one second target feature point;
[0041] a calculation module, configured to calculate a first homography matrix for pixel mapping based on the coordinates of at least one first target feature point and the coordinates of at least one second target feature point;
[0042] The mapping module is used to map the pixel value of each pixel point in the first region of interest to the corresponding pixel point in the second region of interest based on the first homography matrix to obtain the first region of interest after image alignment.
[0043] In one embodiment, the acquisition module is specifically configured to acquire a histogram of the second image and determine a pixel value of each pixel in the second image;
[0044] According to the pixel value of each pixel in the second image, the pixel value of the pixel corresponding to the pixel position in the third image is set;
[0045] Extracting at least one first corner point in the third image and at least one second corner point in the second image according to the pixel value of each pixel in the second image and the set pixel value of each pixel in the third image;
[0046] Perform feature matching on at least one first corner point and at least one second corner point to determine a first target corner point among the at least one first corner point and a second target corner point among the at least one second corner point, and match the first target corner point with the second target corner point
[0047] Calculating a second homography matrix according to the coordinates of the first target corner point and the coordinates of the second target corner point;
[0048] Based on the second homography matrix, the pixel value of each pixel in the third image is mapped to the corresponding pixel in the second image to obtain the first image after global image alignment.
[0049] In one embodiment, the acquisition module is specifically configured to perform feature matching on at least one first corner point and at least one second corner point in units of N corner points;
[0050] Perform feature matching again on at least one first corner point and at least one second corner point, taking M corner points as a unit;
[0051] Wherein, N is a positive integer greater than M.
[0052] In one embodiment, the acquisition module is specifically configured to calculate a second homography matrix based on the coordinates of the first target corner points and the coordinates of the second target corner points if the number of the first target corner points is greater than or equal to a preset number;
[0053] The acquisition module is further configured to extract a plurality of first ORB feature points from the third image and a plurality of second ORB feature points from the second image if the number of the first target corner points is less than a preset number;
[0054] Performing feature matching on the plurality of first ORB feature points and the plurality of second ORB feature points, determining the coordinates of at least one first target ORB feature point among the plurality of first ORB feature points, and determining the coordinates of at least one second target ORB feature point among the plurality of second ORB feature points, and matching the at least one first target ORB feature point with the at least one second target ORB feature point;
[0055] A second homography matrix is calculated according to the coordinates of at least one first target ORB feature point and the coordinates of at least one second target ORB feature point.
[0056] In some embodiments, the extraction module is specifically configured to perform target object detection on the first region of interest and the second region of interest;
[0057] determining a first target object map from the first region of interest, and determining a second target object map from the second region of interest;
[0058] A plurality of first feature points are extracted from the first target object graph, and a plurality of second feature points are extracted from the second target object graph.
[0059] In some embodiments, the extraction module is specifically configured to identify whether the first target object graph and the second target object graph contain the target object;
[0060] If the first target object graph and the second target object graph include a target object, a plurality of first ECC feature points are extracted from the first target object graph, and a plurality of second ECC feature points are extracted from the second target object graph.
[0061] In some embodiments, the extraction module is specifically configured to obtain a histogram of the second target object graph and determine a pixel value of each pixel in the second target object graph;
[0062] According to the pixel value of each pixel in the second target object image, the pixel value of the pixel corresponding to the pixel position in the first target object image is set.
[0063] An embodiment of the present application provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the image alignment method provided in any embodiment of the present application are implemented.
[0064] An embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the image alignment method provided in any embodiment of the present application are implemented.
[0065] The technical solution provided by the embodiments of the present application has the following advantages over the prior art: the present application first performs global image alignment on the image to be processed, then extracts feature points from the first region of interest in the image to be processed and the second region of interest in the reference image for feature matching, obtains the coordinates of the matched feature points, and calculates the homography matrix to map the first region of interest to the second region of interest according to the homography matrix to achieve local alignment of the image to be processed, and achieves precise alignment of the image to be processed by aligning all regions of interest in the image to be processed, reducing the influence of uncertain factors in the image shooting process, being able to extract more feature points for image alignment, being suitable for a variety of scenarios, and improving the accuracy of image alignment. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0067] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0068] Figure 1 An application scenario of an image alignment method in one embodiment of this application Figure 1 ;
[0069] Figure 2 This is a flow chart of an image alignment method in one embodiment of the present application. Figure 1 ;
[0070] Figure 3 An application scenario of an image alignment method in one embodiment of this application Figure 2 ;
[0071] Figure 4 This is a schematic diagram of extracting a region of interest in one embodiment of the present application;
[0072] Figure 5 This is a flow chart of another image alignment method in one embodiment of the present application. Figure 2 ;
[0073] Figure 6 This is a flow chart of another image alignment method in one embodiment of the present application. Figure 3 ;
[0074] Figure 7 This is a structural block diagram of an image alignment device in one embodiment of the present application;
[0075] Figure 8 This is a diagram of the internal structure of an electronic device in one embodiment of the present application. DETAILED DESCRIPTION
[0076] In order to more clearly understand the above-mentioned objectives, features and advantages of the present application, the scheme of the present application will be further described below. It should be noted that, in the absence of conflict, the embodiments of the present application and the features therein can be combined with each other.
[0077] In the following description, many specific details are set forth to facilitate a full understanding of the present application, but the present application can also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present application, not all of the embodiments.
[0078] The feature-based image alignment method in the existing technology first finds the feature points in the two images and performs feature matching, and then calculates the homography matrix to uniformly transform the pixel coordinates in the images for image alignment. However, in actual operation, due to uncertain factors such as lighting, depth of field, and angle in the image shooting process, the images to be processed have obvious timestamps, obvious depth of field, large brightness differences, large field of view differences, and large image spatial domain changes, making it difficult to extract obvious feature points. As a result, this method has poor scene adaptability and low image alignment accuracy.
[0079] To solve the above problems, the present application first performs global image alignment on the image to be processed, and then extracts feature points from the first region of interest in the image to be processed and the second region of interest in the reference image for feature matching to obtain the coordinates of the matched feature points, thereby calculating the homography matrix, and mapping the first region of interest to the second region of interest according to the homography matrix to achieve local alignment of the image to be processed. By aligning all regions of interest in the image to be processed, accurate alignment of the image to be processed is achieved, which reduces the influence of uncertain factors in the image shooting process, can extract more feature points for image alignment, is suitable for a variety of scenarios, and improves the accuracy of image alignment.
[0080] The image alignment method provided in this application can be applied to Figure 1 In the application environment shown. The image alignment method is applied to an image alignment system. The image alignment system includes a terminal 102 and a server 104. The terminal 102 and the server 104 communicate through a network. Specifically, the image alignment method is applied to the terminal 102, and the terminal 102 performs global image alignment on the image to be processed, and then extracts feature points from a first region of interest in the image to be processed and a second region of interest in the reference image for feature matching, thereby obtaining the coordinates of the matched feature points, thereby calculating a homography matrix, and mapping the first region of interest to the second region of interest according to the homography matrix to achieve local alignment of the image to be processed, and achieving precise alignment of the image to be processed by aligning all regions of interest in the image to be processed.
[0081] In addition, the image alignment method is applied to the server 104 , which receives the image 106 to be processed sent by the terminal 102 , accurately aligns the image using the above image alignment method, and then returns the accurately aligned image 108 to the terminal 102 .
[0082] The terminal 102 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, and portable wearable devices, and the server 104 may be implemented as an independent server or a server cluster consisting of multiple servers.
[0083] like Figure 2 As shown, an image alignment method is provided. This application mainly applies this method to Figure 1 Take terminal 102 in FIG. 1 as an example.
[0084] S202: Acquire a first image and a second image.
[0085] Among them, the first image is an image obtained by performing global image alignment processing on the third image with the second image as the reference image; the third image is an image obtained from the terminal device serving as a comparison device, and is an image that requires global image alignment processing; the second image is an image obtained from the terminal device serving as a reference device; the second image and the third image are images of the same scene at different angles, or images of the same scene at different times.
[0086] In some embodiments, before acquiring the first image, a second image and a third image are acquired from different terminal devices, wherein the second image is a reference image and the third image is an image to be processed that requires global image alignment.
[0087] For example, Figure 3 As shown in the figure, the devices included are mobile phone 301, mobile phone 303, and server 305; the images include a second image 302, a third image 304, and a first image 306. First, second image 302 is obtained from mobile phone 301, which serves as a reference device, and third image 304 is obtained from mobile phone 303, which serves as a comparison device. Server 305 then performs global image alignment on the third image using second image 302 as a reference image to obtain first image 306.
[0088] The following describes a process of obtaining a first image by performing global image processing on a third image using the second image as a reference image.
[0089] In some embodiments, after obtaining the second image and the third image from different terminal devices, the histogram of the second image is obtained. Since the histogram represents the number of pixels at each brightness level of the image, it shows the distribution of pixels in the image and intuitively reflects the brightness and darkness of the picture. Therefore, the pixel value of each pixel in the second image can be determined according to the histogram of the second image; then, according to the pixel value of each pixel in the second image, the pixel value of the pixel corresponding to the pixel position in the third image is set by using histogram equalization, histogram normalization, etc., so as to adjust the brightness of the third image according to the second image, so that the pixel value of the pixel corresponding to the pixel position in the third image is set to the same as the pixel value of the pixel corresponding to the corresponding pixel position in the second image, so that the brightness of the third image is the same as that of the first image, so as to facilitate the extraction of feature points from the two images.
[0090] In some embodiments, the brightness of the third image can be adjusted by methods such as smoothing denoising and illumination equalization processing, including but not limited to the above methods, which are not limited in this application.
[0091] Furthermore, based on the pixel value of each pixel in the second image and the pixel value of each pixel in the set third image, at least one corner point in the brightness-adjusted third image is extracted, and at least one corner point in the second image is extracted, and the extracted corner points of the two images are matched.
[0092] Among them, a corner point is an isolated point with the maximum or minimum intensity in certain attributes, the end point of a line segment, or the point with the maximum local curvature on a curve, which is used to describe information such as corners and boundary points in the image. In this application, the Harris corner detection method is used to extract corners. It should be noted that the basic idea of the Harris corner detection method is to use a fixed window to slide in any direction on the image, and compare the degree of grayscale change of the pixels in the window before and after sliding. If there is a large grayscale change when sliding in any direction, it is considered that there is a corner point in the window. Extracting corner points through the Harris corner detection method improves the robustness to noise and improves the efficiency and stability of corner detection.
[0093] In some embodiments, during the corner point matching process, the extracted corner points in the third image and the corner points in the second image are feature matched at least once. First, when the scale is small and the image is blurry, feature matching is performed on N corner points as units to obtain a rough matching result of the corner points. Then, the scale is increased and feature matching is performed on M corner points as units until the scale is transformed to the original image size to complete the precise matching of the images, where N is a positive integer greater than M.
[0094] For example, during the corner point matching process, a rough matching is first performed in units of 10 corner points, and then the scale is increased to perform a precise matching in units of 4 corner points.
[0095] By performing at least one feature matching, rough matching and precise matching of the third image and the second image are achieved, thereby reducing the mismatching rate and improving the matching accuracy.
[0096] In some embodiments, after obtaining matching corner points through precise matching, optionally, if the number of the first target corner points is greater than or equal to a preset number, a second homography matrix is calculated based on the coordinates of the first target corner points and the coordinates of the second target corner points. The second homography matrix is a homography matrix used for performing global image processing on the third image.
[0097] If the number of the first target corner points is less than a preset number, a FAST (features from accelerated segment test) algorithm and a feature point neighborhood algorithm are used to extract a plurality of first oriented fast and rotated brief (ORB) feature points from the third image, and a plurality of second ORB feature points are extracted from the second image. Then, feature matching is performed between the plurality of first ORB feature points and the plurality of second ORB feature points, and the coordinates of at least one first target ORB feature point among the plurality of first ORB feature points are determined, and the coordinates of at least one second target ORB feature point among the plurality of second ORB feature points are determined. The at least one first target ORB feature point is matched with the at least one second target ORB feature point, and then, a second homography matrix is calculated based on the coordinates of the at least one first target ORB feature point and the coordinates of the at least one second target ORB feature point.
[0098] Through ORB feature matching, ORB feature points are extracted for feature matching, the matched ORB feature points are determined, and the coordinates corresponding to the ORB feature points are obtained, thereby calculating the homography matrix, which improves the accuracy and efficiency of feature matching.
[0099] Optionally, the present application uses a random sampling consensus algorithm to calculate the homography matrix and perform iterative updates to eliminate mismatched points and determine the optimal homography matrix.
[0100] By adjusting the brightness of the third image, the problem of brightness difference between the processed image and the reference image is solved, and the convenience of the feature matching process is improved; the third image is matched with the second image for multiple feature points, which reduces the mismatch rate and improves the matching accuracy; the optimal homography matrix is iteratively calculated through a random consensus algorithm to obtain the first image after global image alignment, achieving a better global image alignment effect.
[0101] S204, extracting a plurality of first feature points from a first region of interest of the first image, and extracting a plurality of second feature points from a second region of interest of the second image;
[0102] The first and second regions of interest are the same size and have corresponding positions in different images. The first region of interest is extracted from the first image according to a default size, which is set based on user experience, such as A×A in pixels or centimeters. Accordingly, the extraction principle of the second region of interest is the same as that of the first region of interest, and this application will not elaborate on this.
[0103] like Figure 4 As shown, Figure 4Schematic diagram of extracting a region of interest from an image. A window 402 with a size of A×A is set, and extraction starts from the upper left corner of the image 401 to obtain a region of interest 403 with a size of A×A.
[0104] It should be noted that in this application, multiple regions of interest of the image can be obtained by traversing the image according to the default size or preset size. The combination of multiple regions of interest is the original image before the regions of interest are extracted.
[0105] In some embodiments, a third region of interest (ROI) in the first image after global image alignment processing and a fourth region of interest (ROI) of a corresponding size in the second image are extracted according to a default size. Since the ROI selected according to the default size may be small and have fewer feature points, the user needs to set a preset size. In an embodiment of the present application, an implementation method is provided that first determines whether the third and fourth ROIs are smaller than a preset size. If the third and fourth ROIs are smaller than the preset size, the third ROI is expanded to obtain the first ROI, and the fourth ROI is expanded to obtain the second ROI. Optionally, the ROIs are expanded from their boundaries to obtain a larger ROI for easier feature point extraction.
[0106] In some embodiments, since there is a significant depth difference between the scene in the image and the background, the scene in the image is detected as a target object. First, target object detection is performed on the first region of interest and the second region of interest, a first target object map is determined from the first region of interest, and a second target object map is determined from the second region of interest. Then, it is determined whether the first region of interest and the second region of interest contain the target object.
[0107] When a target object is detected in the first region of interest and the second region of interest, feature extraction is performed on the first target object graph and the second target object graph, a plurality of first feature points are extracted from the first target object graph, and a plurality of second feature points are extracted from the second target object graph. The first feature point is a first corner point, and the second feature point is a second corner point, or the first feature point is a first ECC feature point, and the second feature point is a second ECC feature point.
[0108] In some embodiments, the scene in the image may be plants, animals, buildings, or other objects of interest in other image processing fields. The following describes the local alignment process when the scene in the image is a person.
[0109] In some embodiments, portrait detection is performed on the first and second regions of interest; after portrait detection, a first portrait mask for the first region of interest and a portrait mask for the second region of interest are obtained; based on the first and second portrait masks, a first portrait image is determined from the first region of interest, and a second portrait image is determined from the second region of interest; then, a plurality of first feature points are extracted from the first portrait image, and a plurality of second feature points are extracted from the second portrait image. The portrait is used as key information in the image, and a deep learning algorithm is used to perform portrait detection on the region of interest extracted from the image, extracting the portrait image, and achieving image alignment based on the portrait feature points in the portrait image.
[0110] In some embodiments, after determining a first portrait image from a first region of interest and a second portrait image from a second region of interest, it is necessary to further verify whether the portrait images contain a portrait. In an embodiment of the present application, an implementation method is provided: identifying whether the first and second portrait images contain a portrait; if the first and second portrait images contain a portrait, extracting multiple first feature points from the first portrait image and multiple second feature points from the second portrait image. Since it is verified that the first and second portrait images contain a portrait, and the feature points in the portraits are obvious and numerous, in order to improve the efficiency of feature matching, the first feature point is optionally a first corner point and the second feature point is a second corner point. Using the feature points as corner points ensures that the speed of feature matching is improved and the reliability of feature matching is improved when the number of feature points is large and obvious.
[0111] In some embodiments, if the first portrait image and the second portrait image contain a portrait, after feature matching is performed on the extracted corner points, the number of matched corner points obtained is less than a preset number, then a first entropy correlation coefficient (ECC) is calculated based on the first portrait image, and then a plurality of first ECC feature points are extracted from the first portrait image, and a plurality of second ECC feature points are extracted from the second portrait image. When it is determined that the portrait image contains a portrait, in order to avoid having too few corner points used to calculate the homography matrix after feature matching, it is necessary to extract ECC feature points based on the ECC feature matching method while ensuring that the photometric distortion of contrast and brightness remains unchanged, so as to better perform feature matching on the basis of containing the portrait in the image, so as to calculate a homography matrix with higher accuracy, thereby improving the accuracy of image alignment and achieving a better image alignment effect. In some embodiments, after determining a first portrait image from a first region of interest and a second portrait image from a second region of interest, a histogram of the second portrait image is optionally obtained, and a pixel value of each pixel in the second portrait image is determined; based on the pixel value of each pixel in the second portrait image, the pixel value of the pixel corresponding to the pixel position in the first portrait image is set. After determining the portrait image in the image, the brightness of the portrait image in the processed image is adjusted based on the histogram of the portrait image extracted from the reference image to reduce the impact of brightness differences on feature point extraction, improve the accuracy of feature matching, and thus enhance the accuracy of image alignment. If it is detected that no target object exists in the first and second regions of interest, a histogram of the second region of interest is first obtained, and the pixel value of each pixel in the second region of interest is determined. The pixel value of each pixel in the first region of interest is then set accordingly, so that the brightness of the first region of interest is adjusted using the second region of interest as a reference. Furthermore, at least one corner point is extracted from the first region of interest, and at least one corner point is extracted from the second region of interest. The extracted corner points of the first and second regions of interest are matched, and then a first homography matrix is calculated, which is used for image alignment.
[0112] In some embodiments, when the corner points of the first and second regions of interest extracted above are less than a preset number, since there is no target object in the first and second regions of interest and the number of corner points is small, in order to avoid the error of the first homography matrix calculated when the number of matched corner points is less than the preset number, which is not conducive to image alignment, the embodiment of the present disclosure provides an implementation method, first extracting ECC feature points from the first region of interest after adjusting the brightness, and extracting ECC feature points from the second region of interest, the ECC feature points are feature points with high feature matching accuracy, so that accurate feature matching can be performed when there is no obvious target object in the first and second ECC feature points, thereby achieving feature matching by extracting ECC feature points when there is no obvious scene in the image, thereby improving the accuracy of image alignment and obtaining a better image alignment effect.
[0113] In the above embodiment, target object detection is performed in the first image to obtain a target object map, thereby extracting feature points. If the target object is included in the target object map, corner points are extracted as feature points. To ensure the accuracy of feature matching, ECC feature points are extracted as feature points. If the target object is not included in the target object map, brightness adjustment is performed based on a reference region of interest, and corner points of the region of interest are extracted for use in at least one subsequent feature matching. Separate processing is performed based on whether the image contains the target object, ensuring the accuracy of the extracted feature points for use in subsequent feature point matching, thereby improving the accuracy of image alignment.
[0114] S206 , performing feature matching on the plurality of first feature points and the plurality of second feature points, determining the coordinates of at least one first target feature point among the plurality of first feature points, and determining the coordinates of at least one second target feature point among the plurality of second feature points.
[0115] Wherein, at least one first target feature point is matched with at least one second target feature point.
[0116] In some embodiments, the present application performs feature matching based on the corner points extracted after the target object is detected as described above.
[0117] In some embodiments, the number of the determined target feature points is more than 3 pairs required to calculate the homography matrix.
[0118] In some embodiments, when the number of corner points does not reach the three pairs required to calculate the homography matrix, the present application extracts ECC feature points according to the above steps for feature matching. The feature matching methods include but are not limited to accelerated robust features (Speeded Up Robust Feature, SURF), scale-invariant feature transform (Scale Invariant Feature Transform, SIFT), and accelerated segmentation test features (Features from Accelerated Segment Test, FAST). This application does not limit this.
[0119] In some embodiments, the present application performs feature matching based on the corner points extracted after the target object is not detected as described above, and performs at least one feature matching that is the same as in the global image alignment process. First, when the scale is small and the image is blurry, feature matching is performed on N corner points as units to obtain a rough matching result of the corner points. Then, the scale is increased and feature matching is performed on M corner points as units until the scale is transformed to the original image size to complete the precise matching of the image, where N is a positive integer greater than M.
[0120] S208 : Calculate a first homography matrix for pixel mapping according to the coordinates of at least one first target feature point and the coordinates of at least one second target feature point.
[0121] In some embodiments, after identifying that a target object is included in the first target object graph and a target object is included in the second target object graph, the coordinates of at least one target feature point and the coordinates of at least one second target feature point are determined, wherein the at least one first target feature point is at least one first ECC target feature point and the at least one second target feature point is at least one second ECC target feature point determined by an ECC feature matching method.
[0122] In some embodiments, after identifying that the target object is included in the first target object map and that the target object is not included in the second target object map, the target corner coordinates are determined based on Harris corner point detection and feature matching in the area of interest, and the homography matrix is calculated and iteratively updated using a random sampling consensus algorithm to eliminate mismatched points and determine the optimal homography matrix.
[0123] S210 , mapping the pixel value of each pixel point in the first region of interest to the corresponding pixel point in the second region of interest based on the first homography matrix to obtain the first region of interest after image alignment.
[0124] In some embodiments, the first ROI after image alignment is cropped and outputted. If the first ROI is an expanded ROI, cropping is performed according to the size of the expanded ROI, and the expanded ROI is outputted.
[0125] In some embodiments, regions of interest are extracted from the first image and the second image multiple times, and steps S204 to S210 are performed again until each region of interest in the first image is aligned. All aligned regions of interest in the first image are then output to obtain a fully aligned first image. By dividing the first image into multiple regions of interest and performing the aforementioned alignment operation on each of these regions of interest, precise image alignment is achieved, thereby improving the accuracy of image alignment.
[0126] In summary, the present application first performs global image alignment on the image to be processed, and then extracts feature points from the first region of interest in the image to be processed and the second region of interest in the reference image for feature matching to obtain the coordinates of the matched feature points, thereby calculating the homography matrix, and mapping the first region of interest to the second region of interest according to the homography matrix to achieve local alignment of the image to be processed. By aligning all regions of interest in the image to be processed, accurate alignment of the image to be processed is achieved, which reduces the influence of uncertain factors in the image shooting process, can extract more feature points for image alignment, is suitable for a variety of scenarios, and improves the accuracy of image alignment.
[0127] Figure 5 2 is a flow chart of another image alignment method provided by an embodiment of the present disclosure. This embodiment is a further expansion and optimization based on the above embodiment, wherein a possible implementation of S202 is as follows:
[0128] S502: Acquire a histogram of the second image and determine a pixel value of each pixel in the second image.
[0129] S504: Setting the pixel value of the pixel point corresponding to the pixel position in the third image according to the pixel value of each pixel point in the second image.
[0130] S506: Extract at least one first corner point in the third image and at least one second corner point in the second image according to the pixel value of each pixel in the second image and the set pixel value of each pixel in the third image.
[0131] S508: Perform feature matching on at least one first corner point and at least one second corner point in units of N corner points.
[0132] S510: Perform feature matching again on at least one first corner point and at least one second corner point in units of M corner points.
[0133] Wherein, N is a positive integer greater than M.
[0134] S512: Determine a first target corner point among the at least one first corner point and a second target corner point among the at least one second corner point.
[0135] S514, calculating a second homography matrix according to the coordinates of the first target corner point and the coordinates of the second target corner point;
[0136] S516 , based on the second homography matrix, mapping the pixel value of each pixel in the third image to the corresponding pixel in the second image, to obtain the first image after global image alignment.
[0137] By adjusting the brightness of the third image to obtain the first image, the problem of brightness difference between the image to be processed and the reference image is solved, and the convenience of the feature matching process is improved; the optimal homography matrix is iteratively calculated through a random consensus algorithm to obtain the first image after global image alignment, achieving a better global image alignment effect; the third image is matched with the second image for multiple feature points, which reduces the mismatch rate and improves the matching accuracy.
[0138] Figure 6 2 is a flow chart of another image alignment method provided by an embodiment of the present disclosure. This embodiment is a further expansion and optimization based on the above embodiment, wherein a possible implementation of S205 is as follows:
[0139] S602: Perform target object detection on the first region of interest and the second region of interest.
[0140] S604: Determine a first target object graph from the first region of interest, and determine a second target object graph from the second region of interest.
[0141] S606: Obtain a histogram of the second target object graph, and determine a pixel value of each pixel in the second target object graph.
[0142] S608: According to the pixel value of each pixel in the second target object map, set the pixel value of the pixel corresponding to the pixel position in the first target object map.
[0143] S610: Identify whether the first target object graph and the second target object graph contain a target object.
[0144] S612: If the first target object graph and the second target object graph include a target object, extract a plurality of first ECC feature points from the first target object graph, and extract a plurality of second ECC feature points from the second target object graph.
[0145] By performing target object detection on the region of interest of the image, a target object map is obtained, and the brightness of the target object map corresponding to the image to be processed is adjusted to determine whether the region of interest contains the target object, which is important information. Then, ECC feature points related to the target object are extracted, thereby extracting obvious feature points for image alignment, reducing the influence of other interference factors during the image shooting process and improving the accuracy of image alignment.
[0146] It should be understood that although Figure 2-4 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. In addition, Figure 2-4 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0147] like Figure 7 As shown, the embodiment of the present application provides an image alignment device, including: an acquisition module 702, an extraction module 704, a feature matching module 706, a calculation module 708 and a mapping module 710, wherein:
[0148] An acquisition module 702 is configured to acquire a first image and a second image, where the first image is the first image after global image alignment processing is performed based on the second image;
[0149] an extraction module 704 for extracting a plurality of first feature points from a first region of interest in the first image, and a plurality of second feature points from a second region of interest in the second image; the first region of interest and the second region of interest being of the same size and having corresponding positions in the different images;
[0150] a feature matching module 706 for performing feature matching on the plurality of first feature points and the plurality of second feature points, determining the coordinates of at least one first target feature point among the plurality of first feature points, and determining the coordinates of at least one second target feature point among the plurality of second feature points, and matching the at least one first target feature point with the at least one second target feature point;
[0151] a calculation module 708, configured to calculate a first homography matrix for pixel mapping based on the coordinates of at least one first target feature point and the coordinates of at least one second target feature point;
[0152] The mapping module 710 is configured to map the pixel value of each pixel point in the first region of interest to the corresponding pixel point in the second region of interest based on the first homography matrix to obtain the first region of interest after image alignment.
[0153] In one embodiment, the acquisition module 702 is specifically configured to acquire a histogram of the second image and determine a pixel value of each pixel in the second image;
[0154] According to the pixel value of each pixel in the second image, the pixel value of the pixel corresponding to the pixel position in the third image is set;
[0155] Extracting at least one first corner point in the third image and at least one second corner point in the second image according to the pixel value of each pixel in the second image and the set pixel value of each pixel in the third image;
[0156] Performing feature matching on at least one first corner point and at least one second corner point, determining a first target corner point among the at least one first corner point and a second target corner point among the at least one second corner point, and matching the first target corner point with the second target corner point;
[0157] Calculating a second homography matrix according to the coordinates of the first target corner point and the coordinates of the second target corner point;
[0158] Based on the second homography matrix, the pixel value of each pixel in the third image is mapped to the corresponding pixel in the second image to obtain the first image after global image alignment.
[0159] In one embodiment, the acquisition module 702 is specifically configured to perform feature matching on at least one first corner point and at least one second corner point in units of N corner points;
[0160] Perform feature matching again on at least one first corner point and at least one second corner point, taking M corner points as a unit;
[0161] Wherein, N is a positive integer greater than M.
[0162] In one embodiment, the acquisition module 702 is specifically configured to calculate a second homography matrix based on the coordinates of the first target corner points and the coordinates of the second target corner points if the number of the first target corner points is greater than or equal to a preset number;
[0163] The acquisition module 702 is further configured to extract a plurality of first ORB feature points from the third image and a plurality of second ORB feature points from the second image if the number of the first target corner points is less than a preset number;
[0164] Performing feature matching on the plurality of first ORB feature points and the plurality of second ORB feature points, determining the coordinates of at least one first target ORB feature point among the plurality of first ORB feature points, and determining the coordinates of at least one second target ORB feature point among the plurality of second ORB feature points, and matching the at least one first target ORB feature point with the at least one second target ORB feature point;
[0165] A second homography matrix is calculated according to the coordinates of at least one first target ORB feature point and the coordinates of at least one second target ORB feature point.
[0166] In some embodiments, the extraction module 704 is specifically configured to perform target object detection on the first region of interest and the second region of interest;
[0167] determining a first target object map from the first region of interest, and determining a second target object map from the second region of interest;
[0168] A plurality of first feature points are extracted from the first target object graph, and a plurality of second feature points are extracted from the second target object graph.
[0169] In some embodiments, the extraction module 704 is specifically configured to identify whether the first target object graph and the second target object graph contain the target object;
[0170] If the first target object graph and the second target object graph include a target object, a plurality of first ECC feature points are extracted from the first target object graph, and a plurality of second ECC feature points are extracted from the second target object graph.
[0171] In some embodiments, the extraction module 704 is specifically configured to obtain a histogram of the second target object graph and determine a pixel value of each pixel in the second target object graph;
[0172] According to the pixel value of each pixel in the second target object image, the pixel value of the pixel corresponding to the pixel position in the first target object image is set.
[0173] This application first performs global image alignment on the image to be processed, and then extracts feature points from the first region of interest in the image to be processed and the second region of interest in the reference image for feature matching to obtain the coordinates of the matched feature points, thereby calculating the homography matrix to map the first region of interest to the second region of interest according to the homography matrix to achieve local alignment of the image to be processed. By aligning all regions of interest in the image to be processed, accurate alignment of the image to be processed is achieved, which reduces the influence of uncertain factors in the image shooting process, can extract more feature points for image alignment, is suitable for a variety of scenarios, and improves the accuracy of image alignment.
[0174] The specific definition of the image alignment device can be found in the definition of the image alignment method above and will not be repeated here. Each module in the above-mentioned image alignment device can be implemented in whole or in part through software, hardware, or a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory of the computer device in software form, so that the processor can call and execute the corresponding operations of each of the above modules.
[0175] It is worth noting that in the embodiment of the above-mentioned image alignment device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application.
[0176] In one embodiment, an electronic device is provided. The electronic device may be a terminal, and its internal structure diagram may be as follows: Figure 8 As shown. The electronic device includes a processor, a memory, a communication interface, a display screen and an input device connected via a system bus. 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 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 achieved through WIFI, an operator network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, an XXX method is implemented. The display screen of the electronic device 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 provided on the electronic device housing, or an external keyboard, touchpad or mouse.
[0177] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the electronic device to which the solution 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 component arrangement.
[0178] In one embodiment, the image alignment device provided by the present application can be implemented in the form of a computer program. The computer program can be used in Figure 8 The memory of the electronic device may store various program modules constituting the image alignment device, such as: Figure 7The illustrated acquisition module 702, extraction module 704, feature matching module 706, calculation module 708 and mapping module 710. The computer program composed of various program modules enables the processor to execute the steps of the image alignment method of various embodiments of the present application described in this specification.
[0179] For example, Figure 8 The electronic device shown can be Figure 7 In the illustrated image alignment apparatus, the acquisition module 702 acquires a first image and a second image, where the first image is the first image after global image alignment based on the second image. The electronic device can use the extraction module 704 to extract a plurality of first feature points from a first region of interest (ROI) in the first image and a plurality of second feature points from a second region of interest (ROI) in the second image. The first and second ROIs have the same size and correspond in position in the different images. The electronic device can use the feature matching module 706 to perform feature matching between the plurality of first feature points and the plurality of second feature points, determining the coordinates of at least one first target feature point among the plurality of first feature points and the coordinates of at least one second target feature point among the plurality of second feature points. The at least one first target feature point is matched with the at least one second target feature point. The electronic device can use the calculation module 708 to calculate a first homography matrix for pixel mapping based on the coordinates of the at least one first target feature point and the coordinates of the at least one second target feature point. The electronic device can use the mapping module 710 to map the pixel values of each pixel in the first ROI to the corresponding pixel in the second ROI based on the first homography matrix, thereby obtaining the first ROI after image alignment.
[0180] In one embodiment, a computer device is further provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps in the above method embodiments when executing the computer program.
[0181] In summary, the present application first performs global image alignment on the image to be processed, and then extracts feature points from the first region of interest in the image to be processed and the second region of interest in the reference image for feature matching to obtain the coordinates of the matched feature points, thereby calculating the homography matrix, and mapping the first region of interest to the second region of interest according to the homography matrix to achieve local alignment of the image to be processed. By aligning all regions of interest in the image to be processed, accurate alignment of the image to be processed is achieved, which reduces the influence of uncertain factors in the image shooting process, can extract more feature points for image alignment, is suitable for a variety of scenarios, and improves the accuracy of image alignment.
[0182] In one embodiment, a computer-readable storage medium is further provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0183] By aligning all regions of interest in the image to be processed, accurate alignment of the image to be processed is achieved, reducing the influence of uncertain factors in the image shooting process, and being able to extract more feature points for image alignment. It is suitable for a variety of scenarios and improves the accuracy of image alignment.
[0184] The computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0185] Through the above description of the implementation methods, those skilled in the art can clearly understand that the present application can be implemented with the help of software and necessary general-purpose hardware, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as a computer's floppy disk, read-only memory (ROM), random access memory (RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0186] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.
[0187] The foregoing description is intended only to provide specific embodiments of the present application, which will enable those skilled in the art to understand and implement the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application is not limited to the embodiments described herein, but is intended to be construed in the broadest manner consistent with the principles and novel features disclosed herein.
Claims
1. An image alignment method, characterized in that: include: Acquire a first image and a second image, where the first image is the first image after global image alignment processing is performed based on the second image; Extracting a plurality of first feature points from a first region of interest in the first image, and extracting a plurality of second feature points from a second region of interest in the second image; the first region of interest and the second region of interest have the same size and correspond in positions in different images; Performing feature matching on the plurality of first feature points and the plurality of second feature points, determining the coordinates of at least one first target feature point among the plurality of first feature points, and determining the coordinates of at least one second target feature point among the plurality of second feature points, wherein the at least one first target feature point is matched with the at least one second target feature point; Calculating a first homography matrix for pixel mapping according to the coordinates of the at least one first target feature point and the coordinates of the at least one second target feature point; Mapping the pixel value of each pixel point in the first region of interest to the corresponding pixel point in the second region of interest based on the first homography matrix to obtain a first region of interest after image alignment; The acquiring of the first image comprises: Obtaining a histogram of the second image and determining a pixel value of each pixel in the second image; According to the pixel value of each pixel in the second image, the pixel value of the pixel corresponding to the pixel position in the third image is set; Extracting at least one first corner point in the third image and at least one second corner point in the second image according to the pixel value of each pixel in the second image and the set pixel value of each pixel in the third image; Perform feature matching on the at least one first corner point and the at least one second corner point to determine a first target corner point among the at least one first corner point and a second target corner point among the at least one second corner point, wherein the first target corner point is matched with the second target corner point. Calculating a second homography matrix according to the coordinates of the first target corner point and the coordinates of the second target corner point; Based on the second homography matrix, the pixel value of each pixel in the third image is mapped to the corresponding pixel in the second image to obtain a first image after global image alignment.
2. The method according to claim 1, characterized in that The performing feature matching on the at least one first corner point and the at least one second corner point includes: Performing feature matching on the at least one first corner point and the at least one second corner point in units of N corner points; Performing feature matching again on the at least one first corner point and the at least one second corner point in units of M corner points; Wherein, N is a positive integer greater than M.
3. The method according to claim 1, characterized in that The calculating a second homography matrix according to the coordinates of the first target corner point and the coordinates of the second target corner point includes: If the number of the first target corner points is greater than or equal to a preset number, calculating the second homography matrix according to the coordinates of the first target corner points and the coordinates of the second target corner points; The method further comprises: If the number of the first target corner points is less than a preset number, extracting a plurality of first directional rapid rotation (ORB) feature points from the third image, and extracting a plurality of second ORB feature points from the second image; performing feature matching on the plurality of first ORB feature points and the plurality of second ORB feature points, determining coordinates of at least one first target ORB feature point among the plurality of first ORB feature points, and determining coordinates of at least one second target ORB feature point among the plurality of second ORB feature points, wherein the at least one first target ORB feature point is matched with the at least one second target ORB feature point; The second homography matrix is calculated according to the coordinates of the at least one first target ORB feature point and the coordinates of the at least one second target ORB feature point.
4. The method according to claim 1, wherein The extracting a plurality of first feature points from a first region of interest of the first image, and extracting a plurality of second feature points from a second region of interest of the second image, comprises: Performing target object detection on the first region of interest and the second region of interest; determining a first target object map from the first region of interest, and determining a second target object map from the second region of interest; A plurality of first feature points are extracted from the first target object graph, and a plurality of second feature points are extracted from the second target object graph.
5. The method according to claim 4, characterized in that The first feature point is a first entropy correlation coefficient ECC feature point, the second feature point is a second ECC feature point, and the extracting of a plurality of first feature points from the first target object graph and the extracting of a plurality of second feature points from the second target object graph include: identifying whether the first target object graph and the second target object graph contain a target object; If the first target object graph and the second target object graph include target objects, a plurality of first ECC feature points are extracted from the first target object graph, and a plurality of second ECC feature points are extracted from the second target object graph.
6. The method according to claim 4, characterized in that After determining a first target object graph from the first region of interest and determining a second target object graph from the second region of interest, the method further includes: Obtaining a histogram of the second target object graph, and determining a pixel value of each pixel in the second target object graph; According to the pixel value of each pixel point in the second target object map, the pixel value of the pixel point corresponding to the pixel position in the first target object map is set.
7. An image alignment device, characterized in that: include: an acquisition module, configured to acquire a first image and a second image, wherein the first image is a first image that has undergone global image alignment processing based on the second image; an extraction module, configured to extract a plurality of first feature points from a first region of interest of the first image, and a plurality of second feature points from a second region of interest of the second image; the first region of interest and the second region of interest being of the same size and having corresponding positions in different images; a feature matching module, configured to perform feature matching on the plurality of first feature points and the plurality of second feature points, determine the coordinates of at least one first target feature point among the plurality of first feature points, and determine the coordinates of at least one second target feature point among the plurality of second feature points, wherein the at least one first target feature point is matched with the at least one second target feature point; a calculation module, configured to calculate a first homography matrix for pixel mapping based on the coordinates of the at least one first target feature point and the coordinates of the at least one second target feature point; a mapping module, configured to map a pixel value of each pixel point in the first region of interest to a corresponding pixel point in the second region of interest based on the first homography matrix, so as to obtain a first region of interest after image alignment; The acquisition module acquires the first image and is specifically used to: Obtaining a histogram of the second image and determining a pixel value of each pixel in the second image; According to the pixel value of each pixel in the second image, the pixel value of the pixel corresponding to the pixel position in the third image is set; Extracting at least one first corner point in the third image and at least one second corner point in the second image according to the pixel value of each pixel in the second image and the set pixel value of each pixel in the third image; Perform feature matching on the at least one first corner point and the at least one second corner point to determine a first target corner point among the at least one first corner point and a second target corner point among the at least one second corner point, wherein the first target corner point is matched with the second target corner point. Calculating a second homography matrix according to the coordinates of the first target corner point and the coordinates of the second target corner point; Based on the second homography matrix, the pixel value of each pixel in the third image is mapped to the corresponding pixel in the second image to obtain a first image after global image alignment.
8. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements an image alignment method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that include: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the image alignment method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Panoramic image splicing method, device and system
CN110610457A