WO2022095596A1 - Image alignment method, image alignment apparatus and terminal device - Google Patents

Image alignment method, image alignment apparatus and terminal device Download PDF

Info

Publication number
WO2022095596A1
WO2022095596A1 PCT/CN2021/117471 CN2021117471W WO2022095596A1 WO 2022095596 A1 WO2022095596 A1 WO 2022095596A1 CN 2021117471 W CN2021117471 W CN 2021117471W WO 2022095596 A1 WO2022095596 A1 WO 2022095596A1
Authority
WO
WIPO (PCT)
Prior art keywords
grid area
image
grid
matching point
point
Prior art date
Application number
PCT/CN2021/117471
Other languages
French (fr)
Chinese (zh)
Inventor
林枝叶
Original Assignee
Oppo广东移动通信有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Publication of WO2022095596A1 publication Critical patent/WO2022095596A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/30Determination of transform parameters for the alignment of images, i.e. image registration
    • G06T7/33Determination of transform parameters for the alignment of images, i.e. image registration using feature-based methods

Definitions

  • the present application belongs to the technical field of image processing, and in particular, relates to an image alignment method, an image alignment apparatus, a terminal device and a computer-readable storage medium.
  • Image alignment technology is a very important and basic technology in image processing, which can be applied to many image processing tasks.
  • terminals such as mobile phones, AR glasses, and virtual reality devices are often integrated with multiple cameras, and the imaging principles used by different cameras may also be different. For example, there may be infrared cameras and RGB imaging cameras on the terminal. The images collected by cameras with different imaging principles can be considered as images of different modalities. At this time, images of different modalities need to be aligned to achieve stitching fusion.
  • image alignment technology should also be used to achieve different modalities such as Computed Tomography (CT) images and Magnetic Resonance Imaging (MRI). Stitching and fusion between images.
  • CT Computed Tomography
  • MRI Magnetic Resonance Imaging
  • the embodiments of the present application provide an image alignment method, an image alignment device, a terminal device, and a computer-readable storage medium, which can solve the problem that the existing method cannot find accurate matching point pairs between images of different modalities, so that different modalities cannot find accurate matching point pairs.
  • an embodiment of the present application provides an image alignment method, including:
  • the first target pixel corresponding to the first candidate matching point is searched from the second modal image, wherein the first target pixel
  • the cross-correlation information between the point and the corresponding first candidate matching point meets a preset cross-correlation condition
  • the first candidate matching point and the first matching point corresponding to the first candidate matching point is used as a set of matching point pairs between the first modal image and the second modal image;
  • a grid transformation matrix between the first grid area and the second grid area corresponding to the first grid area in the second modal image is obtained, wherein, The position of the first grid area in the first modal image is the same as the position of the second grid area corresponding to the first grid area in the second modal image;
  • an image alignment device including:
  • a determining module configured to determine at least two first candidate matching points in the first grid area for each first grid area pre-divided in the first modal image
  • a search module is configured to search, for each first candidate matching point in the first grid area, the first target pixel point corresponding to the first candidate matching point from the second modal image, wherein the The cross-correlation information between the first target pixel point and the corresponding first candidate matching point meets a preset cross-correlation condition;
  • the first processing module is configured to, if the first target pixel corresponding to the first candidate matching point is found from the second modal image, compare the first candidate matching point with the first candidate matching point.
  • the first target pixel point corresponding to the matching point is used as a set of matching point pairs between the first modal image and the second modal image;
  • a second processing module configured to obtain, according to the matching point pair, the difference between the first grid area and the second grid area corresponding to the first grid area in the second modal image A grid transformation matrix, wherein the position of the first grid area in the first modal image and the second grid area corresponding to the first grid area are in the second modal image the same location;
  • a transformation module configured to transform the second modal image into a target image aligned with respect to the first modal image according to each grid transformation matrix.
  • an embodiment of the present application provides a terminal device, including a memory, a processor, a display, and a computer program stored in the memory and running on the processor, characterized in that the processor executes the computer
  • the image alignment method as described above in the first aspect is implemented during the program.
  • an embodiment of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, implements the image alignment method described in the first aspect.
  • an embodiment of the present application provides a computer program product that, when the computer program product runs on a terminal device, enables the terminal device to execute the image alignment method described above in the first aspect.
  • FIG. 1 is a schematic flowchart of an image alignment method provided by an embodiment of the present application.
  • FIG. 2 is an exemplary schematic diagram of a distribution manner of a first candidate matching point in a first grid area provided by an embodiment of the present application;
  • FIG. 3 is a schematic flowchart of step S102 provided by an embodiment of the present application.
  • FIG. 4 is an exemplary schematic diagram of aligning the first modality image and the second modality image provided by an embodiment of the present application
  • FIG. 5 is a schematic structural diagram of an image alignment apparatus provided by an embodiment of the present application.
  • FIG. 6 is a schematic structural diagram of a terminal device provided by an embodiment of the present application.
  • the term “if” may be contextually interpreted as “when” or “once” or “in response to determining” or “in response to detecting “.
  • the phrases “if it is determined” or “if the [described condition or event] is detected” may be interpreted, depending on the context, to mean “once it is determined” or “in response to the determination” or “once the [described condition or event] is detected. ]” or “in response to detection of the [described condition or event]”.
  • references in this specification to "one embodiment” or “some embodiments” and the like mean that a particular feature, structure or characteristic described in connection with the embodiment is included in one or more embodiments of the present application.
  • appearances of the phrases “in one embodiment,” “in some embodiments,” “in other embodiments,” “in other embodiments,” etc. in various places in this specification are not necessarily All refer to the same embodiment, but mean “one or more but not all embodiments” unless specifically emphasized otherwise.
  • the terms “including”, “including”, “having” and their variants mean “including but not limited to” unless specifically emphasized otherwise.
  • the image alignment method provided by the embodiments of the present application can be applied to servers, desktop computers, mobile phones, tablet computers, wearable devices, in-vehicle devices, augmented reality (AR)/virtual reality (VR) devices, and notebook computers , ultra-mobile personal computer (ultra-mobile personal computer, UMPC), netbook, personal digital assistant (personal digital assistant, PDA) and other terminal equipment, the embodiment of the present application does not make any restrictions on the specific type of the terminal equipment.
  • the similarity between pixels can be measured through the cross-correlation information, so as to find the exact matching point pair between the first modal image and the second modal image, which can reduce the number of different modalities.
  • the interference caused by the difference in the gradient direction of the images in the structurally similar regions also ensures the alignment accuracy of the final target image accordingly.
  • FIG. 1 shows a flowchart of an image alignment method provided by an embodiment of the present application, and the image alignment method can be applied to a terminal device.
  • the image alignment method may include:
  • Step S101 for each first grid area pre-divided in the first modal image, determine at least two first candidate matching points in the first grid area.
  • the first modality image and the second modality image may be considered to be images of different modalities.
  • images of different modalities can be considered as images collected by cameras with different imaging principles.
  • the infrared image collected by the infrared camera and the image collected by the RGB imaging camera can be considered as images of different modalities.
  • Computed Tomography (CT) images, Magnetic Resonance Imaging (Magnetic Resonance Imaging, MRI) and ultrasound images can also be considered as images of different modalities.
  • the imaging principles respectively corresponding to the first modal image and the second modal image may be determined according to actual scene requirements, which are not limited herein.
  • the first modality image may be an RGB image
  • the second modality image may be a modality image other than an RGB image, such as an infrared image.
  • the size and division method of the first grid area may also be determined according to the actual scene.
  • Each of the first grid regions in the first modality image may be uniformly distributed. If the resolution of the first modal image is W*H, where the width is W, the height is H, and the size of the first grid area is w*h, then the number of the first grid area is W/w*H/h.
  • the position of the first mesh region in the first modal image may be identified by the coordinates of four vertices.
  • the pixel points obtained by uniform sampling in the first grid area may be used as the first candidate matching points.
  • the number of the first candidate matching points in the first grid area may also be determined according to the image conditions in the first grid area, so as to determine the coordinate position of each first candidate matching point.
  • the first modality image and the second modality image may be aligned in coplanar rows.
  • the image plane corresponding to the first modal image and the image plane corresponding to the second modal image are parallel to each other, thereby reducing the stereo parallax, and reducing the complexity of matching in the subsequent search for matching point pairs And the amount of calculation, improve the accuracy of the grid transformation matrix determined according to the matching point pair.
  • the method before determining at least two first candidate matching points in the first grid area for each first grid area pre-divided in the first modal image, the method further includes:
  • the first camera parameters may include internal parameters, external parameters and/or distortion parameters of the first camera.
  • the second camera parameters may include internal parameters, external parameters and/or distortion parameters of the second camera.
  • the internal parameters may be parameters related to the characteristics of the corresponding camera, such as the focal length and pixel distribution of the corresponding camera.
  • the external parameters may indicate the pose of the corresponding camera in the world coordinate system, which is determined by the relative pose relationship between the camera and the world coordinate system. Exemplarily, the external parameters may include a rotation vector and a translation vector.
  • the distortion parameters may include radial distortion parameters and/or tangential distortion parameters.
  • first camera parameters and the second camera parameters it is possible to determine the difference between the image coordinate system of the first original image captured by the first camera and the image coordinate system of the second original image captured by the second camera relative relationship.
  • the first camera and the second camera may be calibrated in advance to determine the first camera parameters of the first camera and the second camera parameters of the second camera.
  • the first camera and the second camera may be calibrated respectively by Zhang Zhengyou's calibration method.
  • the separately correcting the first original image and the second original image may include performing distortion correction and/or stereo correction on the first original image, and performing distortion on the second original image.
  • Correction and/or Stereo Correction may be to correct the image distortion of the corresponding image through distortion parameters, such as correcting the radial distortion of the image and the tangential distortion of the image.
  • the stereo correction can align the non-coplanar lines of the two images into a coplanar line alignment.
  • the plane of the corrected first original image is parallel to the plane of the corrected second original image, corresponding to The optical axes of the cameras are concentric, and the poles of the corrected first original image and the corrected second original image are at infinity.
  • the first original image and the second original image can be corrected to obtain the first modal image and the second modal image aligned in a coplanar row, so that the subsequent search can be performed.
  • search in images whose image planes are parallel to each other to avoid errors caused by differences in image distortion and image shooting angle improve the search efficiency and accuracy of matching point pairs, and thus improve the accuracy of image alignment .
  • determining at least two first candidate matching points in the first grid area for each pre-divided first grid area in the first modal image includes:
  • the gradient information of the pixel point may reflect the change of the pixel value of the pixel point relative to the pixel value of the surrounding pixel points.
  • the pixel point gradient information of the first grid area itself may indicate the distribution of image content in the first grid area. Therefore, if the pixel point gradient variation range of the first grid area itself If the value is larger and the gradient value is larger, the amount of information in the first grid area may be large, and the number of the first candidate matching points in the first grid area can be increased.
  • the first grid area may be determined by combining the pixel point gradient information of the first grid area and the pixel point gradient information in the second grid area corresponding to the first grid area.
  • the number of first candidate matching points in the grid area For example, if the difference between the gradient information of the pixel points in the second grid area corresponding to the first grid area and the gradient information of the pixel points in the first grid area is large, it can be considered that the first grid area The similarity between a grid area and the second grid area corresponding to the first grid area is poor, and the degree of coincidence is poor. Therefore, the first candidate matching point in the first grid area can be improved. to obtain as many matching point pairs as possible between the first grid area and the second grid area corresponding to the first grid area, thereby improving the accuracy of image alignment.
  • At least two first candidate matching points of including:
  • a first candidate matching point in the first grid area is determined according to the number of the first candidate matching points.
  • the alignment error may reflect a difference in pixel point gradient information between the first grid area and a second grid area corresponding to the first grid area. If the alignment error between the first grid area and the second grid area corresponding to the first grid area is large, it can be considered that the first grid area and the first grid area There is no alignment between the second grid regions corresponding to the regions, and ghost images are likely to occur during subsequent fusion. Therefore, if the alignment error is large, the first grid region in the first grid region can be increased. A number of candidate matching points, so as to obtain a more accurate transformation relationship between the first grid area and the second grid area corresponding to the first grid area later. Specifically, the alignment error may be calculated and obtained by comparing the difference between the first gradient value of each first pixel point and the second gradient value of the corresponding second pixel point.
  • the number of the first candidate matching points in the first grid area may be determined according to the size of the alignment error. For example, if the alignment error is greater than a preset error threshold, determine that the number of first candidate matching points in the first grid area is M, and if the alignment error is not greater than a preset error threshold, determine The number of the first candidate matching points in the first grid area is N, where N and M are positive integers respectively, and M is greater than N.
  • each first candidate matching point may be determined according to information such as the size of the first grid area and the number of the first candidate matching points distribution of points in the first grid area, so as to determine the position of the first candidate matching point in the first grid area.
  • FIG. 2 it is an exemplary schematic diagram of the distribution manner of the first candidate matching points in the first grid area.
  • the number of the first candidate matching points in the first grid area is determined to be 9
  • the number of the first candidate matching points is determined to be 9.
  • the number of the first candidate matching points in the first grid area is four.
  • a first gradient value of the first pixel point and the second gradient value of the second pixel point corresponding to the first pixel point are set between The absolute value of the difference is taken as the first absolute value, wherein the position of the first pixel in the first modal image and the second pixel corresponding to the first pixel are in the second The position in the modal image is the same;
  • the coordinate range of the first grid area A is x ⁇ [0,w 1 ],y ⁇ [0,h 1 ], then the alignment error of the first grid area A is ⁇ 1 for:
  • grad rgb (x, y) is the first gradient value of any first pixel point
  • grad spectral (x, y) is the second gradient value of any second pixel point
  • the number of the first candidate matching points may be (3*n) 2 , otherwise the number of the first candidate matching points may be n 2 , and the threshold is a preset error threshold.
  • Step S102 for each first candidate matching point in the first grid area, search for the first target pixel point corresponding to the first candidate matching point from the second modal image, wherein the first candidate matching point is
  • the cross-correlation information between a target pixel point and the corresponding first candidate matching point conforms to a preset cross-correlation condition.
  • the cross-correlation information may include a normalized cross-correlation (Normalized Cross Correlation, NCC) value, a cross-correlation value calculated according to a preset cross-correlation function, etc., which may measure the cross-correlation of two related pixels. value of sex.
  • the preset cross-correlation condition may be determined according to the type of the cross-correlation information. For example, if the cross-correlation information includes the normalized cross-correlation value, the preset cross-correlation condition may be that the normalized cross-correlation value is greater than a preset cross-correlation threshold.
  • the step S102 includes:
  • Step S301 for each first candidate matching point in the first grid area, determine the region of interest corresponding to the first candidate matching point from the second modal image;
  • Step S302 for each pixel in the region of interest, calculate the cross-correlation metric value between the pixel and the first candidate matching point;
  • Step S303 if the maximum value of the cross-correlation metric values corresponding to each pixel in the region of interest is greater than a preset threshold, then the pixel corresponding to the maximum value in the region of interest is used as the maximum value in the region of interest.
  • the region of interest may be considered as a search range for searching for a first target pixel point corresponding to the first candidate matching point.
  • the size of the region of interest may be determined according to scene requirements, for example, may be predetermined according to information such as computing resources, the positional relationship between the cameras corresponding to the first modal image and the second modal image respectively .
  • the cross-correlation metric value may be a normalized cross-correlation (Normalized Cross Correlation, NCC) value, a cross-correlation value calculated according to a preset cross-correlation function, and the like.
  • the cross-correlation metric value is a normalized cross-correlation value
  • the calculating, for each pixel point in the region of interest, a cross-correlation metric value between the pixel point and the first candidate matching point including:
  • the normalized cross-correlation value between the pixel and the first candidate matching point is calculated according to the specified correlation region, where the specified correlation region is the specified correlation region. a designated area centered on the pixel in the second modal image.
  • the pixel value of the first candidate matching point (x 1 , y 1 ) is R rgb (x 1 , y 1 ).
  • the region of interest is As the starting point, a rectangular area with both width and height k.
  • the designated associated area of the pixel point R spectral (x,y) is the pixel point R spectral (x,y) as the center, with d is a rectangular area D of width and height.
  • u rgb_roi represents the expectation of the pixel value of each pixel in the corresponding region of the region of interest in the first modal image
  • u spectral_roi represents the expectation of the pixel value of each pixel in the region of interest
  • ⁇ rgb_roi represents The variance of the pixel value of each pixel in the corresponding region of the region of interest in the first modal image
  • ⁇ spectral_roi represents the variance of the pixel value of each pixel in the region of interest, when the NCC is larger, it means that the first A candidate matching point is more similar to the pixel point R spectral (x, y).
  • NCC NCC (x m , y m ) ⁇ T ncc , then the pixel in the region of interest corresponding to the NCC(x m , y m ) is the first target pixel of the first candidate matching point.
  • T ncc can be a preset threshold.
  • Step S103 if the first target pixel point corresponding to the first candidate matching point is found from the second modal image, then the first candidate matching point and the first candidate matching point corresponding to the first candidate matching point are found.
  • the first target pixel point of is used as a set of matching point pairs between the first modal image and the second modal image.
  • Using the cross-correlation information to measure the similarity between pixels to find the first target pixel corresponding to the first candidate matching point can reduce the gradient direction of images of different modalities in structurally similar regions Compared with the existing feature point detection and matching based on SIFT and other methods, the accuracy of the obtained matching point pairs can be improved.
  • the distance between the first grid area and the second grid area corresponding to the first grid area in the second modal image is obtained according to each set of matched point pairs.
  • the mesh transformation matrix also include:
  • a second target pixel corresponding to the second candidate matching point is searched from the first modal image, wherein the second target pixel
  • the cross-correlation information between the point and the corresponding second candidate matching point meets a preset cross-correlation condition
  • the second candidate matching point and the second matching point corresponding to the second candidate matching point are used as a set of matching point pairs between the first modal image and the second modal image.
  • the image coordinate system of the first modal image be used as a benchmark to search for the matching point pair according to the first candidate matching points
  • the image coordinate system of the second modal image can be used as a benchmark
  • the matching point pair is searched according to the second candidate matching point, so that the number of the matching point pair can be increased.
  • Step S104 obtaining a grid transformation matrix between the first grid area and the second grid area corresponding to the first grid area in the second modal image according to the matching point pair , wherein the position of the first grid area in the first modal image is the same as the position of the second grid area corresponding to the first grid area in the second modal image.
  • the distribution manner of each of the first grid areas in the first modal image is the same as the distribution manner of each of the second grid areas in the second modal image.
  • the grid transformation matrix may indicate a translational transformation relationship and/or a rotational transformation relationship of the image in the first grid area with respect to the image in the corresponding second grid area, and the like.
  • the specific calculation method of the grid transformation matrix may be determined according to the situation such as the number of the matching point pairs. If the number of matching point pairs between the first grid area and the second grid area corresponding to the first grid area in the second modal image is not less than a preset number, for example , not less than 4, then according to the matching point pair, through affine transformation, homography transformation, etc., to calculate the difference between the first grid area and the first grid area in the second modal image The grid transformation matrix between the corresponding second grid regions.
  • the matching points of other points in the first grid area in the second grid area corresponding to the first grid area in the second modal image may be further calculated according to the matching point pair , and then calculate the grid transformation matrix.
  • Step S105 Transform the second modal image into a target image aligned with the first modal image according to each grid transformation matrix.
  • each second grid region may be transformed according to each grid transformation matrix, and then the transformed second grid regions may be combined to obtain the target image.
  • the transformation of each second grid area can be independent of each other, instead of realizing the transformation of the entire second modal image through a unified transformation matrix, which can improve the accuracy of the transformation of each local area, thereby greatly improving the image. Alignment precision.
  • the obtaining between the first grid area and the second grid area corresponding to the first grid area in the second modal image according to the matching point pair Grid transformation matrix including:
  • the coordinates of the designated vertex in the first mesh area, and the coordinate of the designated vertex in the first mesh area in the second mesh area corresponding to the first mesh area Expected coordinates, build a least squares model
  • the second mesh area corresponding to the first mesh area obtains the second mesh area corresponding to the first mesh area and the first mesh area a homography matrix between grid regions, and using the homography matrix as the grid transformation matrix;
  • the transforming the second modal image into a target image aligned relative to the first modal image according to each grid transformation matrix includes:
  • a target image aligned with respect to the first modality image is obtained according to each perspective transformed second grid area.
  • the designated vertices may be four vertices of the first mesh region.
  • the specified vertices can be four vertices of the first mesh area, and the relationship between the first mesh area and the second mesh area corresponding to the first mesh area can be solved.
  • the homography matrix between may also be less than 3. In this case, the desired coordinates of the specified vertices and the matching points may be combined Calculate the homography matrix for the pair.
  • the construction and solution of the least squares model can be implemented according to the prior art.
  • the matching point pair the coordinates of the designated vertex in the first mesh area, and the second corresponding to the first mesh area of the designated vertex in the first mesh area. desired coordinates in the grid area
  • constructing the least squares model that can indicate the first graph and the second graph by calculating a preset error between vertices in the first graph and The shape similarity between the second graphics.
  • the first graph is a first candidate matching point in the matching point pair and a designated vertex in the first grid area
  • the second graph is a center between the desired coordinate and the matching point
  • the preset error can be optimized to minimize the preset error, so as to obtain the relationship between the specified vertex in the first mesh area in the second mesh area corresponding to the first mesh area desired coordinates.
  • the least squares model can be solved by means of Gauss-Newton method, gradient descent method, LM (Levenberg-Marquart) method, or the like.
  • the specific solution method is not limited here.
  • the target image may be stored in the form of a binary file for subsequent image reading and processing.
  • the target image can also be stored in other formats according to the needs of the scene.
  • FIG. 4(a) is the first modal image
  • Fig. 4(b) is the second modal image. If the first modal image and the second modal image are aligned in a coplanar row, then, after directly merging the first modal image and the second modal image, FIG. 4( c ) is obtained. At this time, a clear positional deviation appears in Fig. 4(c).
  • first modal image and the second modal image are obtained, for each first grid area pre-divided in the first modal image, according to each of the first grid areas
  • the first gradient value of the first pixel point, and the second gradient value of each second pixel point in the second grid area corresponding to the first grid area determine the relationship between the first grid area and the The alignment error between the second grid areas corresponding to the first grid area.
  • the number of the corresponding first candidate matching points in the first grid area may be larger, for example, 9; and if the homogeneous error is not equal to is greater than the preset error threshold, then, the number of the corresponding first candidate matching points in the first grid area may be less, for example, four.
  • the first grid area with a large number of first candidate matching points and the first grid area with a large number of first candidate matching points The distribution of grid areas.
  • each grid transformation matrix is obtained according to the matching point pairs. Then, according to the grid transformation matrix, according to the matching point pair, the coordinates of the four vertices of each first grid area in the first modal image as shown in FIG. 4(e), and the The coordinates of four vertices in a grid area are expected coordinates in the second grid area corresponding to the first grid area, and a least squares model is constructed. Solve the least squares model to obtain the expectation of the coordinates of the 4 vertices in the first grid area as shown in Figure 4(f) in the second grid area corresponding to the first grid area coordinate.
  • the first target pixel corresponding to the first candidate matching point is searched from the second modal image, wherein the first target pixel corresponds to the corresponding
  • the cross-correlation information between the first candidate matching points conforms to a preset cross-correlation condition. At this time, the similarity between the pixel points can be measured by the cross-correlation information, so as to find the first target pixel point corresponding to the first candidate matching point.
  • the first candidate matching point and the first matching point corresponding to the first candidate matching point is used as a set of matching point pairs between the first modal image and the second modal image; at this time, for each first grid area, the cross-correlation information between the pixels can be used
  • the matching point pair between the first grid area and the second grid area corresponding to the first grid area in the second modal image is obtained, so as to obtain the matching point pair according to the matching point pair.
  • the grid transformation matrix between the first grid region and the second grid region corresponding to the first grid region in the second modal image and then, according to each grid transformation matrix, the The second modality image is transformed into a target image aligned with respect to the first modality image, thereby realizing image alignment between images of different modality.
  • the matching point pairs required for the image alignment are determined based on the cross-correlation information between the pixels, the interference caused by the difference in the gradient directions of the images of different modalities in the structurally similar regions can be reduced, Therefore, the accuracy of matching point pairs is high, and accordingly, the alignment accuracy of the final target image is also ensured, which avoids that the existing feature point detection and matching based on SIFT and other methods cannot be found between images of different modalities. Accurately match point pairs, so that the image alignment accuracy between images of different modalities is poor.
  • FIG. 5 shows a structural block diagram of an image alignment apparatus provided by the embodiment of the present application. For convenience of description, only the part related to the embodiment of the present application is shown.
  • the image alignment device 5 includes:
  • a determination module 501 configured to determine at least two first candidate matching points in the first grid area for each first grid area pre-divided in the first modal image
  • a search module 502 configured to search for the first target pixel point corresponding to the first candidate matching point from the second modal image for each first candidate matching point in the first grid area, wherein, The cross-correlation information between the first target pixel point and the corresponding first candidate matching point meets a preset cross-correlation condition;
  • the first processing module 503 is configured to, if the first target pixel corresponding to the first candidate matching point is found from the second modal image, compare the first candidate matching point with the first matching point.
  • the first target pixel point corresponding to the candidate matching point is used as a set of matching point pairs between the first modal image and the second modal image;
  • the second processing module 504 is configured to obtain, according to the matching point pair, the distance between the first grid area and the second grid area corresponding to the first grid area in the second modal image The grid transformation matrix of , wherein the position of the first grid area in the first modal image and the second grid area corresponding to the first grid area in the same position;
  • the transformation module 505 is configured to transform the second modal image into a target image aligned with respect to the first modal image according to each grid transformation matrix.
  • the determining module 501 is specifically used for:
  • the determining module 501 specifically includes:
  • a first determining unit configured to, for each first grid area pre-divided in the first modal image, according to the first gradient value of each first pixel point in the first grid area, and the second gradient value of each second pixel in the second grid area corresponding to the first grid area, to determine the first grid area and the second grid area corresponding to the first grid area Alignment error between;
  • a second determining unit configured to determine the number of the first candidate matching points in the first grid area according to the alignment error
  • a third determining unit configured to determine a first candidate matching point in the first grid area according to the number of the first candidate matching points.
  • the first determining unit specifically includes:
  • a first processing subunit configured to, for each first pixel in the first grid area, compare the first gradient value of the first pixel with the second pixel corresponding to the first pixel The absolute value of the difference between the second gradient values of the point is taken as the first absolute value, wherein the position of the first pixel point in the first modal image and the first pixel point corresponding to the first pixel point The positions of the two pixel points in the second modal image are the same;
  • the second processing subunit is configured to use the sum of the absolute values of the first gradient values in the first grid area as the first summation result, and use the second grid area corresponding to the first grid area The sum of the absolute values of the respective second gradient values in the grid region is used as the second summation result;
  • a determination subunit configured to determine the relationship between the first grid area and the Alignment error between a second grid area corresponding to a grid area.
  • the image alignment device 5 further includes:
  • an acquisition module for acquiring the first original image captured by the first camera and the second original image captured by the second camera
  • a correction module configured to correct the first original image and the second original image respectively according to the pre-calibrated first camera parameters of the first camera and the second camera parameters of the second camera;
  • a third processing module configured to take the corrected first original image as the first modality image, and take the corrected second original image as the second modality image, wherein the first modality image and The second modality images are aligned in coplanar rows.
  • the image alignment device 5 further includes:
  • the second determining module is configured to, for each second grid area pre-divided in the second modal image, determine the grid area in the second grid area according to the gradient information of the second grid area at least two second candidate matching points;
  • the second search module is configured to, for each second candidate matching point in the second grid area, search for the second target pixel point corresponding to the second candidate matching point from the first modal image, wherein , the cross-correlation information between the second target pixel point and the corresponding second candidate matching point meets a preset cross-correlation condition;
  • the fourth processing module is configured to, if the second target pixel corresponding to the second candidate matching point is found from the first modal image, compare the second candidate matching point with the second candidate matching point.
  • the second target pixel points corresponding to the matching points are used as a set of matching point pairs between the first modal image and the second modal image.
  • the search module 502 specifically includes:
  • a fourth determining unit configured to, for each first candidate matching point in the first grid area, determine a region of interest corresponding to the first candidate matching point from the second modal image
  • a calculation unit for calculating the cross-correlation metric value between the pixel and the first candidate matching point for each pixel in the region of interest
  • the first processing unit is configured to, if the maximum value of the cross-correlation metric values corresponding to each pixel in the region of interest is greater than a preset threshold, then the maximum value in the region of interest corresponding to the The pixel point is used as the first target pixel point of the first candidate matching point.
  • the cross-correlation metric value is a normalized cross-correlation value
  • the computing unit is specifically used for:
  • the normalized cross-correlation value between the pixel and the first candidate matching point is calculated according to the specified correlation region, where the specified correlation region is the specified correlation region. a designated area centered on the pixel in the second modal image.
  • the second processing module 504 specifically includes:
  • the construction unit is configured to, according to the matching point pair, the coordinates of the designated vertex in the first mesh area, and the second corresponding to the first mesh area of the designated vertex in the first mesh area the desired coordinates in the grid area to construct a least squares model;
  • a solving unit configured to solve the least squares model, and obtain the desired coordinates of the specified vertex in the first grid region in the second grid region corresponding to the first grid region;
  • the second processing unit is configured to obtain the first mesh area and the first mesh area according to the expected coordinates and the coordinates of the specified vertex in the second mesh area corresponding to the first mesh area a homography matrix between the second grid regions corresponding to the grid regions, and using the homography matrix as the grid transformation matrix;
  • the transformation module 505 specifically includes:
  • a transformation unit configured to, for each second grid region, perform perspective transformation on the second grid region according to the homography matrix corresponding to the second grid region;
  • the third processing unit is configured to obtain a target image aligned relative to the first modal image according to each perspective transformed second grid area.
  • FIG. 6 is a schematic structural diagram of a terminal device provided by an embodiment of the present application.
  • the terminal device 6 in this embodiment includes: at least one processor 60 (only one is shown in FIG. 6 ), a memory 61 , and is stored in the above-mentioned memory 61 and can run on the above-mentioned at least one processor 60
  • the computer program 62 when the processor 60 executes the computer program 62, implements the steps in any of the above image alignment method embodiments.
  • the above-mentioned terminal device 6 may be a server, a mobile phone, a wearable device, an augmented reality (AR)/virtual reality (VR) device, a desktop computer, a notebook, a desktop computer, a handheld computer and other computing devices.
  • the terminal device may include, but is not limited to, a processor 60 and a memory 61 .
  • FIG. 6 is only an example of the terminal device 6, and does not constitute a limitation on the terminal device 6, and may include more or less components than the one shown, or combine some components, or different components , for example, may also include input devices, output devices, network access devices, and so on.
  • the above-mentioned input devices may include keyboards, touchpads, fingerprint collection sensors (for collecting user's fingerprint information and fingerprint direction information), microphones, cameras, etc.
  • output devices may include displays, speakers, and the like.
  • the above-mentioned processor 60 can be a central processing unit (Central Processing Unit, CPU), and the processor 60 can also be other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
  • the above-mentioned memory 61 may be an internal storage unit of the above-mentioned terminal device 6 in some embodiments, such as a hard disk or a memory of the terminal device 6 .
  • the above-mentioned memory 61 may also be an external storage device of the above-mentioned terminal device 6 in other embodiments, such as a plug-in hard disk equipped on the above-mentioned terminal device 6, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital) , SD) card, flash memory card (Flash Card), etc.
  • the above-mentioned memory 61 may also include both the internal storage unit of the above-mentioned terminal device 6 and an external storage device.
  • the above-mentioned memory 61 is used to store an operating system, an application program, a boot loader (Boot Loader), data, and other programs, for example, program codes of the above-mentioned computer programs, and the like.
  • the above-mentioned memory 61 can also be used to temporarily store data that has been output or is to be output.
  • the above-mentioned terminal device 6 may also include a network connection module, such as a Bluetooth module, a Wi-Fi module, a cellular network module, etc., which will not be repeated here.
  • a network connection module such as a Bluetooth module, a Wi-Fi module, a cellular network module, etc., which will not be repeated here.
  • the processor 60 executes the computer program 62 to implement the steps in any of the above image alignment method embodiments, for each first grid area pre-divided in the first modal image, determine at least two first candidate matching points in the first grid area; then, for each first candidate matching point in the first grid area, searching for the first candidate matching point from the second modal image The first target pixel point corresponding to the candidate matching point, wherein the cross-correlation information between the first target pixel point and the corresponding first candidate matching point meets a preset cross-correlation condition. At this time, the similarity between the pixel points can be measured by the cross-correlation information, so as to find the first target pixel point corresponding to the first candidate matching point.
  • the first candidate matching point and the first matching point corresponding to the first candidate matching point is used as a set of matching point pairs between the first modal image and the second modal image; at this time, for each first grid area, the cross-correlation information between the pixels can be used
  • the matching point pair between the first grid area and the second grid area corresponding to the first grid area in the second modal image is obtained, so as to obtain the matching point pair according to the matching point pair.
  • the grid transformation matrix between the first grid region and the second grid region corresponding to the first grid region in the second modal image and then, according to each grid transformation matrix, the The second modality image is transformed into a target image aligned relative to the first modality image, thereby realizing image alignment between images of different modality.
  • the matching point pairs required for the image alignment are determined based on the cross-correlation information between the pixels, the interference caused by the difference in the gradient directions of the images of different modalities in the structurally similar regions can be reduced, Therefore, the accuracy of matching point pairs is high, and accordingly, the alignment accuracy of the final target image is also guaranteed, and the existing feature point detection and matching based on SIFT and other methods cannot be found between images of different modalities. Accurately match point pairs, which leads to the problem of poor image alignment accuracy between images of different modalities.
  • Embodiments of the present application further provide a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the foregoing method embodiments can be implemented.
  • the embodiments of the present application provide a computer program product, when the computer program product runs on a terminal device, so that the terminal device can implement the steps in the foregoing method embodiments when executed.
  • the above-mentioned integrated units are implemented in the form of software functional units and sold or used as independent products, they may be stored in a computer-readable storage medium. Based on this understanding, the present application realizes all or part of the processes in the methods of the above-mentioned embodiments, which can be completed by instructing the relevant hardware through a computer program.
  • the above-mentioned computer program can be stored in a computer-readable storage medium, and the computer program is in When executed by the processor, the steps of the foregoing method embodiments can be implemented.
  • the above-mentioned computer program includes computer program code, and the above-mentioned computer program code may be in the form of source code, object code form, executable file or some intermediate form.
  • the above-mentioned computer-readable medium may include at least: any entity or device capable of carrying the computer program code to the photographing device/terminal device, a recording medium, a computer memory, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), electrical carrier signals, telecommunication signals, and software distribution media.
  • ROM read-only memory
  • RAM Random Access Memory
  • electrical carrier signals telecommunication signals
  • software distribution media for example, U disk, mobile hard disk, disk or CD, etc.
  • computer readable media may not be electrical carrier signals and telecommunications signals.
  • the disclosed apparatus/network device and method may be implemented in other manners.
  • the apparatus/network device embodiments described above are only illustrative.
  • the division of the above modules or units is only a logical function division.
  • the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.
  • the units described above as separate components may or may not be physically separated, and components shown as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.

Abstract

Provided is an image alignment method, comprising: for each first grid area obtained by means of pre-division in a first modal image, determining at least two first candidate matching points in the first grid area; for each first candidate matching point in the first grid area, searching, in a second modal image, for a first target pixel point corresponding to the first candidate matching point, wherein cross-correlation information between the first target pixel point and the corresponding first candidate matching point conforms to a pre-set cross-correlation condition; determining a matching point pair between the first modal image and the second modal image according to found first target pixel points; according to the matching point pair, obtaining a grid transformation matrix between the first grid area and a second grid area that corresponds to the first grid area in the second modal image; and according to each grid transformation matrix, transforming the second modal image into a target image that is aligned relative to the first modal image.

Description

图像对齐方法、图像对齐装置及终端设备Image alignment method, image alignment device and terminal device
本申请要求于2020年11月9日提交中国专利局、申请号为202011237926.4、申请名称为“图像对齐方法、图像对齐装置及终端设备”的中国专利申请的优先权,其全部内容通过引用结合到本申请中。This application claims the priority of the Chinese patent application with the application number 202011237926.4 and the application title "Image Alignment Method, Image Alignment Device and Terminal Equipment" filed with the China Patent Office on November 9, 2020, the entire contents of which are incorporated by reference into in this application.
技术领域technical field
本申请属于图像处理技术领域,尤其涉及图像对齐方法、图像对齐装置、终端设备及计算机可读存储介质。The present application belongs to the technical field of image processing, and in particular, relates to an image alignment method, an image alignment apparatus, a terminal device and a computer-readable storage medium.
背景技术Background technique
图像对齐技术是图像处理中非常重要且基础的技术,其可运用到很多图像处理的任务中。Image alignment technology is a very important and basic technology in image processing, which can be applied to many image processing tasks.
例如,诸如手机、AR眼镜、虚拟现实设备等终端上常常会集成有多个摄像头,并且不同摄像头所采用的的成像原理也可能不同,比如,终端上可能有红外摄像头和RGB成像摄像头。而不同成像原理的摄像头所采集得到的图像可以认为是不同模态的图像。此时,需要将不同模态的图像进行图像对齐来实现拼接融合。此外,在医学图像领域、遥感图像领域等应用领域,也要通过图像对齐技术来实现诸如电子计算机断层扫描(Computed Tomography,CT)图像、磁共振成像(Magnetic Resonance Imaging,MRI)等不同模态的图像之间的拼接和融合。For example, terminals such as mobile phones, AR glasses, and virtual reality devices are often integrated with multiple cameras, and the imaging principles used by different cameras may also be different. For example, there may be infrared cameras and RGB imaging cameras on the terminal. The images collected by cameras with different imaging principles can be considered as images of different modalities. At this time, images of different modalities need to be aligned to achieve stitching fusion. In addition, in the field of medical images, remote sensing images and other application fields, image alignment technology should also be used to achieve different modalities such as Computed Tomography (CT) images and Magnetic Resonance Imaging (MRI). Stitching and fusion between images.
发明内容SUMMARY OF THE INVENTION
本申请实施例提供了图像对齐方法、图像对齐装置、终端设备及计算机可读存储介质,可以解决现有的方法无法在不同模态的图像之间找到准确的匹配点对,从而使得不同模态的图像之间的图像对齐精度较差的问题。The embodiments of the present application provide an image alignment method, an image alignment device, a terminal device, and a computer-readable storage medium, which can solve the problem that the existing method cannot find accurate matching point pairs between images of different modalities, so that different modalities cannot find accurate matching point pairs. The problem of poor image alignment accuracy between the images.
第一方面,本申请实施例提供了一种图像对齐方法,包括:In a first aspect, an embodiment of the present application provides an image alignment method, including:
针对第一模态图像中预先划分得到的每一个第一网格区域,确定所述第一网格区域中的至少两个第一候选匹配点;For each first grid area pre-divided in the first modal image, determining at least two first candidate matching points in the first grid area;
针对所述第一网格区域中的每一个第一候选匹配点,从第二模态图像中查找所述第一候选匹配点所对应的第一目标像素点,其中,所述第一目标像素点与对应的所述第一候选匹配点之间的互相关信息符合预设互相关条件;For each first candidate matching point in the first grid area, the first target pixel corresponding to the first candidate matching point is searched from the second modal image, wherein the first target pixel The cross-correlation information between the point and the corresponding first candidate matching point meets a preset cross-correlation condition;
若从所述第二模态图像中查找到所述第一候选匹配点所对应的第一目标像素点,则将所述第一候选匹配点和所述第一候选匹配点所对应的第一目标像素点作为所述第一模态图像与所述第二模态图像之间的一组匹配点对;If the first target pixel point corresponding to the first candidate matching point is found from the second modal image, the first candidate matching point and the first matching point corresponding to the first candidate matching point The target pixel is used as a set of matching point pairs between the first modal image and the second modal image;
根据所述匹配点对,获得所述第一网格区域与所述第一网格区域在所述第二模态图像中所对应的第二网格区域之间的网格变换矩阵,其中,所述第一网格区域在所述第一模态图像中的位置与所述第一网格区域所对应的第二网格区域在所述第二模态图像中的位置相同;According to the matching point pair, a grid transformation matrix between the first grid area and the second grid area corresponding to the first grid area in the second modal image is obtained, wherein, The position of the first grid area in the first modal image is the same as the position of the second grid area corresponding to the first grid area in the second modal image;
根据各个网格变换矩阵,将所述第二模态图像变换为相对于所述第一模态图像对齐的目标图像。Transforming the second modality image into a target image aligned relative to the first modality image according to the respective grid transformation matrices.
第二方面,本申请实施例提供了一种图像对齐装置,包括:In a second aspect, an embodiment of the present application provides an image alignment device, including:
确定模块,用于针对第一模态图像中预先划分得到的每一个第一网格区域,确定所述第一网格区域中的至少两个第一候选匹配点;a determining module, configured to determine at least two first candidate matching points in the first grid area for each first grid area pre-divided in the first modal image;
查找模块,用于针对所述第一网格区域中的每一个第一候选匹配点,从第二模态图像中查找所述第一候选匹配点所对应的第一目标像素点,其中,所述第一目标像素点与对应的所述第一候选匹配点之间的互相关信息符合预设互相关条件;A search module is configured to search, for each first candidate matching point in the first grid area, the first target pixel point corresponding to the first candidate matching point from the second modal image, wherein the The cross-correlation information between the first target pixel point and the corresponding first candidate matching point meets a preset cross-correlation condition;
第一处理模块,用于若从所述第二模态图像中查找到所述第一候选匹配点所对应的第一目标像素点,则将所述第一候选匹配点和所述第一候选匹配点所对应的第一目标像素点作为所述第一模态图像与所述第二模态图像之间的一组匹配点对;The first processing module is configured to, if the first target pixel corresponding to the first candidate matching point is found from the second modal image, compare the first candidate matching point with the first candidate matching point The first target pixel point corresponding to the matching point is used as a set of matching point pairs between the first modal image and the second modal image;
第二处理模块,用于根据所述匹配点对,获得所述第一网格区域与所述第一网格区域在所述第二模态图像中所对应的第二网格区域之间的网格变换矩阵,其中,所述第一网格区 域在所述第一模态图像中的位置与所述第一网格区域所对应的第二网格区域在所述第二模态图像中的位置相同;a second processing module, configured to obtain, according to the matching point pair, the difference between the first grid area and the second grid area corresponding to the first grid area in the second modal image A grid transformation matrix, wherein the position of the first grid area in the first modal image and the second grid area corresponding to the first grid area are in the second modal image the same location;
变换模块,用于根据各个网格变换矩阵,将所述第二模态图像变换为相对于所述第一模态图像对齐的目标图像。A transformation module, configured to transform the second modal image into a target image aligned with respect to the first modal image according to each grid transformation matrix.
第三方面,本申请实施例提供了一种终端设备,包括存储器、处理器、显示器以及存储在上述存储器中并可在上述处理器上运行的计算机程序,其特征在于,上述处理器执行上述计算机程序时实现如第一方面上述的图像对齐方法。In a third aspect, an embodiment of the present application provides a terminal device, including a memory, a processor, a display, and a computer program stored in the memory and running on the processor, characterized in that the processor executes the computer The image alignment method as described above in the first aspect is implemented during the program.
第四方面,本申请实施例提供了一种计算机可读存储介质,上述计算机可读存储介质存储有计算机程序,上述计算机程序被处理器执行时实现如第一方面上述的图像对齐方法。In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, implements the image alignment method described in the first aspect.
第五方面,本申请实施例提供了一种计算机程序产品,当计算机程序产品在终端设备上运行时,使得终端设备执行上述第一方面中上述的图像对齐方法。In a fifth aspect, an embodiment of the present application provides a computer program product that, when the computer program product runs on a terminal device, enables the terminal device to execute the image alignment method described above in the first aspect.
附图说明Description of drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the technical solutions in the embodiments of the present application more clearly, the following briefly introduces the accompanying drawings that need to be used in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only for the present application. In some embodiments, for those of ordinary skill in the art, other drawings can also be obtained according to these drawings without any creative effort.
图1是本申请一实施例提供的一种图像对齐方法的流程示意图;1 is a schematic flowchart of an image alignment method provided by an embodiment of the present application;
图2是本申请一实施例提供的第一候选匹配点在第一网格区域中的分布方式的一种示例性示意图;FIG. 2 is an exemplary schematic diagram of a distribution manner of a first candidate matching point in a first grid area provided by an embodiment of the present application;
图3是本申请一实施例提供的步骤S102的一种流程示意图;FIG. 3 is a schematic flowchart of step S102 provided by an embodiment of the present application;
图4是本申请一实施例提供的对所述第一模态图像和第二模态图像进行对齐的一种示例性示意图;4 is an exemplary schematic diagram of aligning the first modality image and the second modality image provided by an embodiment of the present application;
图5是本申请一实施例提供的一种图像对齐装置的结构示意图;5 is a schematic structural diagram of an image alignment apparatus provided by an embodiment of the present application;
图6是本申请一实施例提供的终端设备的结构示意图。FIG. 6 is a schematic structural diagram of a terminal device provided by an embodiment of the present application.
具体实施方式Detailed ways
以下描述中,为了说明而不是为了限定,提出了诸如特定系统结构、技术之类的具体细节,以便透彻理解本申请实施例。然而,本领域的技术人员应当清楚,在没有这些具体细节的其它实施例中也可以实现本申请。在其它情况中,省略对众所周知的系统、装置、电路以及方法的详细说明,以免不必要的细节妨碍本申请的描述。In the following description, for the purpose of illustration rather than limitation, specific details such as a specific system structure and technology are set forth in order to provide a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application may be practiced in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
应当理解,当在本申请说明书和所附权利要求书中使用时,术语“包括”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。It is to be understood that, when used in this specification and the appended claims, the term "comprising" indicates the presence of the described feature, integer, step, operation, element and/or component, but does not exclude one or more other The presence or addition of features, integers, steps, operations, elements, components and/or sets thereof.
还应当理解,在本申请说明书和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。It will also be understood that, as used in this specification and the appended claims, the term "and/or" refers to and including any and all possible combinations of one or more of the associated listed items.
如在本申请说明书和所附权利要求书中所使用的那样,术语“如果”可以依据上下文被解释为“当...时”或“一旦”或“响应于确定”或“响应于检测到”。类似地,短语“如果确定”或“如果检测到[所描述条件或事件]”可以依据上下文被解释为意指“一旦确定”或“响应于确定”或“一旦检测到[所描述条件或事件]”或“响应于检测到[所描述条件或事件]”。As used in the specification of this application and the appended claims, the term "if" may be contextually interpreted as "when" or "once" or "in response to determining" or "in response to detecting ". Similarly, the phrases "if it is determined" or "if the [described condition or event] is detected" may be interpreted, depending on the context, to mean "once it is determined" or "in response to the determination" or "once the [described condition or event] is detected. ]" or "in response to detection of the [described condition or event]".
在本申请说明书中描述的参考“一个实施例”或“一些实施例”等意味着在本申请的一个或多个实施例中包括结合该实施例描述的特定特征、结构或特点。由此,在本说明书中的不同之处出现的语句“在一个实施例中”、“在一些实施例中”、“在其他一些实施例中”、“在另外一些实施例中”等不是必然都参考相同的实施例,而是意味着“一个或多个但不是所有的实施例”,除非是以其他方式另外特别强调。术语“包括”、“包含”、“具有”及它们的变形都意味着“包括但不限于”,除非是以其他方式另外特别强调。References in this specification to "one embodiment" or "some embodiments" and the like mean that a particular feature, structure or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in other embodiments," etc. in various places in this specification are not necessarily All refer to the same embodiment, but mean "one or more but not all embodiments" unless specifically emphasized otherwise. The terms "including", "including", "having" and their variants mean "including but not limited to" unless specifically emphasized otherwise.
本申请实施例提供的图像对齐方法可以应用于服务器、台式电脑、手机、平板电脑、可穿戴设备、车载设备、增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备、 笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本、个人数字助理(personal digital assistant,PDA)等终端设备上,本申请实施例对终端设备的具体类型不作任何限制。The image alignment method provided by the embodiments of the present application can be applied to servers, desktop computers, mobile phones, tablet computers, wearable devices, in-vehicle devices, augmented reality (AR)/virtual reality (VR) devices, and notebook computers , ultra-mobile personal computer (ultra-mobile personal computer, UMPC), netbook, personal digital assistant (personal digital assistant, PDA) and other terminal equipment, the embodiment of the present application does not make any restrictions on the specific type of the terminal equipment.
在进行图像对齐时,往往需要先对待对齐的图像之间的特征点进行检测和匹配,才能确定图像之间的变换矩阵。目前,传统的图像对齐方法中,往往是通过尺度不变特征变换(Scale-invariant feature transform,SIFT)、加速分割测试特征(Featuresfrom Accelerated Segment Test,FAST)提取、加速稳健特征(Speeded Up Robust Features,SURF)提取等算法来实现图像特征点检测和匹配。然而,这些特征点检测算法均依赖图像的结构相似区域在梯度方向上的一致性。然而,由于成像原理不同,不同模态的图像之间在结构相似区域的梯度方向上的像素变化方式可能不同,甚至存在反差,导致现有的特征点提取方法无法在不同模态的图像之间进行准确的特征点检测和匹配,从而导致图像对齐的精度较低。When performing image alignment, it is often necessary to detect and match the feature points between the images to be aligned before determining the transformation matrix between the images. At present, traditional image alignment methods are often extracted through Scale-invariant feature transform (SIFT), accelerated segmentation test features (Features from Accelerated Segment Test, FAST), and accelerated robust features (Speeded Up Robust Features, SURF) extraction and other algorithms to achieve image feature point detection and matching. However, these feature point detection algorithms all rely on the consistency of the gradient directions in the structurally similar regions of the image. However, due to different imaging principles, there may be different pixel changes in the gradient direction of structurally similar regions between images of different modalities, and even there may be contrasts, so that the existing feature point extraction methods cannot be used between images of different modalities. Accurate feature point detection and matching results in lower accuracy of image alignment.
而通过本申请实施例,可以通过互相关信息来度量像素点之间的相似性,从而查找第一模态图像和第二模态图像之间的准确的匹配点对,能够减小不同模态的图像在结构相似区域的梯度方向上的差异所带来的干扰,相应地也保证了最终得到的目标图像的对齐精度。However, through the embodiment of the present application, the similarity between pixels can be measured through the cross-correlation information, so as to find the exact matching point pair between the first modal image and the second modal image, which can reduce the number of different modalities. The interference caused by the difference in the gradient direction of the images in the structurally similar regions also ensures the alignment accuracy of the final target image accordingly.
具体地,图1示出了本申请实施例提供的一种图像对齐方法的流程图,该图像对齐方法可以应用于终端设备。Specifically, FIG. 1 shows a flowchart of an image alignment method provided by an embodiment of the present application, and the image alignment method can be applied to a terminal device.
如图1所示,该图像对齐方法可以包括:As shown in Figure 1, the image alignment method may include:
步骤S101,针对第一模态图像中预先划分得到的每一个第一网格区域,确定所述第一网格区域中的至少两个第一候选匹配点。Step S101, for each first grid area pre-divided in the first modal image, determine at least two first candidate matching points in the first grid area.
本申请实施例中,所述第一模态图像和所述第二模态图像可以认为是不同模态的图像。其中,不同模态的图像可以认为是采用成像原理不同的摄像头所采集到的图像。例如,红外摄像头所采集到的红外图像和RGB成像摄像头所采集到的图像可以认为是不同模态的图像,此外,电子计算机断层扫描(Computed Tomography,CT)图像、磁共振成像(Magnetic Resonance Imaging,MRI)以及超声图像等也可以认为是不同模态的图像。In this embodiment of the present application, the first modality image and the second modality image may be considered to be images of different modalities. Among them, images of different modalities can be considered as images collected by cameras with different imaging principles. For example, the infrared image collected by the infrared camera and the image collected by the RGB imaging camera can be considered as images of different modalities. In addition, Computed Tomography (CT) images, Magnetic Resonance Imaging (Magnetic Resonance Imaging, MRI) and ultrasound images can also be considered as images of different modalities.
所述第一模态图像和所述第二模态图像所分别对应的成像原理可以根据实际场景需求来确定,在此不作限定。在一些示例中,所述第一模态图像可以为RGB图像,而所述第二模态图像可以为除RGB图像之外的其他模态图像,例如红外图像。The imaging principles respectively corresponding to the first modal image and the second modal image may be determined according to actual scene requirements, which are not limited herein. In some examples, the first modality image may be an RGB image, and the second modality image may be a modality image other than an RGB image, such as an infrared image.
所述第一网格区域的大小以及划分方法也可以根据实际场景来确定。所述第一模态图像中的各个第一网格区域可以是均匀分布的。若所述第一模态图像的分辨率为W*H,其中宽为W,高为H,所述第一网格区域的大小为w*h,那么所述第一网格区域的数量为W/w*H/h。所述第一网格区域在所述第一模态图像中的位置可以通过四个顶点的坐标来标识。The size and division method of the first grid area may also be determined according to the actual scene. Each of the first grid regions in the first modality image may be uniformly distributed. If the resolution of the first modal image is W*H, where the width is W, the height is H, and the size of the first grid area is w*h, then the number of the first grid area is W/w*H/h. The position of the first mesh region in the first modal image may be identified by the coordinates of four vertices.
本申请实施例中,确定所述第一网格区域中的至少两个第一候选匹配点的方式可以有多种。例如,可以是将在所述第一网格区域中进行均匀采样所获得的像素点作为所述第一候选匹配点。此外,也可以根据所述第一网格区域中的图像情况来确定所述第一网格区域中的第一候选匹配点的数量,从而确定各个第一候选匹配点的坐标位置。In this embodiment of the present application, there may be various manners for determining at least two first candidate matching points in the first grid area. For example, the pixel points obtained by uniform sampling in the first grid area may be used as the first candidate matching points. In addition, the number of the first candidate matching points in the first grid area may also be determined according to the image conditions in the first grid area, so as to determine the coordinate position of each first candidate matching point.
在一些实施例中,所述第一模态图像和所述第二模态图像可以共面行对准。此时,所述第一模态图像所对应的图像平面与所述第二模态图像所对应的图像平面相互平行,从而减小立体视差,在后续查找匹配点对时,降低匹配的复杂性和计算量,提升根据匹配点对确定得到的网格变换矩阵的准确性。In some embodiments, the first modality image and the second modality image may be aligned in coplanar rows. At this time, the image plane corresponding to the first modal image and the image plane corresponding to the second modal image are parallel to each other, thereby reducing the stereo parallax, and reducing the complexity of matching in the subsequent search for matching point pairs And the amount of calculation, improve the accuracy of the grid transformation matrix determined according to the matching point pair.
在一些实施例中,在针对第一模态图像中预先划分得到的每一个第一网格区域,确定所述第一网格区域中的至少两个第一候选匹配点之前,还包括:In some embodiments, before determining at least two first candidate matching points in the first grid area for each first grid area pre-divided in the first modal image, the method further includes:
获取通过第一摄像头拍摄得到的第一原始图像和通过第二摄像头拍摄得到的第二原始图像;acquiring a first original image captured by the first camera and a second original image captured by the second camera;
根据预先标定的第一摄像头的第一摄像头参数和第二摄像头的第二摄像头参数,分别对所述第一原始图像和第二原始图像进行校正;Correcting the first original image and the second original image respectively according to the pre-calibrated first camera parameters of the first camera and the second camera parameters of the second camera;
将校正后的第一原始图像作为所述第一模态图像,并将校正后的第二原始图像作为第二模态图像,其中,所述第一模态图像和所述第二模态图像共面行对准。Taking the corrected first original image as the first modal image, and taking the corrected second original image as the second modal image, wherein the first modal image and the second modal image Coplanar row alignment.
所述第一摄像头参数可以包括所述第一摄像头的内部参数、外部参数和/或畸变参数。所述第二摄像头参数可以包括所述第二摄像头的内部参数、外部参数和/或畸变参数。其中,所述内部参数可以为与对应的摄像头自身特性相关的参数,比如对应的摄像头的焦距、像素分布等。所述外部参数可以指示对应的摄像头在世界坐标系中的位姿,由摄像机与世界坐标系的相对位姿关系决定。示例性的,所述外部参数可以包括旋转向量和平移向量。所述畸变参数可以包括径向畸变参数和/或切向畸变参数。The first camera parameters may include internal parameters, external parameters and/or distortion parameters of the first camera. The second camera parameters may include internal parameters, external parameters and/or distortion parameters of the second camera. The internal parameters may be parameters related to the characteristics of the corresponding camera, such as the focal length and pixel distribution of the corresponding camera. The external parameters may indicate the pose of the corresponding camera in the world coordinate system, which is determined by the relative pose relationship between the camera and the world coordinate system. Exemplarily, the external parameters may include a rotation vector and a translation vector. The distortion parameters may include radial distortion parameters and/or tangential distortion parameters.
通过所述第一摄像头参数和所述第二摄像头参数,可以确定所述第一摄像头拍摄得到的第一原始图像的图像坐标系和第二摄像头拍摄得到的第二原始图像的图像坐标系之间的相对关系。Through the first camera parameters and the second camera parameters, it is possible to determine the difference between the image coordinate system of the first original image captured by the first camera and the image coordinate system of the second original image captured by the second camera relative relationship.
本申请实施例中,可以预先对所述第一摄像头和所述第二摄像头进行标定,以确定所述第一摄像头的第一摄像头参数和所述第二摄像头的第二摄像头参数。具体的标定方法可以有多种,例如,可以通过张正友标定方法分别对所述第一摄像头和第二摄像头进行标定。In this embodiment of the present application, the first camera and the second camera may be calibrated in advance to determine the first camera parameters of the first camera and the second camera parameters of the second camera. There may be various specific calibration methods. For example, the first camera and the second camera may be calibrated respectively by Zhang Zhengyou's calibration method.
示例性的,所述分别对所述第一原始图像和第二原始图像进行校正可以包括对所述第一原始图像进行畸变校正和/或立体校正,并且,对所述第二原始图像进行畸变校正和/或立体校正。其中,所述畸变校正可以是通过畸变参数等来校正对应的图像的图像畸变,如校正图像径向畸变以及图像切向畸变。所述立体校正可以将两个图像的非共面行对准,校正成共面行对准,此时,校正后的第一原始图像的平面和校正后的第二原始图像的平面平行,对应的相机光轴共心,并且,校正后的第一原始图像和校正后的第二原始图像的极点处于无穷远处。Exemplarily, the separately correcting the first original image and the second original image may include performing distortion correction and/or stereo correction on the first original image, and performing distortion on the second original image. Correction and/or Stereo Correction. The distortion correction may be to correct the image distortion of the corresponding image through distortion parameters, such as correcting the radial distortion of the image and the tangential distortion of the image. The stereo correction can align the non-coplanar lines of the two images into a coplanar line alignment. At this time, the plane of the corrected first original image is parallel to the plane of the corrected second original image, corresponding to The optical axes of the cameras are concentric, and the poles of the corrected first original image and the corrected second original image are at infinity.
通过本申请实施例,可以对所述第一原始图像和第二原始图像进行校正,获得共面行对准的所述第一模态图像和所述第二模态图像,从而可以在后续查找匹配点对时,在图像平面相互平行的图像中进行查找,避免由于图像畸变和图像拍照视角等差异所照成的误差,提升匹配点对的查找效率和准确性,从而提升图像对齐的准确性。Through the embodiments of the present application, the first original image and the second original image can be corrected to obtain the first modal image and the second modal image aligned in a coplanar row, so that the subsequent search can be performed. When matching point pairs, search in images whose image planes are parallel to each other to avoid errors caused by differences in image distortion and image shooting angle, improve the search efficiency and accuracy of matching point pairs, and thus improve the accuracy of image alignment .
在一些实施例中,所述针对第一模态图像中预先划分得到的每一个第一网格区域,确定所述第一网格区域中的至少两个第一候选匹配点,包括:In some embodiments, determining at least two first candidate matching points in the first grid area for each pre-divided first grid area in the first modal image includes:
针对第一模态图像中预先划分得到的每一个第一网格区域,根据所述第一网格区域的像素点梯度信息,确定所述第一网格区域中的至少两个第一候选匹配点。For each first grid area pre-divided in the first modal image, determine at least two first candidate matches in the first grid area according to the pixel point gradient information of the first grid area point.
本申请实施例中,所述像素点梯度信息可以反映所述像素点的像素值相对于周围像素点的像素值的变化情况。在一些示例中,所述第一网格区域本身的像素点梯度信息可以指示所述第一网格区域的图像内容分布情况,因此,若所述第一网格区域本身的像素点梯度变化范围较大,且梯度值较大,则可能该第一网格区域内的信息量较多,可以提高所述第一网格区域中的第一候选匹配点的个数。In the embodiment of the present application, the gradient information of the pixel point may reflect the change of the pixel value of the pixel point relative to the pixel value of the surrounding pixel points. In some examples, the pixel point gradient information of the first grid area itself may indicate the distribution of image content in the first grid area. Therefore, if the pixel point gradient variation range of the first grid area itself If the value is larger and the gradient value is larger, the amount of information in the first grid area may be large, and the number of the first candidate matching points in the first grid area can be increased.
而在一些示例中,可以结合所述第一网格区域的像素点梯度信息,以及所述第一网格区域所对应的第二网格区域中的像素点梯度信息,来确定所述第一网格区域中的第一候选匹配点的个数。例如,若所述第一网格区域所对应的第二网格区域中的像素点梯度信息与所述第一网格区域的像素点梯度信息之间的差异较大,那么,可以认为该第一网格区域与该第一网格区域所对应的第二网格区域之间的相似度较差,重合程度较差,因此,可以提高所述第一网格区域中的第一候选匹配点的个数,以尽可能多的获取该第一网格区域与该第一网格区域所对应的第二网格区域之间的匹配点对,从而提升图像对齐的准确性。In some examples, the first grid area may be determined by combining the pixel point gradient information of the first grid area and the pixel point gradient information in the second grid area corresponding to the first grid area. The number of first candidate matching points in the grid area. For example, if the difference between the gradient information of the pixel points in the second grid area corresponding to the first grid area and the gradient information of the pixel points in the first grid area is large, it can be considered that the first grid area The similarity between a grid area and the second grid area corresponding to the first grid area is poor, and the degree of coincidence is poor. Therefore, the first candidate matching point in the first grid area can be improved. to obtain as many matching point pairs as possible between the first grid area and the second grid area corresponding to the first grid area, thereby improving the accuracy of image alignment.
在一些实施例中,所述针对第一模态图像中预先划分得到的每一个第一网格区域,根据所述第一网格区域的像素点梯度信息,确定所述第一网格区域中的至少两个第一候选匹配点,包括:In some embodiments, for each first grid area pre-divided in the first modal image, according to pixel point gradient information of the first grid area, determine the area in the first grid area. at least two first candidate matching points of , including:
针对第一模态图像中预先划分得到的每一个第一网格区域,根据所述第一网格区域中 每个第一像素点的第一梯度值,以及所述第一网格区域所对应的第二网格区域中每个第二像素点的第二梯度值,确定所述第一网格区域与所述第一网格区域所对应的第二网格区域之间的对齐误差;For each first grid area pre-divided in the first modal image, according to the first gradient value of each first pixel point in the first grid area and the corresponding value of the first grid area The second gradient value of each second pixel point in the second grid area, to determine the alignment error between the first grid area and the second grid area corresponding to the first grid area;
根据所述对齐误差,确定所述第一网格区域中的第一候选匹配点的个数;determining the number of the first candidate matching points in the first grid area according to the alignment error;
根据所述第一候选匹配点的个数,确定所述第一网格区域中的第一候选匹配点。A first candidate matching point in the first grid area is determined according to the number of the first candidate matching points.
所述对齐误差可以反映所述第一网格区域与所述第一网格区域所对应的第二网格区域之间的像素点梯度信息的差异。若所述第一网格区域与所述第一网格区域所对应的第二网格区域之间的对齐误差较大,那么,可以认为所述第一网格区域与所述第一网格区域所对应的第二网格区域之间没有对齐,很可能在后续融合时产生鬼影等情况,因此,若所述对齐误差较大,则可以增大所述第一网格区域中的第一候选匹配点的个数,以在后续获得所述第一网格区域与所述第一网格区域所对应的第二网格区域之间更准确的变换关系。具体的,可以通过比对每个第一像素点的第一梯度值与对应的第二像素点的第二梯度值之间的差等方式,计算得到所述对齐误差。The alignment error may reflect a difference in pixel point gradient information between the first grid area and a second grid area corresponding to the first grid area. If the alignment error between the first grid area and the second grid area corresponding to the first grid area is large, it can be considered that the first grid area and the first grid area There is no alignment between the second grid regions corresponding to the regions, and ghost images are likely to occur during subsequent fusion. Therefore, if the alignment error is large, the first grid region in the first grid region can be increased. A number of candidate matching points, so as to obtain a more accurate transformation relationship between the first grid area and the second grid area corresponding to the first grid area later. Specifically, the alignment error may be calculated and obtained by comparing the difference between the first gradient value of each first pixel point and the second gradient value of the corresponding second pixel point.
在计算得到所述对齐误差之后,可以根据所述对齐误差的大小,确定所述第一网格区域中的第一候选匹配点的个数。例如,若所述对齐误差大于预设误差阈值,则确定所述第一网格区域中的第一候选匹配点的个数为M,而若所述对齐误差不大于预设误差阈值,则确定所述第一网格区域中的第一候选匹配点的个数为N,其中N、M分别为正整数,且M大于N。After the alignment error is obtained by calculation, the number of the first candidate matching points in the first grid area may be determined according to the size of the alignment error. For example, if the alignment error is greater than a preset error threshold, determine that the number of first candidate matching points in the first grid area is M, and if the alignment error is not greater than a preset error threshold, determine The number of the first candidate matching points in the first grid area is N, where N and M are positive integers respectively, and M is greater than N.
本申请实施例中,确定所述第一候选匹配点的个数之后,可以根据所述第一网格区域的大小以及所述第一候选匹配点的个数等信息,确定各个第一候选匹配点在所述第一网格区域中的分布情况,从而确定所述第一网格区域中的第一候选匹配点的位置。In the embodiment of the present application, after the number of the first candidate matching points is determined, each first candidate matching point may be determined according to information such as the size of the first grid area and the number of the first candidate matching points distribution of points in the first grid area, so as to determine the position of the first candidate matching point in the first grid area.
示例性的,如图2所示,为第一候选匹配点在第一网格区域中的分布方式的一种示例性示意图。Exemplarily, as shown in FIG. 2 , it is an exemplary schematic diagram of the distribution manner of the first candidate matching points in the first grid area.
其中,若对齐误差大于预设误差阈值,则确定所述第一网格区域中的第一候选匹配点的个数为9,而若所述对齐误差不大于预设误差阈值,则确定所述第一网格区域中的第一候选匹配点的个数为4。Wherein, if the alignment error is greater than a preset error threshold, the number of the first candidate matching points in the first grid area is determined to be 9, and if the alignment error is not greater than a preset error threshold, the number of the first candidate matching points is determined to be 9. The number of the first candidate matching points in the first grid area is four.
在一些实施例中,所述针对第一模态图像中预先划分得到的每一个第一网格区域,根据所述第一网格区域中每个第一像素点的第一梯度值,以及所述第一网格区域所对应的第二网格区域中每个第二像素点的第二梯度值,确定所述第一网格区域与所述第一网格区域所对应的第二网格区域之间的对齐误差,包括:In some embodiments, for each first grid area pre-divided in the first modal image, according to the first gradient value of each first pixel in the first grid area, and the the second gradient value of each second pixel point in the second grid area corresponding to the first grid area, to determine the second grid area corresponding to the first grid area and the first grid area Alignment errors between regions, including:
针对所述第一网格区域中的每一个第一像素点,将所述第一像素点的第一梯度值与所述第一像素点所对应的第二像素点的第二梯度值之间的差值的绝对值作为第一绝对值,其中,所述第一像素点在所述第一模态图像中的位置与所述第一像素点所对应的第二像素点在所述第二模态图像中的位置相同;For each first pixel point in the first grid area, a first gradient value of the first pixel point and the second gradient value of the second pixel point corresponding to the first pixel point are set between The absolute value of the difference is taken as the first absolute value, wherein the position of the first pixel in the first modal image and the second pixel corresponding to the first pixel are in the second The position in the modal image is the same;
将所述第一网格区域中的各个第一梯度值的绝对值的和作为第一求和结果,并将所述第一网格区域所对应的第二网格区域中的各个第二梯度值的绝对值的和作为第二求和结果;Taking the sum of the absolute values of the first gradient values in the first grid area as the first summation result, and using the second gradient values in the second grid area corresponding to the first grid area The sum of the absolute values of the values is used as the second summation result;
根据所述第一网格区域中的各个第一绝对值、所述第一求和结果和所述第二求和结果,确定所述第一网格区域与所述第一网格区域所对应的第二网格区域之间的对齐误差。According to each first absolute value in the first grid area, the first summation result and the second summation result, it is determined that the first grid area corresponds to the first grid area The alignment error between the second grid regions.
以第一网格区域A为例,第一网格区域A的坐标范围为x∈[0,w 1],y∈[0,h 1],则第一网格区域A的对齐误差δ 1为: Taking the first grid area A as an example, the coordinate range of the first grid area A is x∈[0,w 1 ],y∈[0,h 1 ], then the alignment error of the first grid area A is δ 1 for:
Figure PCTCN2021117471-appb-000001
Figure PCTCN2021117471-appb-000001
其中,grad rgb(x,y)为任一第一像素点的第一梯度值,grad spectral(x,y)为任一第二像素点的第二梯度值。 Wherein, grad rgb (x, y) is the first gradient value of any first pixel point, and grad spectral (x, y) is the second gradient value of any second pixel point.
若δ 1≥threshold,则第一候选匹配点的个数可以为(3*n) 2,否则第一候选匹配点的 个数可以为n 2,threshold为预设误差阈值。 If δ 1 ≥ threshold, the number of the first candidate matching points may be (3*n) 2 , otherwise the number of the first candidate matching points may be n 2 , and the threshold is a preset error threshold.
步骤S102,针对所述第一网格区域中的每一个第一候选匹配点,从第二模态图像中查找所述第一候选匹配点所对应的第一目标像素点,其中,所述第一目标像素点与对应的所述第一候选匹配点之间的互相关信息符合预设互相关条件。Step S102, for each first candidate matching point in the first grid area, search for the first target pixel point corresponding to the first candidate matching point from the second modal image, wherein the first candidate matching point is The cross-correlation information between a target pixel point and the corresponding first candidate matching point conforms to a preset cross-correlation condition.
本申请实施例中,所述互相关信息可以包括归一化互相关(Normalized Cross Correlation,NCC)值、根据预设互相关函数计算得到的互相关值等可以度量两个相关像素点的互相关性的值。所述预设互相关条件可以根据所述互相关信息的类型来确定。例如,若所述互相关信息包括所述归一化互相关值,那么所述预设互相关条件可以为所述归一化互相关值大于预设的互相关阈值。In the embodiment of the present application, the cross-correlation information may include a normalized cross-correlation (Normalized Cross Correlation, NCC) value, a cross-correlation value calculated according to a preset cross-correlation function, etc., which may measure the cross-correlation of two related pixels. value of sex. The preset cross-correlation condition may be determined according to the type of the cross-correlation information. For example, if the cross-correlation information includes the normalized cross-correlation value, the preset cross-correlation condition may be that the normalized cross-correlation value is greater than a preset cross-correlation threshold.
在一些实施例中,所述步骤S102包括:In some embodiments, the step S102 includes:
步骤S301,针对所述第一网格区域中的每一个第一候选匹配点,从第二模态图像中确定所述第一候选匹配点所对应的感兴趣区域;Step S301, for each first candidate matching point in the first grid area, determine the region of interest corresponding to the first candidate matching point from the second modal image;
步骤S302,针对所述感兴趣区域中的每一个像素点,计算所述像素点与所述第一候选匹配点之间的互相关度量值;Step S302, for each pixel in the region of interest, calculate the cross-correlation metric value between the pixel and the first candidate matching point;
步骤S303,若所述感兴趣区域所中的各个像素点所对应的互相关度量值中的最大值大于预设阈值,则将该最大值在所述感兴趣区域中所对应的像素点作为所述第一候选匹配点的第一目标像素点。Step S303, if the maximum value of the cross-correlation metric values corresponding to each pixel in the region of interest is greater than a preset threshold, then the pixel corresponding to the maximum value in the region of interest is used as the maximum value in the region of interest. The first target pixel point of the first candidate matching point.
本申请实施例中,所述感兴趣区域可以认为是查找对应的所述第一候选匹配点的第一目标像素点的查找范围。所述感兴趣区域的大小可以根据场景需求来确定,例如,可以根据计算资源、第一模态图像和所述第二模态图像所分别对应的摄像头之间的位置关系等等信息来预先确定。所述互相关度量值可以为归一化互相关(Normalized Cross Correlation,NCC)值、根据预设互相关函数计算得到的互相关值等等。In this embodiment of the present application, the region of interest may be considered as a search range for searching for a first target pixel point corresponding to the first candidate matching point. The size of the region of interest may be determined according to scene requirements, for example, may be predetermined according to information such as computing resources, the positional relationship between the cameras corresponding to the first modal image and the second modal image respectively . The cross-correlation metric value may be a normalized cross-correlation (Normalized Cross Correlation, NCC) value, a cross-correlation value calculated according to a preset cross-correlation function, and the like.
在一些实施例中,所述互相关度量值为归一化互相关值;In some embodiments, the cross-correlation metric value is a normalized cross-correlation value;
所述针对所述感兴趣区域中的每一个像素点,计算所述像素点与所述第一候选匹配点之间的互相关度量值,包括:The calculating, for each pixel point in the region of interest, a cross-correlation metric value between the pixel point and the first candidate matching point, including:
针对所述感兴趣区域中的每一个像素点,根据指定关联区域,计算所述像素点与所述第一候选匹配点之间的归一化互相关值,其中,所述指定关联区域为所述第二模态图像中以所述像素点为中心的指定区域。For each pixel in the region of interest, the normalized cross-correlation value between the pixel and the first candidate matching point is calculated according to the specified correlation region, where the specified correlation region is the specified correlation region. a designated area centered on the pixel in the second modal image.
以某个第一候选匹配点(x 1,y 1)为例,该第一候选匹配点(x 1,y 1)的像素值为R rgb(x 1,y 1)。确定所述第一候选匹配点(x 1,y 1)的感兴趣区域的坐标范围为
Figure PCTCN2021117471-appb-000002
即该感兴趣区域是以
Figure PCTCN2021117471-appb-000003
为起点,宽高均为k的矩形区域。针对该感兴趣区域中的某一像素点R spectral(x,y),该像素点R spectral(x,y)的指定关联区域为以该像素点R spectral(x,y)为中心,以d为宽高的矩形区域D。
Taking a certain first candidate matching point (x 1 , y 1 ) as an example, the pixel value of the first candidate matching point (x 1 , y 1 ) is R rgb (x 1 , y 1 ). Determine the coordinate range of the region of interest of the first candidate matching point (x 1 , y 1 ) as
Figure PCTCN2021117471-appb-000002
That is, the region of interest is
Figure PCTCN2021117471-appb-000003
As the starting point, a rectangular area with both width and height k. For a certain pixel point R spectral (x,y) in the region of interest, the designated associated area of the pixel point R spectral (x,y) is the pixel point R spectral (x,y) as the center, with d is a rectangular area D of width and height.
计算所述第一候选匹配点与像素点R spectral(x,y)的归一化互相关值NCC,计算公式如下: Calculate the normalized cross-correlation value NCC of the first candidate matching point and the pixel point R spectral (x, y), and the calculation formula is as follows:
Figure PCTCN2021117471-appb-000004
Figure PCTCN2021117471-appb-000004
其中,u rgb_roi表示感兴趣区域在第一模态图像中的对应区域内的各个像素点的像素值的期望,u spectral_roi表示感兴趣区域内的各个像素点的像素值的期望,而σ rgb_roi表示感兴趣区域在第一模态图像中的对应区域内的各个像素点的像素值的方差,σ spectral_roi表示感兴趣区域内的各个像素点的像素值的方差,NCC越大时,表示所述第一候选匹配点与像素点R spectral(x,y)越相似。 Among them, u rgb_roi represents the expectation of the pixel value of each pixel in the corresponding region of the region of interest in the first modal image, u spectral_roi represents the expectation of the pixel value of each pixel in the region of interest, and σ rgb_roi represents The variance of the pixel value of each pixel in the corresponding region of the region of interest in the first modal image, σ spectral_roi represents the variance of the pixel value of each pixel in the region of interest, when the NCC is larger, it means that the first A candidate matching point is more similar to the pixel point R spectral (x, y).
计算所述感兴趣区域中的每一个像素点相对于所述第一候选匹配点的NCC值,并进行排序,选择最大的NCC值为NCC(x m,y m),若该NCC(x m,y m)≥T ncc,则该NCC(x m,y m)所对 应的所述感兴趣区域中的像素点即为所述第一候选匹配点的第一目标像素点。T ncc可以为预设阈值。 Calculate the NCC value of each pixel in the region of interest relative to the first candidate matching point, and sort, and select the largest NCC value NCC (x m , y m ), if the NCC (x m ) , y m ) ≥T ncc , then the pixel in the region of interest corresponding to the NCC(x m , y m ) is the first target pixel of the first candidate matching point. T ncc can be a preset threshold.
步骤S103,若从所述第二模态图像中查找到所述第一候选匹配点所对应的第一目标像素点,则将所述第一候选匹配点和所述第一候选匹配点所对应的第一目标像素点作为所述第一模态图像与所述第二模态图像之间的一组匹配点对。Step S103, if the first target pixel point corresponding to the first candidate matching point is found from the second modal image, then the first candidate matching point and the first candidate matching point corresponding to the first candidate matching point are found. The first target pixel point of is used as a set of matching point pairs between the first modal image and the second modal image.
通过所述互相关信息来度量像素点之间的相似性,以查找与所述第一候选匹配点所对应的第一目标像素点,能够减小不同模态的图像在结构相似区域的梯度方向上的差异所带来的干扰,相比于现有的基于SIFT等方法的特征点检测和匹配,可以提升所获得的匹配点对的准确性。Using the cross-correlation information to measure the similarity between pixels to find the first target pixel corresponding to the first candidate matching point can reduce the gradient direction of images of different modalities in structurally similar regions Compared with the existing feature point detection and matching based on SIFT and other methods, the accuracy of the obtained matching point pairs can be improved.
在一些实施例中,在根据各组匹配点对,获得所述第一网格区域与所述第一网格区域在所述第二模态图像中所对应的第二网格区域之间的网格变换矩阵之前,还包括:In some embodiments, the distance between the first grid area and the second grid area corresponding to the first grid area in the second modal image is obtained according to each set of matched point pairs. Before the mesh transformation matrix, also include:
针对所述第二模态图像中预先划分得到的每一个第二网格区域,根据所述第二网格区域的梯度信息,确定所述第二网格区域中的至少两个第二候选匹配点;For each second grid area pre-divided in the second modal image, determine at least two second candidate matches in the second grid area according to the gradient information of the second grid area point;
针对所述第二网格区域中的每一个第二候选匹配点,从第一模态图像中查找所述第二候选匹配点所对应的第二目标像素点,其中,所述第二目标像素点与对应的所述第二候选匹配点之间的互相关信息符合预设互相关条件;For each second candidate matching point in the second grid area, a second target pixel corresponding to the second candidate matching point is searched from the first modal image, wherein the second target pixel The cross-correlation information between the point and the corresponding second candidate matching point meets a preset cross-correlation condition;
若从所述第一模态图像中查找到所述第二候选匹配点所对应的第二目标像素点,则将所述第二候选匹配点和所述第二候选匹配点所对应的第二目标像素点作为所述第一模态图像与所述第二模态图像之间的一组匹配点对。If the second target pixel point corresponding to the second candidate matching point is found from the first modal image, the second candidate matching point and the second matching point corresponding to the second candidate matching point The target pixel points are used as a set of matching point pairs between the first modal image and the second modal image.
本申请实施例中,不仅可以以所述第一模态图像的图像坐标系为基准,根据所述第一候选匹配点查找所述匹配点对,还可以以第二模态图像的图像坐标系为基准,根据所述第二候选匹配点查找所述匹配点对,从而可以增加所述匹配点对的数量。In this embodiment of the present application, not only can the image coordinate system of the first modal image be used as a benchmark to search for the matching point pair according to the first candidate matching points, but also the image coordinate system of the second modal image can be used As a benchmark, the matching point pair is searched according to the second candidate matching point, so that the number of the matching point pair can be increased.
步骤S104,根据所述匹配点对,获得所述第一网格区域与所述第一网格区域在所述第二模态图像中所对应的第二网格区域之间的网格变换矩阵,其中,所述第一网格区域在所述第一模态图像中的位置与所述第一网格区域所对应的第二网格区域在所述第二模态图像中的位置相同。Step S104, obtaining a grid transformation matrix between the first grid area and the second grid area corresponding to the first grid area in the second modal image according to the matching point pair , wherein the position of the first grid area in the first modal image is the same as the position of the second grid area corresponding to the first grid area in the second modal image.
本申请实施例中,各个所述第一网格区域在所述第一模态图像的分布方式与各个所述第二网格区域在所述第二模态图像的分布方式相同。In this embodiment of the present application, the distribution manner of each of the first grid areas in the first modal image is the same as the distribution manner of each of the second grid areas in the second modal image.
所述网格变换矩阵可以指示所述第一网格区域内的图像相对于对应的第二网格区域内的图像的平移变换关系和/或旋转变换关系等。所述网格变换矩阵的具体计算方式可以根据所述匹配点对的个数等情况来确定。若所述第一网格区域与所述第一网格区域在所述第二模态图像中所对应的第二网格区域之间的匹配点对的个数不小于预设个数,例如,不小于4,则可以根据所述匹配点对,通过仿射变换、单应性变换等方式,计算第一网格区域与所述第一网格区域在所述第二模态图像中所对应的第二网格区域之间的网格变换矩阵。而若所述第一网格区域与所述第一网格区域在所述第二模态图像中所对应的第二网格区域之间的匹配点对的个数小于预设个数,则可以根据所述匹配点对,进一步计算所述第一网格区域中的其他点在所述第一网格区域在所述第二模态图像中所对应的第二网格区域中的匹配点,再计算所述网格变换矩阵。The grid transformation matrix may indicate a translational transformation relationship and/or a rotational transformation relationship of the image in the first grid area with respect to the image in the corresponding second grid area, and the like. The specific calculation method of the grid transformation matrix may be determined according to the situation such as the number of the matching point pairs. If the number of matching point pairs between the first grid area and the second grid area corresponding to the first grid area in the second modal image is not less than a preset number, for example , not less than 4, then according to the matching point pair, through affine transformation, homography transformation, etc., to calculate the difference between the first grid area and the first grid area in the second modal image The grid transformation matrix between the corresponding second grid regions. And if the number of matching point pairs between the first grid area and the second grid area corresponding to the first grid area in the second modal image is less than the preset number, then The matching points of other points in the first grid area in the second grid area corresponding to the first grid area in the second modal image may be further calculated according to the matching point pair , and then calculate the grid transformation matrix.
步骤S105,根据各个网格变换矩阵,将所述第二模态图像变换为相对于所述第一模态图像对齐的目标图像。Step S105: Transform the second modal image into a target image aligned with the first modal image according to each grid transformation matrix.
本申请实施例中,可以根据各个网格变换矩阵,分别对各个第二网格区域进行变换,再将变换后的第二网格区域进行合并,获得所述目标图像。此时,各个第二网格区域的变换可以相互独立,而不是通过一个统一的变换矩阵来实现整个第二模态图像的变换,可以提升每个局部区域的变换的准确性,从而大大提升图像对齐的精度。In this embodiment of the present application, each second grid region may be transformed according to each grid transformation matrix, and then the transformed second grid regions may be combined to obtain the target image. At this time, the transformation of each second grid area can be independent of each other, instead of realizing the transformation of the entire second modal image through a unified transformation matrix, which can improve the accuracy of the transformation of each local area, thereby greatly improving the image. Alignment precision.
在一些实施例中,所述根据所述匹配点对,获得所述第一网格区域与所述第一网格区域在所述第二模态图像中所对应的第二网格区域之间的网格变换矩阵,包括:In some embodiments, the obtaining between the first grid area and the second grid area corresponding to the first grid area in the second modal image according to the matching point pair Grid transformation matrix, including:
根据所述匹配点对、所述第一网格区域中的指定顶点的坐标以及所述第一网格区域中的指定顶点在所述第一网格区域所对应的第二网格区域中的期望坐标,构建最小二乘模型;According to the matching point pair, the coordinates of the designated vertex in the first mesh area, and the coordinate of the designated vertex in the first mesh area in the second mesh area corresponding to the first mesh area Expected coordinates, build a least squares model;
对所述最小二乘模型进行求解,获得所述第一网格区域中的指定顶点在所述第一网格区域所对应的第二网格区域中的期望坐标;Solving the least squares model to obtain the desired coordinates of the specified vertex in the first grid region in the second grid region corresponding to the first grid region;
根据所述期望坐标,以及所述第一网格区域所对应的第二网格区域中的指定顶点的坐标,获得所述第一网格区域与所述第一网格区域所对应的第二网格区域之间的单应性矩阵,并将所述单应性矩阵作为所述网格变换矩阵;According to the expected coordinates and the coordinates of the specified vertex in the second mesh area corresponding to the first mesh area, obtain the second mesh area corresponding to the first mesh area and the first mesh area a homography matrix between grid regions, and using the homography matrix as the grid transformation matrix;
所述根据各个网格变换矩阵,将所述第二模态图像变换为相对于所述第一模态图像对齐的目标图像,包括:The transforming the second modal image into a target image aligned relative to the first modal image according to each grid transformation matrix includes:
针对每一个第二网格区域,根据所述第二网格区域所对应的单应性矩阵对所述第二网格区域进行透视变换;For each second grid region, perform perspective transformation on the second grid region according to the homography matrix corresponding to the second grid region;
根据各个透视变换后的第二网格区域,获得相对于所述第一模态图像对齐的目标图像。A target image aligned with respect to the first modality image is obtained according to each perspective transformed second grid area.
在一些示例中,所述指定顶点可以为所述第一网格区域的四个顶点。此时,可以通过所述指定顶点可以为所述第一网格区域的四个顶点,求解所述所述第一网格区域与所述第一网格区域所对应的第二网格区域之间的单应性矩阵。当然,在一些实施例中,在存在多个匹配点对的情况下,所述指定顶点的个数也可以少于3个,此时,可以结合所述指定顶点的期望坐标和所述匹配点对计算所述单应性矩阵。In some examples, the designated vertices may be four vertices of the first mesh region. At this time, the specified vertices can be four vertices of the first mesh area, and the relationship between the first mesh area and the second mesh area corresponding to the first mesh area can be solved. The homography matrix between . Of course, in some embodiments, when there are multiple matching point pairs, the number of the specified vertices may also be less than 3. In this case, the desired coordinates of the specified vertices and the matching points may be combined Calculate the homography matrix for the pair.
所述最小二乘模型的构建以及求解可以根据现有技术来实现。示例性的,可以根据所述匹配点对、所述第一网格区域中的指定顶点的坐标以及所述第一网格区域中的指定顶点在所述第一网格区域所对应的第二网格区域中的期望坐标,构建所述最小二乘模型,该最小二乘模型可以通过计算第一图形中的顶点与第二图形中的顶点之间的预设误差,来指示第一图形和第二图形之间的形状相似度。其中,所述第一图形为所述匹配点对中的第一候选匹配点与所述第一网格区域中的指定顶点,所述第二图形为所述期望坐标与所述匹配点对中的第一目标像素点所构成的图形。因此,可以通过优化该预设误差,使得该预设误差最小化,来求解得到所述第一网格区域中的指定顶点在所述第一网格区域所对应的第二网格区域中的期望坐标。The construction and solution of the least squares model can be implemented according to the prior art. Exemplarily, according to the matching point pair, the coordinates of the designated vertex in the first mesh area, and the second corresponding to the first mesh area of the designated vertex in the first mesh area. desired coordinates in the grid area, constructing the least squares model that can indicate the first graph and the second graph by calculating a preset error between vertices in the first graph and The shape similarity between the second graphics. Wherein, the first graph is a first candidate matching point in the matching point pair and a designated vertex in the first grid area, and the second graph is a center between the desired coordinate and the matching point The graphics composed of the first target pixel points. Therefore, the preset error can be optimized to minimize the preset error, so as to obtain the relationship between the specified vertex in the first mesh area in the second mesh area corresponding to the first mesh area desired coordinates.
具体的,可以通过高斯牛顿法、梯度下降法、LM(Levenberg-Marquart)法等方式对所述最小二乘模型进行求解。具体的求解方法在此不做限制。Specifically, the least squares model can be solved by means of Gauss-Newton method, gradient descent method, LM (Levenberg-Marquart) method, or the like. The specific solution method is not limited here.
在一些实施例中,在获取到所述目标图像之后,可以将所述目标图像存储为二进制文件的形式,以供后续的图像读取和处理。当然,所述目标图像也可以根据场景需要存储为其他格式。In some embodiments, after the target image is acquired, the target image may be stored in the form of a binary file for subsequent image reading and processing. Of course, the target image can also be stored in other formats according to the needs of the scene.
下面以一个具体示例,说明本申请实施例的一种具体实现示意图。A specific implementation schematic diagram of an embodiment of the present application is described below with a specific example.
如图4所示,为实际应用中,采用本申请一实施例所实现的图像处理过程。As shown in FIG. 4 , in a practical application, an image processing process implemented by an embodiment of the present application is adopted.
其中,图4(a)中为第一模态图像,图4(b)中为第二模态图像。若所述第一模态图像和所述第二模态图像共面行对准,那么,将所述第一模态图像和第二模态图像直接融合后,获得图4(c)。此时,图4(c)中出现明显的位置偏差。Among them, Fig. 4(a) is the first modal image, and Fig. 4(b) is the second modal image. If the first modal image and the second modal image are aligned in a coplanar row, then, after directly merging the first modal image and the second modal image, FIG. 4( c ) is obtained. At this time, a clear positional deviation appears in Fig. 4(c).
在获得所述第一模态图像和所述第二模态图像之后,可以针对第一模态图像中预先划分得到的每一个第一网格区域,根据所述第一网格区域中每个第一像素点的第一梯度值,以及所述第一网格区域所对应的第二网格区域中每个第二像素点的第二梯度值,确定所述第一网格区域与所述第一网格区域所对应的第二网格区域之间的对齐误差。After the first modal image and the second modal image are obtained, for each first grid area pre-divided in the first modal image, according to each of the first grid areas The first gradient value of the first pixel point, and the second gradient value of each second pixel point in the second grid area corresponding to the first grid area, determine the relationship between the first grid area and the The alignment error between the second grid areas corresponding to the first grid area.
若所述齐次误差大于预设误差阈值,那么,对应的所述第一网格区域中的第一候选匹配点的个数可以较多,例如为9个;而若所述齐次误差不大于预设误差阈值,那么,对应的所述第一网格区域中的第一候选匹配点的个数可以较少,例如为4个。如图4(d)所示,为本示例性场景中,第一候选匹配点的个数较多的所述第一网格区域和第一候选匹配点的个数较多的所述第一网格区域的分布情况。If the homogeneous error is greater than the preset error threshold, the number of the corresponding first candidate matching points in the first grid area may be larger, for example, 9; and if the homogeneous error is not equal to is greater than the preset error threshold, then, the number of the corresponding first candidate matching points in the first grid area may be less, for example, four. As shown in FIG. 4( d ), in this exemplary scenario, the first grid area with a large number of first candidate matching points and the first grid area with a large number of first candidate matching points The distribution of grid areas.
在获得各个第一网格区域所分别确定的匹配点对之后,根据所述匹配点对,获得各个网格变换矩阵。然后,根据所述网格变换矩阵,根据所述匹配点对、如图4(e)所示的第一模态图像中的各个第一网格区域的4个顶点坐标,以及,所述第一网格区域中的4个顶点坐标在所述第一网格区域所对应的第二网格区域中的期望坐标,构建最小二乘模型。求解所述最小二乘模型,获得如图4(f)所示的所述第一网格区域中的4个顶点坐标在所述第一网格区域所对应的第二网格区域中的期望坐标。After the matching point pairs respectively determined by the respective first grid regions are obtained, each grid transformation matrix is obtained according to the matching point pairs. Then, according to the grid transformation matrix, according to the matching point pair, the coordinates of the four vertices of each first grid area in the first modal image as shown in FIG. 4(e), and the The coordinates of four vertices in a grid area are expected coordinates in the second grid area corresponding to the first grid area, and a least squares model is constructed. Solve the least squares model to obtain the expectation of the coordinates of the 4 vertices in the first grid area as shown in Figure 4(f) in the second grid area corresponding to the first grid area coordinate.
然后,根据第二网格区域中的4个顶点的期望坐标,获得所述第一网格区域与所述第一网格区域所对应的第二网格区域之间的单应性矩阵,并对所述第二网格区域进行透视变换,从而得到如图4(g)所示的目标图像。Then, according to the expected coordinates of the 4 vertices in the second mesh area, a homography matrix between the first mesh area and the second mesh area corresponding to the first mesh area is obtained, and Perspective transformation is performed on the second grid area, thereby obtaining the target image as shown in FIG. 4(g).
本申请实施例中,针对第一模态图像中预先划分得到的每一个第一网格区域,确定所述第一网格区域中的至少两个第一候选匹配点;然后,针对所述第一网格区域中的每一个第一候选匹配点,从第二模态图像中查找所述第一候选匹配点所对应的第一目标像素点,其中,所述第一目标像素点与对应的所述第一候选匹配点之间的互相关信息符合预设互相关条件。此时,可以通过互相关信息来度量像素点之间的相似性,从而查找与所述第一候选匹配点所对应的第一目标像素点。In the embodiment of the present application, for each first grid area pre-divided in the first modal image, at least two first candidate matching points in the first grid area are determined; then, for the first grid area For each first candidate matching point in a grid area, the first target pixel corresponding to the first candidate matching point is searched from the second modal image, wherein the first target pixel corresponds to the corresponding The cross-correlation information between the first candidate matching points conforms to a preset cross-correlation condition. At this time, the similarity between the pixel points can be measured by the cross-correlation information, so as to find the first target pixel point corresponding to the first candidate matching point.
若从所述第二模态图像中查找到所述第一候选匹配点所对应的第一目标像素点,则将所述第一候选匹配点和所述第一候选匹配点所对应的第一目标像素点作为所述第一模态图像与所述第二模态图像之间的一组匹配点对;此时,可以针对每一个第一网格区域,通过像素点之间的互相关信息获取到该第一网格区域与所述第一网格区域在所述第二模态图像中所对应的第二网格区域之间的匹配点对,从而根据所述匹配点对,获得所述第一网格区域与所述第一网格区域在所述第二模态图像中所对应的第二网格区域之间的网格变换矩阵,然后,可以根据各个网格变换矩阵,将所述第二模态图像变换为相对于所述第一模态图像对齐的目标图像,从而实现了不同模态的图像之间的图像对齐。其中,由于所述图像对齐所需的匹配点对是基于像素点之间的互相关信息确定得到,能够减小不同模态的图像在结构相似区域的梯度方向上的差异所带来的干扰,因此,匹配点对的准确性较高,相应地也保证了最终得到的目标图像的对齐精度,避免了现有的基于SIFT等方法的特征点检测和匹配无法在不同模态的图像之间找到准确的匹配点对,从而使得不同模态的图像之间的图像对齐精度较差的问题。If the first target pixel point corresponding to the first candidate matching point is found from the second modal image, the first candidate matching point and the first matching point corresponding to the first candidate matching point The target pixel is used as a set of matching point pairs between the first modal image and the second modal image; at this time, for each first grid area, the cross-correlation information between the pixels can be used The matching point pair between the first grid area and the second grid area corresponding to the first grid area in the second modal image is obtained, so as to obtain the matching point pair according to the matching point pair. The grid transformation matrix between the first grid region and the second grid region corresponding to the first grid region in the second modal image, and then, according to each grid transformation matrix, the The second modality image is transformed into a target image aligned with respect to the first modality image, thereby realizing image alignment between images of different modality. Wherein, since the matching point pairs required for the image alignment are determined based on the cross-correlation information between the pixels, the interference caused by the difference in the gradient directions of the images of different modalities in the structurally similar regions can be reduced, Therefore, the accuracy of matching point pairs is high, and accordingly, the alignment accuracy of the final target image is also ensured, which avoids that the existing feature point detection and matching based on SIFT and other methods cannot be found between images of different modalities. Accurately match point pairs, so that the image alignment accuracy between images of different modalities is poor.
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should be understood that the size of the sequence numbers of the steps in the above embodiments does not mean the sequence of execution, and the execution sequence of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
对应于上文实施例上述的图像对齐方法,图5示出了本申请实施例提供的一种图像对齐装置的结构框图,为了便于说明,仅示出了与本申请实施例相关的部分。Corresponding to the above-mentioned image alignment method in the above embodiment, FIG. 5 shows a structural block diagram of an image alignment apparatus provided by the embodiment of the present application. For convenience of description, only the part related to the embodiment of the present application is shown.
参照图5,该图像对齐装置5包括:5, the image alignment device 5 includes:
确定模块501,用于针对第一模态图像中预先划分得到的每一个第一网格区域,确定所述第一网格区域中的至少两个第一候选匹配点;A determination module 501, configured to determine at least two first candidate matching points in the first grid area for each first grid area pre-divided in the first modal image;
查找模块502,用于针对所述第一网格区域中的每一个第一候选匹配点,从第二模态图像中查找所述第一候选匹配点所对应的第一目标像素点,其中,所述第一目标像素点与对应的所述第一候选匹配点之间的互相关信息符合预设互相关条件;A search module 502, configured to search for the first target pixel point corresponding to the first candidate matching point from the second modal image for each first candidate matching point in the first grid area, wherein, The cross-correlation information between the first target pixel point and the corresponding first candidate matching point meets a preset cross-correlation condition;
第一处理模块503,用于若从所述第二模态图像中查找到所述第一候选匹配点所对应的第一目标像素点,则将所述第一候选匹配点和所述第一候选匹配点所对应的第一目标像素点作为所述第一模态图像与所述第二模态图像之间的一组匹配点对;The first processing module 503 is configured to, if the first target pixel corresponding to the first candidate matching point is found from the second modal image, compare the first candidate matching point with the first matching point. The first target pixel point corresponding to the candidate matching point is used as a set of matching point pairs between the first modal image and the second modal image;
第二处理模块504,用于根据所述匹配点对,获得所述第一网格区域与所述第一网格区域在所述第二模态图像中所对应的第二网格区域之间的网格变换矩阵,其中,所述第一网格区域在所述第一模态图像中的位置与所述第一网格区域所对应的第二网格区域在所述第二 模态图像中的位置相同;The second processing module 504 is configured to obtain, according to the matching point pair, the distance between the first grid area and the second grid area corresponding to the first grid area in the second modal image The grid transformation matrix of , wherein the position of the first grid area in the first modal image and the second grid area corresponding to the first grid area in the same position;
变换模块505,用于根据各个网格变换矩阵,将所述第二模态图像变换为相对于所述第一模态图像对齐的目标图像。The transformation module 505 is configured to transform the second modal image into a target image aligned with respect to the first modal image according to each grid transformation matrix.
可选的,所述确定模块501具体用于:Optionally, the determining module 501 is specifically used for:
针对第一模态图像中预先划分得到的每一个第一网格区域,根据所述第一网格区域的像素点梯度信息,确定所述第一网格区域中的至少两个第一候选匹配点。For each first grid area pre-divided in the first modal image, determine at least two first candidate matches in the first grid area according to the pixel point gradient information of the first grid area point.
可选的,所述确定模块501具体包括:Optionally, the determining module 501 specifically includes:
第一确定单元,用于针对第一模态图像中预先划分得到的每一个第一网格区域,根据所述第一网格区域中每个第一像素点的第一梯度值,以及所述第一网格区域所对应的第二网格区域中每个第二像素点的第二梯度值,确定所述第一网格区域与所述第一网格区域所对应的第二网格区域之间的对齐误差;a first determining unit, configured to, for each first grid area pre-divided in the first modal image, according to the first gradient value of each first pixel point in the first grid area, and the the second gradient value of each second pixel in the second grid area corresponding to the first grid area, to determine the first grid area and the second grid area corresponding to the first grid area Alignment error between;
第二确定单元,用于根据所述对齐误差,确定所述第一网格区域中的第一候选匹配点的个数;a second determining unit, configured to determine the number of the first candidate matching points in the first grid area according to the alignment error;
第三确定单元,用于根据所述第一候选匹配点的个数,确定所述第一网格区域中的第一候选匹配点。A third determining unit, configured to determine a first candidate matching point in the first grid area according to the number of the first candidate matching points.
可选的,所述第一确定单元具体包括:Optionally, the first determining unit specifically includes:
第一处理子单元,用于针对所述第一网格区域中的每一个第一像素点,将所述第一像素点的第一梯度值与所述第一像素点所对应的第二像素点的第二梯度值之间的差值的绝对值作为第一绝对值,其中,所述第一像素点在所述第一模态图像中的位置与所述第一像素点所对应的第二像素点在所述第二模态图像中的位置相同;a first processing subunit, configured to, for each first pixel in the first grid area, compare the first gradient value of the first pixel with the second pixel corresponding to the first pixel The absolute value of the difference between the second gradient values of the point is taken as the first absolute value, wherein the position of the first pixel point in the first modal image and the first pixel point corresponding to the first pixel point The positions of the two pixel points in the second modal image are the same;
第二处理子单元,用于将所述第一网格区域中的各个第一梯度值的绝对值的和作为第一求和结果,并将所述第一网格区域所对应的第二网格区域中的各个第二梯度值的绝对值的和作为第二求和结果;The second processing subunit is configured to use the sum of the absolute values of the first gradient values in the first grid area as the first summation result, and use the second grid area corresponding to the first grid area The sum of the absolute values of the respective second gradient values in the grid region is used as the second summation result;
确定子单元,用于根据所述第一网格区域中的各个第一绝对值、所述第一求和结果和所述第二求和结果,确定所述第一网格区域与所述第一网格区域所对应的第二网格区域之间的对齐误差。A determination subunit, configured to determine the relationship between the first grid area and the Alignment error between a second grid area corresponding to a grid area.
可选的,所述图像对齐装置5还包括:Optionally, the image alignment device 5 further includes:
获取模块,用于获取通过第一摄像头拍摄得到的第一原始图像和通过第二摄像头拍摄得到的第二原始图像;an acquisition module for acquiring the first original image captured by the first camera and the second original image captured by the second camera;
校正模块,用于根据预先标定的第一摄像头的第一摄像头参数和第二摄像头的第二摄像头参数,分别对所述第一原始图像和第二原始图像进行校正;a correction module, configured to correct the first original image and the second original image respectively according to the pre-calibrated first camera parameters of the first camera and the second camera parameters of the second camera;
第三处理模块,用于将校正后的第一原始图像作为所述第一模态图像,并将校正后的第二原始图像作为第二模态图像,其中,所述第一模态图像和所述第二模态图像共面行对准。a third processing module, configured to take the corrected first original image as the first modality image, and take the corrected second original image as the second modality image, wherein the first modality image and The second modality images are aligned in coplanar rows.
可选的,所述图像对齐装置5还包括:Optionally, the image alignment device 5 further includes:
第二确定模块,用于针对所述第二模态图像中预先划分得到的每一个第二网格区域,根据所述第二网格区域的梯度信息,确定所述第二网格区域中的至少两个第二候选匹配点;The second determining module is configured to, for each second grid area pre-divided in the second modal image, determine the grid area in the second grid area according to the gradient information of the second grid area at least two second candidate matching points;
第二查找模块,用于针对所述第二网格区域中的每一个第二候选匹配点,从第一模态图像中查找所述第二候选匹配点所对应的第二目标像素点,其中,所述第二目标像素点与对应的所述第二候选匹配点之间的互相关信息符合预设互相关条件;The second search module is configured to, for each second candidate matching point in the second grid area, search for the second target pixel point corresponding to the second candidate matching point from the first modal image, wherein , the cross-correlation information between the second target pixel point and the corresponding second candidate matching point meets a preset cross-correlation condition;
第四处理模块,用于若从所述第一模态图像中查找到所述第二候选匹配点所对应的第二目标像素点,则将所述第二候选匹配点和所述第二候选匹配点所对应的第二目标像素点作为所述第一模态图像与所述第二模态图像之间的一组匹配点对。The fourth processing module is configured to, if the second target pixel corresponding to the second candidate matching point is found from the first modal image, compare the second candidate matching point with the second candidate matching point The second target pixel points corresponding to the matching points are used as a set of matching point pairs between the first modal image and the second modal image.
可选的,所述查找模块502具体包括:Optionally, the search module 502 specifically includes:
第四确定单元,用于针对所述第一网格区域中的每一个第一候选匹配点,从第二模态图像中确定所述第一候选匹配点所对应的感兴趣区域;a fourth determining unit, configured to, for each first candidate matching point in the first grid area, determine a region of interest corresponding to the first candidate matching point from the second modal image;
计算单元,用于针对所述感兴趣区域中的每一个像素点,计算所述像素点与所述第一 候选匹配点之间的互相关度量值;a calculation unit, for calculating the cross-correlation metric value between the pixel and the first candidate matching point for each pixel in the region of interest;
第一处理单元,用于若所述感兴趣区域所中的各个像素点所对应的互相关度量值中的最大值大于预设阈值,则将该最大值在所述感兴趣区域中所对应的像素点作为所述第一候选匹配点的第一目标像素点。The first processing unit is configured to, if the maximum value of the cross-correlation metric values corresponding to each pixel in the region of interest is greater than a preset threshold, then the maximum value in the region of interest corresponding to the The pixel point is used as the first target pixel point of the first candidate matching point.
可选的,所述互相关度量值为归一化互相关值;Optionally, the cross-correlation metric value is a normalized cross-correlation value;
所述计算单元具体用于:The computing unit is specifically used for:
针对所述感兴趣区域中的每一个像素点,根据指定关联区域,计算所述像素点与所述第一候选匹配点之间的归一化互相关值,其中,所述指定关联区域为所述第二模态图像中以所述像素点为中心的指定区域。For each pixel in the region of interest, the normalized cross-correlation value between the pixel and the first candidate matching point is calculated according to the specified correlation region, where the specified correlation region is the specified correlation region. a designated area centered on the pixel in the second modal image.
可选的,所述第二处理模块504具体包括:Optionally, the second processing module 504 specifically includes:
构建单元,用于根据所述匹配点对、所述第一网格区域中的指定顶点的坐标以及所述第一网格区域中的指定顶点在所述第一网格区域所对应的第二网格区域中的期望坐标,构建最小二乘模型;The construction unit is configured to, according to the matching point pair, the coordinates of the designated vertex in the first mesh area, and the second corresponding to the first mesh area of the designated vertex in the first mesh area the desired coordinates in the grid area to construct a least squares model;
求解单元,用于对所述最小二乘模型进行求解,获得所述第一网格区域中的指定顶点在所述第一网格区域所对应的第二网格区域中的期望坐标;a solving unit, configured to solve the least squares model, and obtain the desired coordinates of the specified vertex in the first grid region in the second grid region corresponding to the first grid region;
第二处理单元,用于根据所述期望坐标,以及所述第一网格区域所对应的第二网格区域中的指定顶点的坐标,获得所述第一网格区域与所述第一网格区域所对应的第二网格区域之间的单应性矩阵,并将所述单应性矩阵作为所述网格变换矩阵;The second processing unit is configured to obtain the first mesh area and the first mesh area according to the expected coordinates and the coordinates of the specified vertex in the second mesh area corresponding to the first mesh area a homography matrix between the second grid regions corresponding to the grid regions, and using the homography matrix as the grid transformation matrix;
所述变换模块505具体包括:The transformation module 505 specifically includes:
变换单元,用于针对每一个第二网格区域,根据所述第二网格区域所对应的单应性矩阵对所述第二网格区域进行透视变换;a transformation unit, configured to, for each second grid region, perform perspective transformation on the second grid region according to the homography matrix corresponding to the second grid region;
第三处理单元,用于根据各个透视变换后的第二网格区域,获得相对于所述第一模态图像对齐的目标图像。The third processing unit is configured to obtain a target image aligned relative to the first modal image according to each perspective transformed second grid area.
需要说明的是,上述装置/单元之间的信息交互、执行过程等内容,由于与本申请方法实施例基于同一构思,其具体功能及带来的技术效果,具体可参见方法实施例部分,此处不再赘述。It should be noted that the information exchange, execution process and other contents between the above-mentioned devices/units are based on the same concept as the method embodiments of the present application. For specific functions and technical effects, please refer to the method embodiments section. It is not repeated here.
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将上述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。实施例中的各功能单元、模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。另外,各功能单元、模块的具体名称也只是为了便于相互区分,并不用于限制本申请的保护范围。上述系统中单元、模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. Module completion, that is, dividing the internal structure of the above device into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment may be integrated in one processing unit, or each unit may exist physically alone, or two or more units may be integrated in one unit, and the above-mentioned integrated units may adopt hardware. It can also be realized in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing from each other, and are not used to limit the protection scope of the present application. For the specific working processes of the units and modules in the above-mentioned system, reference may be made to the corresponding processes in the foregoing method embodiments, which will not be repeated here.
图6为本申请一实施例提供的终端设备的结构示意图。如图6所示,该实施例的终端设备6包括:至少一个处理器60(图6中仅示出一个)、存储器61以及存储在上述存储器61中并可在上述至少一个处理器60上运行的计算机程序62,上述处理器60执行上述计算机程序62时实现上述任意各个图像对齐方法实施例中的步骤。FIG. 6 is a schematic structural diagram of a terminal device provided by an embodiment of the present application. As shown in FIG. 6 , the terminal device 6 in this embodiment includes: at least one processor 60 (only one is shown in FIG. 6 ), a memory 61 , and is stored in the above-mentioned memory 61 and can run on the above-mentioned at least one processor 60 The computer program 62, when the processor 60 executes the computer program 62, implements the steps in any of the above image alignment method embodiments.
上述终端设备6可以是服务器、手机、可穿戴设备、增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备、桌上型计算机、笔记本、台式电脑以及掌上电脑等计算设备。该终端设备可包括,但不仅限于,处理器60、存储器61。本领域技术人员可以理解,图6仅仅是终端设备6的举例,并不构成对终端设备6的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如还可以包括输入设备、输出设备、网络接入设备等。其中,上述输入设备可以包括键盘、触控板、指纹采集传感器(用于采集用户 的指纹信息和指纹的方向信息)、麦克风、摄像头等,输出设备可以包括显示器、扬声器等。The above-mentioned terminal device 6 may be a server, a mobile phone, a wearable device, an augmented reality (AR)/virtual reality (VR) device, a desktop computer, a notebook, a desktop computer, a handheld computer and other computing devices. The terminal device may include, but is not limited to, a processor 60 and a memory 61 . Those skilled in the art can understand that FIG. 6 is only an example of the terminal device 6, and does not constitute a limitation on the terminal device 6, and may include more or less components than the one shown, or combine some components, or different components , for example, may also include input devices, output devices, network access devices, and so on. Wherein, the above-mentioned input devices may include keyboards, touchpads, fingerprint collection sensors (for collecting user's fingerprint information and fingerprint direction information), microphones, cameras, etc., and output devices may include displays, speakers, and the like.
上述处理器60可以是中央处理单元(Central Processing Unit,CPU),该处理器60还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。The above-mentioned processor 60 can be a central processing unit (Central Processing Unit, CPU), and the processor 60 can also be other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
上述存储器61在一些实施例中可以是上述终端设备6的内部存储单元,例如终端设备6的硬盘或内存。上述存储器61在另一些实施例中也可以是上述终端设备6的外部存储设备,例如上述终端设备6上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,上述存储器61还可以既包括上述终端设备6的内部存储单元也包括外部存储设备。上述存储器61用于存储操作系统、应用程序、引导装载程序(Boot Loader)、数据以及其他程序等,例如上述计算机程序的程序代码等。上述存储器61还可以用于暂时地存储已经输出或者将要输出的数据。The above-mentioned memory 61 may be an internal storage unit of the above-mentioned terminal device 6 in some embodiments, such as a hard disk or a memory of the terminal device 6 . The above-mentioned memory 61 may also be an external storage device of the above-mentioned terminal device 6 in other embodiments, such as a plug-in hard disk equipped on the above-mentioned terminal device 6, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital) , SD) card, flash memory card (Flash Card), etc. Further, the above-mentioned memory 61 may also include both the internal storage unit of the above-mentioned terminal device 6 and an external storage device. The above-mentioned memory 61 is used to store an operating system, an application program, a boot loader (Boot Loader), data, and other programs, for example, program codes of the above-mentioned computer programs, and the like. The above-mentioned memory 61 can also be used to temporarily store data that has been output or is to be output.
另外,尽管未示出,上述终端设备6还可以包括网络连接模块,如蓝牙模块Wi-Fi模块、蜂窝网络模块等等,在此不再赘述。In addition, although not shown, the above-mentioned terminal device 6 may also include a network connection module, such as a Bluetooth module, a Wi-Fi module, a cellular network module, etc., which will not be repeated here.
本申请实施例中,上述处理器60执行上述计算机程序62以实现上述任意各个图像对齐方法实施例中的步骤时,针对第一模态图像中预先划分得到的每一个第一网格区域,确定所述第一网格区域中的至少两个第一候选匹配点;然后,针对所述第一网格区域中的每一个第一候选匹配点,从第二模态图像中查找所述第一候选匹配点所对应的第一目标像素点,其中,所述第一目标像素点与对应的所述第一候选匹配点之间的互相关信息符合预设互相关条件。此时,可以通过互相关信息来度量像素点之间的相似性,从而查找与所述第一候选匹配点所对应的第一目标像素点。In this embodiment of the present application, when the processor 60 executes the computer program 62 to implement the steps in any of the above image alignment method embodiments, for each first grid area pre-divided in the first modal image, determine at least two first candidate matching points in the first grid area; then, for each first candidate matching point in the first grid area, searching for the first candidate matching point from the second modal image The first target pixel point corresponding to the candidate matching point, wherein the cross-correlation information between the first target pixel point and the corresponding first candidate matching point meets a preset cross-correlation condition. At this time, the similarity between the pixel points can be measured by the cross-correlation information, so as to find the first target pixel point corresponding to the first candidate matching point.
若从所述第二模态图像中查找到所述第一候选匹配点所对应的第一目标像素点,则将所述第一候选匹配点和所述第一候选匹配点所对应的第一目标像素点作为所述第一模态图像与所述第二模态图像之间的一组匹配点对;此时,可以针对每一个第一网格区域,通过像素点之间的互相关信息获取到该第一网格区域与所述第一网格区域在所述第二模态图像中所对应的第二网格区域之间的匹配点对,从而根据所述匹配点对,获得所述第一网格区域与所述第一网格区域在所述第二模态图像中所对应的第二网格区域之间的网格变换矩阵,然后,可以根据各个网格变换矩阵,将所述第二模态图像变换为相对于所述第一模态图像对齐的目标图像,从而实现了不同模态的图像之间的图像对齐。其中,由于所述图像对齐所需的匹配点对是基于像素点之间的互相关信息确定得到,能够减小不同模态的图像在结构相似区域的梯度方向上的差异所带来的干扰,因此,匹配点对的准确性较高,相应地也保证了最终得到的目标图像的对齐精度,避免了现有的基于SIFT等方法的特征点检测和匹配无法在不同模态的图像之间找到准确的匹配点对,从而使得不同模态的图像之间的图像对齐精度较差的问题。If the first target pixel point corresponding to the first candidate matching point is found from the second modal image, the first candidate matching point and the first matching point corresponding to the first candidate matching point The target pixel is used as a set of matching point pairs between the first modal image and the second modal image; at this time, for each first grid area, the cross-correlation information between the pixels can be used The matching point pair between the first grid area and the second grid area corresponding to the first grid area in the second modal image is obtained, so as to obtain the matching point pair according to the matching point pair. The grid transformation matrix between the first grid region and the second grid region corresponding to the first grid region in the second modal image, and then, according to each grid transformation matrix, the The second modality image is transformed into a target image aligned relative to the first modality image, thereby realizing image alignment between images of different modality. Wherein, since the matching point pairs required for the image alignment are determined based on the cross-correlation information between the pixels, the interference caused by the difference in the gradient directions of the images of different modalities in the structurally similar regions can be reduced, Therefore, the accuracy of matching point pairs is high, and accordingly, the alignment accuracy of the final target image is also guaranteed, and the existing feature point detection and matching based on SIFT and other methods cannot be found between images of different modalities. Accurately match point pairs, which leads to the problem of poor image alignment accuracy between images of different modalities.
本申请实施例还提供了一种计算机可读存储介质,上述计算机可读存储介质存储有计算机程序,上述计算机程序被处理器执行时实现可实现上述各个方法实施例中的步骤。Embodiments of the present application further provide a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the foregoing method embodiments can be implemented.
本申请实施例提供了一种计算机程序产品,当计算机程序产品在终端设备上运行时,使得终端设备执行时实现可实现上述各个方法实施例中的步骤。The embodiments of the present application provide a computer program product, when the computer program product runs on a terminal device, so that the terminal device can implement the steps in the foregoing method embodiments when executed.
上述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,可以通过计算机程序来指令相关的硬件来完成,上述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,上述计算机程序包括计算机程序代码,上述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。上述计算机可读介质至少可以包括:能 够将计算机程序代码携带到拍照装置/终端设备的任何实体或装置、记录介质、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号、电信信号以及软件分发介质。例如U盘、移动硬盘、磁碟或者光盘等。在某些司法管辖区,根据立法和专利实践,计算机可读介质不可以是电载波信号和电信信号。If the above-mentioned integrated units are implemented in the form of software functional units and sold or used as independent products, they may be stored in a computer-readable storage medium. Based on this understanding, the present application realizes all or part of the processes in the methods of the above-mentioned embodiments, which can be completed by instructing the relevant hardware through a computer program. The above-mentioned computer program can be stored in a computer-readable storage medium, and the computer program is in When executed by the processor, the steps of the foregoing method embodiments can be implemented. Wherein, the above-mentioned computer program includes computer program code, and the above-mentioned computer program code may be in the form of source code, object code form, executable file or some intermediate form. The above-mentioned computer-readable medium may include at least: any entity or device capable of carrying the computer program code to the photographing device/terminal device, a recording medium, a computer memory, a read-only memory (ROM, Read-Only Memory), a random access memory ( RAM, Random Access Memory), electrical carrier signals, telecommunication signals, and software distribution media. For example, U disk, mobile hard disk, disk or CD, etc. In some jurisdictions, under legislation and patent practice, computer readable media may not be electrical carrier signals and telecommunications signals.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。In the foregoing embodiments, the description of each embodiment has its own emphasis. For parts that are not described or described in detail in a certain embodiment, reference may be made to the relevant descriptions of other embodiments.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each particular application, but such implementations should not be considered beyond the scope of this application.
在本申请所提供的实施例中,应该理解到,所揭露的装置/网络设备和方法,可以通过其它的方式实现。例如,以上所描述的装置/网络设备实施例仅仅是示意性的,例如,上述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通讯连接可以是通过一些接口,装置或单元的间接耦合或通讯连接,可以是电性,机械或其它的形式。In the embodiments provided in this application, it should be understood that the disclosed apparatus/network device and method may be implemented in other manners. For example, the apparatus/network device embodiments described above are only illustrative. For example, the division of the above modules or units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or Components may be combined or may be integrated into another system, or some features may be omitted, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.
上述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described above as separate components may or may not be physically separated, and components shown as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
以上上述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。The above-mentioned embodiments are only used to illustrate the technical solutions of the present application, but not to limit them; although the present application has been described in detail with reference to the above-mentioned embodiments, those of ordinary skill in the art should understand that the above-mentioned embodiments can still be used for The recorded technical solutions are modified, or some technical features thereof are equivalently replaced; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the application, and should be included in the present application. within the scope of protection of the application.

Claims (20)

  1. 一种图像对齐方法,其特征在于,包括:An image alignment method, comprising:
    针对第一模态图像中预先划分得到的每一个第一网格区域,确定所述第一网格区域中的至少两个第一候选匹配点;For each first grid area pre-divided in the first modal image, determining at least two first candidate matching points in the first grid area;
    针对所述第一网格区域中的每一个第一候选匹配点,从第二模态图像中查找所述第一候选匹配点所对应的第一目标像素点,其中,所述第一目标像素点与对应的所述第一候选匹配点之间的互相关信息符合预设互相关条件;For each first candidate matching point in the first grid area, the first target pixel corresponding to the first candidate matching point is searched from the second modal image, wherein the first target pixel The cross-correlation information between the point and the corresponding first candidate matching point meets a preset cross-correlation condition;
    若从所述第二模态图像中查找到所述第一候选匹配点所对应的第一目标像素点,则将所述第一候选匹配点和所述第一候选匹配点所对应的第一目标像素点作为所述第一模态图像与所述第二模态图像之间的一组匹配点对;If the first target pixel point corresponding to the first candidate matching point is found from the second modal image, the first candidate matching point and the first matching point corresponding to the first candidate matching point The target pixel is used as a set of matching point pairs between the first modal image and the second modal image;
    根据所述匹配点对,获得所述第一网格区域与所述第一网格区域在所述第二模态图像中所对应的第二网格区域之间的网格变换矩阵,其中,所述第一网格区域在所述第一模态图像中的位置与所述第一网格区域所对应的第二网格区域在所述第二模态图像中的位置相同;According to the matching point pair, a grid transformation matrix between the first grid area and the second grid area corresponding to the first grid area in the second modal image is obtained, wherein, The position of the first grid area in the first modal image is the same as the position of the second grid area corresponding to the first grid area in the second modal image;
    根据各个网格变换矩阵,将所述第二模态图像变换为相对于所述第一模态图像对齐的目标图像。Transforming the second modality image into a target image aligned relative to the first modality image according to the respective grid transformation matrices.
  2. 如权利要求1所述的图像对齐方法,其特征在于,所述针对第一模态图像中预先划分得到的每一个第一网格区域,确定所述第一网格区域中的至少两个第一候选匹配点,包括:The image alignment method according to claim 1, wherein, for each first grid area pre-divided in the first modal image, at least two first grid areas in the first grid area are determined. A candidate matching point, including:
    针对第一模态图像中预先划分得到的每一个第一网格区域,根据所述第一网格区域的像素点梯度信息,确定所述第一网格区域中的至少两个第一候选匹配点。For each first grid area pre-divided in the first modal image, determine at least two first candidate matches in the first grid area according to the pixel point gradient information of the first grid area point.
  3. 如权利要求2所述的图像对齐方法,其特征在于,所述针对第一模态图像中预先划分得到的每一个第一网格区域,根据所述第一网格区域的像素点梯度信息,确定所述第一网格区域中的至少两个第一候选匹配点,包括:The image alignment method according to claim 2, wherein, for each first grid area pre-divided in the first modal image, according to the pixel point gradient information of the first grid area, Determining at least two first candidate matching points in the first grid area includes:
    针对第一模态图像中预先划分得到的每一个第一网格区域,根据所述第一网格区域中每个第一像素点的第一梯度值,以及所述第一网格区域所对应的第二网格区域中每个第二像素点的第二梯度值,确定所述第一网格区域与所述第一网格区域所对应的第二网格区域之间的对齐误差;For each first grid area pre-divided in the first modal image, according to the first gradient value of each first pixel point in the first grid area and the corresponding value of the first grid area The second gradient value of each second pixel point in the second grid area, to determine the alignment error between the first grid area and the second grid area corresponding to the first grid area;
    根据所述对齐误差,确定所述第一网格区域中的第一候选匹配点的个数;determining the number of the first candidate matching points in the first grid area according to the alignment error;
    根据所述第一候选匹配点的个数,确定所述第一网格区域中的第一候选匹配点。A first candidate matching point in the first grid area is determined according to the number of the first candidate matching points.
  4. 如权利要求3所述的图像对齐方法,其特征在于,所述针对第一模态图像中预先划分得到的每一个第一网格区域,根据所述第一网格区域中每个第一像素点的第一梯度值,以及所述第一网格区域所对应的第二网格区域中每个第二像素点的第二梯度值,确定所述第一网格区域与所述第一网格区域所对应的第二网格区域之间的对齐误差,包括:The image alignment method according to claim 3, wherein, for each first grid area pre-divided in the first modal image, according to each first pixel in the first grid area The first gradient value of the point, and the second gradient value of each second pixel point in the second grid area corresponding to the first grid area, determine the relationship between the first grid area and the first grid area. The alignment error between the second grid area corresponding to the grid area, including:
    针对所述第一网格区域中的每一个第一像素点,将所述第一像素点的第一梯度值与所述第一像素点所对应的第二像素点的第二梯度值之间的差值的绝对值作为第一绝对值,其中,所述第一像素点在所述第一模态图像中的位置与所述第一像素点所对应的第二像素点在所述第二模态图像中的位置相同;For each first pixel point in the first grid area, a first gradient value of the first pixel point and the second gradient value of the second pixel point corresponding to the first pixel point are set between The absolute value of the difference is taken as the first absolute value, wherein the position of the first pixel in the first modal image and the second pixel corresponding to the first pixel are in the second The position in the modal image is the same;
    将所述第一网格区域中的各个第一梯度值的绝对值的和作为第一求和结果,并将所述第一网格区域所对应的第二网格区域中的各个第二梯度值的绝对值的和作为第二求和结果;Taking the sum of the absolute values of the first gradient values in the first grid area as the first summation result, and using the second gradient values in the second grid area corresponding to the first grid area The sum of the absolute values of the values is used as the second summation result;
    根据所述第一网格区域中的各个第一绝对值、所述第一求和结果和所述第二求和结果,确定所述第一网格区域与所述第一网格区域所对应的第二网格区域之间的对齐误差。According to each first absolute value in the first grid area, the first summation result and the second summation result, it is determined that the first grid area corresponds to the first grid area The alignment error between the second grid regions.
  5. 如权利要求1所述的图像对齐方法,其特征在于,在针对第一模态图像中预先划分得到的每一个第一网格区域,确定所述第一网格区域中的至少两个第一候选匹配点之前,还包括:The image alignment method according to claim 1, wherein, for each first grid area pre-divided in the first modal image, at least two first grid areas in the first grid area are determined. Before candidate matching points, also include:
    获取通过第一摄像头拍摄得到的第一原始图像和通过第二摄像头拍摄得到的第二原始图像;acquiring a first original image captured by the first camera and a second original image captured by the second camera;
    根据预先标定的第一摄像头的第一摄像头参数和第二摄像头的第二摄像头参数,分别对所述第一原始图像和第二原始图像进行校正;Correcting the first original image and the second original image respectively according to the pre-calibrated first camera parameters of the first camera and the second camera parameters of the second camera;
    将校正后的第一原始图像作为所述第一模态图像,并将校正后的第二原始图像作为第二模态图像,其中,所述第一模态图像和所述第二模态图像共面行对准。Taking the corrected first original image as the first modal image, and taking the corrected second original image as the second modal image, wherein the first modal image and the second modal image Coplanar row alignment.
  6. 如权利要求1所述的图像对齐方法,其特征在于,在根据各组匹配点对,获得所述第一网格区域与所述第一网格区域在所述第二模态图像中所对应的第二网格区域之间的网格变换矩阵之前,还包括:The image alignment method according to claim 1, wherein, according to each set of matching point pairs, the corresponding first grid area and the first grid area in the second modal image are obtained. Before the grid transformation matrix between the second grid regions, also include:
    针对所述第二模态图像中预先划分得到的每一个第二网格区域,根据所述第二网格区域的梯度信息,确定所述第二网格区域中的至少两个第二候选匹配点;For each second grid area pre-divided in the second modal image, determine at least two second candidate matches in the second grid area according to the gradient information of the second grid area point;
    针对所述第二网格区域中的每一个第二候选匹配点,从第一模态图像中查找所述第二候选匹配点所对应的第二目标像素点,其中,所述第二目标像素点与对应的所述第二候选匹配点之间的互相关信息符合预设互相关条件;For each second candidate matching point in the second grid area, a second target pixel corresponding to the second candidate matching point is searched from the first modal image, wherein the second target pixel The cross-correlation information between the point and the corresponding second candidate matching point meets a preset cross-correlation condition;
    若从所述第一模态图像中查找到所述第二候选匹配点所对应的第二目标像素点,则将所述第二候选匹配点和所述第二候选匹配点所对应的第二目标像素点作为所述第一模态图像与所述第二模态图像之间的一组匹配点对。If the second target pixel point corresponding to the second candidate matching point is found from the first modal image, the second candidate matching point and the second matching point corresponding to the second candidate matching point The target pixel points are used as a set of matching point pairs between the first modal image and the second modal image.
  7. 如权利要求1所述的图像对齐方法,其特征在于,所述针对所述第一网格区域中的每一个第一候选匹配点,从第二模态图像中查找所述第一候选匹配点所对应的第一目标像素点,包括:The image alignment method according to claim 1, wherein, for each first candidate matching point in the first grid area, the first candidate matching point is searched from the second modal image The corresponding first target pixel, including:
    针对所述第一网格区域中的每一个第一候选匹配点,从第二模态图像中确定所述第一候选匹配点所对应的感兴趣区域;For each first candidate matching point in the first grid area, determining a region of interest corresponding to the first candidate matching point from the second modal image;
    针对所述感兴趣区域中的每一个像素点,计算所述像素点与所述第一候选匹配点之间的互相关度量值;For each pixel in the region of interest, calculating a cross-correlation metric value between the pixel and the first candidate matching point;
    若所述感兴趣区域所中的各个像素点所对应的互相关度量值中的最大值大于预设阈值,则将该最大值在所述感兴趣区域中所对应的像素点作为所述第一候选匹配点的第一目标像素点。If the maximum value of the cross-correlation metric values corresponding to each pixel in the region of interest is greater than a preset threshold, the pixel corresponding to the maximum value in the region of interest is taken as the first The first target pixel of the candidate matching point.
  8. 如权利要求7所述的图像对齐方法,其特征在于,所述互相关度量值为归一化互相关值;The image alignment method according to claim 7, wherein the cross-correlation metric value is a normalized cross-correlation value;
    所述针对所述感兴趣区域中的每一个像素点,计算所述像素点与所述第一候选匹配点之间的互相关度量值,包括:The calculating, for each pixel point in the region of interest, a cross-correlation metric value between the pixel point and the first candidate matching point, including:
    针对所述感兴趣区域中的每一个像素点,根据指定关联区域,计算所述像素点与所述第一候选匹配点之间的归一化互相关值,其中,所述指定关联区域为所述第二模态图像中以所述像素点为中心的指定区域。For each pixel in the region of interest, the normalized cross-correlation value between the pixel and the first candidate matching point is calculated according to the specified correlation region, where the specified correlation region is the specified correlation region. a designated area centered on the pixel in the second modal image.
  9. 如权利要求1至8任意一项所述的图像对齐方法,其特征在于,根据所述匹配点对,获得所述第一网格区域与所述第一网格区域在所述第二模态图像中所对应的第二网格区域之间的网格变换矩阵,包括:The image alignment method according to any one of claims 1 to 8, wherein, according to the matching point pair, the first grid area and the first grid area in the second mode are obtained The grid transformation matrix between the corresponding second grid areas in the image, including:
    根据所述匹配点对、所述第一网格区域中的指定顶点的坐标以及所述第一网格区域中的指定顶点在所述第一网格区域所对应的第二网格区域中的期望坐标,构建最小二乘模型;According to the matching point pair, the coordinates of the designated vertex in the first mesh area, and the coordinate of the designated vertex in the first mesh area in the second mesh area corresponding to the first mesh area Expected coordinates, build a least squares model;
    对所述最小二乘模型进行求解,获得所述第一网格区域中的指定顶点在所述第一网格区域所对应的第二网格区域中的期望坐标;Solving the least squares model to obtain the desired coordinates of the specified vertex in the first grid region in the second grid region corresponding to the first grid region;
    根据所述期望坐标,以及所述第一网格区域所对应的第二网格区域中的指定顶点的坐标,获得所述第一网格区域与所述第一网格区域所对应的第二网格区域之间的单应性矩阵,并将所述单应性矩阵作为所述网格变换矩阵;According to the expected coordinates and the coordinates of the specified vertex in the second mesh area corresponding to the first mesh area, obtain the second mesh area corresponding to the first mesh area and the first mesh area a homography matrix between grid regions, and using the homography matrix as the grid transformation matrix;
    所述根据各个网格变换矩阵,将所述第二模态图像变换为相对于所述第一模态图像对齐的目标图像,包括:The transforming the second modal image into a target image aligned relative to the first modal image according to each grid transformation matrix includes:
    针对每一个第二网格区域,根据所述第二网格区域所对应的单应性矩阵对所述第二网格区域进行透视变换;For each second grid region, perform perspective transformation on the second grid region according to the homography matrix corresponding to the second grid region;
    根据各个透视变换后的第二网格区域,获得相对于所述第一模态图像对齐的目标图像。A target image aligned with respect to the first modality image is obtained according to each perspective transformed second grid area.
  10. 一种图像对齐装置,其特征在于,包括:An image alignment device, comprising:
    确定模块,用于针对第一模态图像中预先划分得到的每一个第一网格区域,确定所述第一网格区域中的至少两个第一候选匹配点;a determining module, configured to determine at least two first candidate matching points in the first grid area for each first grid area pre-divided in the first modal image;
    查找模块,用于针对所述第一网格区域中的每一个第一候选匹配点,从第二模态图像中查找所述第一候选匹配点所对应的第一目标像素点,其中,所述第一目标像素点与对应的所述第一候选匹配点之间的互相关信息符合预设互相关条件;A search module is configured to search, for each first candidate matching point in the first grid area, the first target pixel point corresponding to the first candidate matching point from the second modal image, wherein the The cross-correlation information between the first target pixel point and the corresponding first candidate matching point meets a preset cross-correlation condition;
    第一处理模块,用于若从所述第二模态图像中查找到所述第一候选匹配点所对应的第一目标像素点,则将所述第一候选匹配点和所述第一候选匹配点所对应的第一目标像素点作为所述第一模态图像与所述第二模态图像之间的一组匹配点对;The first processing module is configured to, if the first target pixel corresponding to the first candidate matching point is found from the second modal image, compare the first candidate matching point with the first candidate matching point The first target pixel point corresponding to the matching point is used as a set of matching point pairs between the first modal image and the second modal image;
    第二处理模块,用于根据所述匹配点对,获得所述第一网格区域与所述第一网格区域在所述第二模态图像中所对应的第二网格区域之间的网格变换矩阵,其中,所述第一网格区域在所述第一模态图像中的位置与所述第一网格区域所对应的第二网格区域在所述第二模态图像中的位置相同;a second processing module, configured to obtain, according to the matching point pair, the difference between the first grid area and the second grid area corresponding to the first grid area in the second modal image A grid transformation matrix, wherein the position of the first grid area in the first modal image and the second grid area corresponding to the first grid area are in the second modal image the same location;
    变换模块,用于根据各个网格变换矩阵,将所述第二模态图像变换为相对于所述第一模态图像对齐的目标图像。A transformation module, configured to transform the second modal image into a target image aligned with respect to the first modal image according to each grid transformation matrix.
  11. 一种终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现下述步骤:A terminal device, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor implements the following steps when executing the computer program:
    针对第一模态图像中预先划分得到的每一个第一网格区域,确定所述第一网格区域中的至少两个第一候选匹配点;For each first grid area pre-divided in the first modal image, determining at least two first candidate matching points in the first grid area;
    针对所述第一网格区域中的每一个第一候选匹配点,从第二模态图像中查找所述第一候选匹配点所对应的第一目标像素点,其中,所述第一目标像素点与对应的所述第一候选匹配点之间的互相关信息符合预设互相关条件;For each first candidate matching point in the first grid area, the first target pixel corresponding to the first candidate matching point is searched from the second modal image, wherein the first target pixel The cross-correlation information between the point and the corresponding first candidate matching point meets a preset cross-correlation condition;
    若从所述第二模态图像中查找到所述第一候选匹配点所对应的第一目标像素点,则将所述第一候选匹配点和所述第一候选匹配点所对应的第一目标像素点作为所述第一模态图像与所述第二模态图像之间的一组匹配点对;If the first target pixel point corresponding to the first candidate matching point is found from the second modal image, the first candidate matching point and the first matching point corresponding to the first candidate matching point The target pixel is used as a set of matching point pairs between the first modal image and the second modal image;
    根据所述匹配点对,获得所述第一网格区域与所述第一网格区域在所述第二模态图像中所对应的第二网格区域之间的网格变换矩阵,其中,所述第一网格区域在所述第一模态图像中的位置与所述第一网格区域所对应的第二网格区域在所述第二模态图像中的位置相同;According to the matching point pair, a grid transformation matrix between the first grid area and the second grid area corresponding to the first grid area in the second modal image is obtained, wherein, The position of the first grid area in the first modal image is the same as the position of the second grid area corresponding to the first grid area in the second modal image;
    根据各个网格变换矩阵,将所述第二模态图像变换为相对于所述第一模态图像对齐的目标图像。Transforming the second modality image into a target image aligned relative to the first modality image according to the respective grid transformation matrices.
  12. 如权利要求11所述的终端设备,其特征在于,所述计算机程序被处理器执行时,还实现如下步骤:The terminal device according to claim 11, wherein when the computer program is executed by the processor, the following steps are further implemented:
    针对第一模态图像中预先划分得到的每一个第一网格区域,根据所述第一网格区域的像素点梯度信息,确定所述第一网格区域中的至少两个第一候选匹配点。For each first grid area pre-divided in the first modal image, determine at least two first candidate matches in the first grid area according to the pixel point gradient information of the first grid area point.
  13. 如权利要求12所述的终端设备,其特征在于,所述计算机程序被处理器执行时,还实现如下步骤:The terminal device according to claim 12, wherein when the computer program is executed by the processor, the following steps are further implemented:
    针对第一模态图像中预先划分得到的每一个第一网格区域,根据所述第一网格区域中每个第一像素点的第一梯度值,以及所述第一网格区域所对应的第二网格区域中每个第二像素点的第二梯度值,确定所述第一网格区域与所述第一网格区域所对应的第二网格区域之间的对齐误差;For each first grid area pre-divided in the first modal image, according to the first gradient value of each first pixel point in the first grid area and the corresponding value of the first grid area The second gradient value of each second pixel point in the second grid area, to determine the alignment error between the first grid area and the second grid area corresponding to the first grid area;
    根据所述对齐误差,确定所述第一网格区域中的第一候选匹配点的个数;determining the number of the first candidate matching points in the first grid area according to the alignment error;
    根据所述第一候选匹配点的个数,确定所述第一网格区域中的第一候选匹配点。A first candidate matching point in the first grid area is determined according to the number of the first candidate matching points.
  14. 如权利要求13所述的终端设备,其特征在于,所述计算机程序被处理器执行时,还实现如下步骤:The terminal device according to claim 13, wherein when the computer program is executed by the processor, the following steps are further implemented:
    针对所述第一网格区域中的每一个第一像素点,将所述第一像素点的第一梯度值与所 述第一像素点所对应的第二像素点的第二梯度值之间的差值的绝对值作为第一绝对值,其中,所述第一像素点在所述第一模态图像中的位置与所述第一像素点所对应的第二像素点在所述第二模态图像中的位置相同;For each first pixel point in the first grid area, a first gradient value of the first pixel point and the second gradient value of the second pixel point corresponding to the first pixel point are divided between The absolute value of the difference is taken as the first absolute value, wherein the position of the first pixel in the first modal image and the second pixel corresponding to the first pixel are in the second The position in the modal image is the same;
    将所述第一网格区域中的各个第一梯度值的绝对值的和作为第一求和结果,并将所述第一网格区域所对应的第二网格区域中的各个第二梯度值的绝对值的和作为第二求和结果;Taking the sum of the absolute values of the first gradient values in the first grid area as the first summation result, and using the second gradient values in the second grid area corresponding to the first grid area The sum of the absolute values of the values is used as the second summation result;
    根据所述第一网格区域中的各个第一绝对值、所述第一求和结果和所述第二求和结果,确定所述第一网格区域与所述第一网格区域所对应的第二网格区域之间的对齐误差。According to each first absolute value in the first grid area, the first summation result and the second summation result, it is determined that the first grid area corresponds to the first grid area The alignment error between the second grid regions.
  15. 如权利要求11所述的终端设备,其特征在于,所述计算机程序被处理器执行时,还实现如下步骤:The terminal device according to claim 11, wherein when the computer program is executed by the processor, the following steps are further implemented:
    获取通过第一摄像头拍摄得到的第一原始图像和通过第二摄像头拍摄得到的第二原始图像;acquiring a first original image captured by the first camera and a second original image captured by the second camera;
    根据预先标定的第一摄像头的第一摄像头参数和第二摄像头的第二摄像头参数,分别对所述第一原始图像和第二原始图像进行校正;Correcting the first original image and the second original image respectively according to the pre-calibrated first camera parameters of the first camera and the second camera parameters of the second camera;
    将校正后的第一原始图像作为所述第一模态图像,并将校正后的第二原始图像作为第二模态图像,其中,所述第一模态图像和所述第二模态图像共面行对准。Taking the corrected first original image as the first modal image, and taking the corrected second original image as the second modal image, wherein the first modal image and the second modal image Coplanar row alignment.
  16. 如权利要求11所述的终端设备,其特征在于,所述计算机程序被处理器执行时,还实现如下步骤:The terminal device according to claim 11, wherein when the computer program is executed by the processor, the following steps are further implemented:
    针对所述第二模态图像中预先划分得到的每一个第二网格区域,根据所述第二网格区域的梯度信息,确定所述第二网格区域中的至少两个第二候选匹配点;For each second grid area pre-divided in the second modal image, at least two second candidate matches in the second grid area are determined according to gradient information of the second grid area point;
    针对所述第二网格区域中的每一个第二候选匹配点,从第一模态图像中查找所述第二候选匹配点所对应的第二目标像素点,其中,所述第二目标像素点与对应的所述第二候选匹配点之间的互相关信息符合预设互相关条件;For each second candidate matching point in the second grid area, a second target pixel corresponding to the second candidate matching point is searched from the first modal image, wherein the second target pixel The cross-correlation information between the point and the corresponding second candidate matching point meets a preset cross-correlation condition;
    若从所述第一模态图像中查找到所述第二候选匹配点所对应的第二目标像素点,则将所述第二候选匹配点和所述第二候选匹配点所对应的第二目标像素点作为所述第一模态图像与所述第二模态图像之间的一组匹配点对。If the second target pixel point corresponding to the second candidate matching point is found from the first modal image, the second candidate matching point and the second matching point corresponding to the second candidate matching point The target pixel points are used as a set of matching point pairs between the first modal image and the second modal image.
  17. 如权利要求11所述的终端设备,其特征在于,所述计算机程序被处理器执行时,还实现如下步骤:The terminal device according to claim 11, wherein when the computer program is executed by the processor, the following steps are further implemented:
    针对所述第一网格区域中的每一个第一候选匹配点,从第二模态图像中确定所述第一候选匹配点所对应的感兴趣区域;For each first candidate matching point in the first grid area, determining a region of interest corresponding to the first candidate matching point from the second modal image;
    针对所述感兴趣区域中的每一个像素点,计算所述像素点与所述第一候选匹配点之间的互相关度量值;For each pixel in the region of interest, calculating a cross-correlation metric value between the pixel and the first candidate matching point;
    若所述感兴趣区域所中的各个像素点所对应的互相关度量值中的最大值大于预设阈值,则将该最大值在所述感兴趣区域中所对应的像素点作为所述第一候选匹配点的第一目标像素点。If the maximum value of the cross-correlation metric values corresponding to each pixel in the region of interest is greater than a preset threshold, the pixel corresponding to the maximum value in the region of interest is taken as the first The first target pixel of the candidate matching point.
  18. 如权利要求17所述的终端设备,其特征在于,所述互相关度量值为归一化互相关值;The terminal device according to claim 17, wherein the cross-correlation metric value is a normalized cross-correlation value;
    所述计算机程序被处理器执行时,还实现如下步骤:When the computer program is executed by the processor, the following steps are also implemented:
    针对所述感兴趣区域中的每一个像素点,根据指定关联区域,计算所述像素点与所述第一候选匹配点之间的归一化互相关值,其中,所述指定关联区域为所述第二模态图像中以所述像素点为中心的指定区域。For each pixel in the region of interest, the normalized cross-correlation value between the pixel and the first candidate matching point is calculated according to the specified correlation region, where the specified correlation region is the specified correlation region. a designated area centered on the pixel in the second modal image.
  19. 如权利要求11所述的终端设备,其特征在于,所述计算机程序被处理器执行时,还实现如下步骤:The terminal device according to claim 11, wherein when the computer program is executed by the processor, the following steps are further implemented:
    根据所述匹配点对、所述第一网格区域中的指定顶点的坐标以及所述第一网格区域中的指定顶点在所述第一网格区域所对应的第二网格区域中的期望坐标,构建最小二乘模型;According to the matching point pair, the coordinates of the designated vertex in the first mesh area, and the coordinate of the designated vertex in the first mesh area in the second mesh area corresponding to the first mesh area Expected coordinates, build a least squares model;
    对所述最小二乘模型进行求解,获得所述第一网格区域中的指定顶点在所述第一网格区域所对应的第二网格区域中的期望坐标;Solving the least squares model to obtain the desired coordinates of the specified vertex in the first grid region in the second grid region corresponding to the first grid region;
    根据所述期望坐标,以及所述第一网格区域所对应的第二网格区域中的指定顶点的坐标,获得所述第一网格区域与所述第一网格区域所对应的第二网格区域之间的单应性矩阵,并将所述单应性矩阵作为所述网格变换矩阵;According to the expected coordinates and the coordinates of the specified vertex in the second mesh area corresponding to the first mesh area, obtain the second mesh area corresponding to the first mesh area and the first mesh area a homography matrix between grid regions, and using the homography matrix as the grid transformation matrix;
    所述根据各个网格变换矩阵,将所述第二模态图像变换为相对于所述第一模态图像对齐的目标图像,包括:The transforming the second modal image into a target image aligned relative to the first modal image according to each grid transformation matrix includes:
    针对每一个第二网格区域,根据所述第二网格区域所对应的单应性矩阵对所述第二网格区域进行透视变换;For each second grid region, perform perspective transformation on the second grid region according to the homography matrix corresponding to the second grid region;
    根据各个透视变换后的第二网格区域,获得相对于所述第一模态图像对齐的目标图像。A target image aligned with respect to the first modality image is obtained according to each perspective-transformed second grid area.
  20. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至9任一项所述的图像对齐方法。A computer-readable storage medium storing a computer program, characterized in that, when the computer program is executed by a processor, the image alignment method according to any one of claims 1 to 9 is implemented.
PCT/CN2021/117471 2020-11-09 2021-09-09 Image alignment method, image alignment apparatus and terminal device WO2022095596A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011237926.4 2020-11-09
CN202011237926.4A CN112348863B (en) 2020-11-09 2020-11-09 Image alignment method, image alignment device and terminal equipment

Publications (1)

Publication Number Publication Date
WO2022095596A1 true WO2022095596A1 (en) 2022-05-12

Family

ID=74429333

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/117471 WO2022095596A1 (en) 2020-11-09 2021-09-09 Image alignment method, image alignment apparatus and terminal device

Country Status (2)

Country Link
CN (1) CN112348863B (en)
WO (1) WO2022095596A1 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116625385A (en) * 2023-07-25 2023-08-22 高德软件有限公司 Road network matching method, high-precision map construction method, device and equipment
CN117173439A (en) * 2023-11-01 2023-12-05 腾讯科技(深圳)有限公司 Image processing method and device based on GPU, storage medium and electronic equipment
CN117745537A (en) * 2024-02-21 2024-03-22 微牌科技(浙江)有限公司 Tunnel equipment temperature detection method, device, computer equipment and storage medium
CN117745537B (en) * 2024-02-21 2024-05-17 微牌科技(浙江)有限公司 Tunnel equipment temperature detection method, device, computer equipment and storage medium

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112348863B (en) * 2020-11-09 2022-06-21 Oppo广东移动通信有限公司 Image alignment method, image alignment device and terminal equipment
CN113538606B (en) * 2021-08-17 2022-07-22 数坤(北京)网络科技股份有限公司 Image association method and device, computer-readable storage medium and electronic equipment
US20230075297A1 (en) * 2021-09-03 2023-03-09 Kla Corporation Wafer alignment improvement through image projection-based patch-to-design alignment
CN114491131B (en) * 2022-01-24 2023-04-18 北京至简墨奇科技有限公司 Method and device for reordering candidate images and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103325085A (en) * 2012-03-02 2013-09-25 索尼公司 Automatic image alignment
CN103679714A (en) * 2013-12-04 2014-03-26 中国资源卫星应用中心 Method for automatic registration of optical image and SAR image based on gradient cross-correlation
CN108154526A (en) * 2016-12-06 2018-06-12 奥多比公司 The image alignment of burst mode image
US10055898B1 (en) * 2017-02-22 2018-08-21 Adobe Systems Incorporated Multi-video registration for video synthesis
CN112348863A (en) * 2020-11-09 2021-02-09 Oppo广东移动通信有限公司 Image alignment method, image alignment device and terminal equipment

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH09274659A (en) * 1996-04-08 1997-10-21 Kobe Steel Ltd Image aligning method
CN101911119B (en) * 2008-01-18 2015-02-25 皇家飞利浦电子股份有限公司 Image registration alignment metric
CN103065323B (en) * 2013-01-14 2015-07-15 北京理工大学 Subsection space aligning method based on homography transformational matrix
US9245201B1 (en) * 2013-03-15 2016-01-26 Excelis Inc. Method and system for automatic registration of images

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103325085A (en) * 2012-03-02 2013-09-25 索尼公司 Automatic image alignment
CN103679714A (en) * 2013-12-04 2014-03-26 中国资源卫星应用中心 Method for automatic registration of optical image and SAR image based on gradient cross-correlation
CN108154526A (en) * 2016-12-06 2018-06-12 奥多比公司 The image alignment of burst mode image
US10055898B1 (en) * 2017-02-22 2018-08-21 Adobe Systems Incorporated Multi-video registration for video synthesis
CN112348863A (en) * 2020-11-09 2021-02-09 Oppo广东移动通信有限公司 Image alignment method, image alignment device and terminal equipment

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116625385A (en) * 2023-07-25 2023-08-22 高德软件有限公司 Road network matching method, high-precision map construction method, device and equipment
CN116625385B (en) * 2023-07-25 2024-01-26 高德软件有限公司 Road network matching method, high-precision map construction method, device and equipment
CN117173439A (en) * 2023-11-01 2023-12-05 腾讯科技(深圳)有限公司 Image processing method and device based on GPU, storage medium and electronic equipment
CN117745537A (en) * 2024-02-21 2024-03-22 微牌科技(浙江)有限公司 Tunnel equipment temperature detection method, device, computer equipment and storage medium
CN117745537B (en) * 2024-02-21 2024-05-17 微牌科技(浙江)有限公司 Tunnel equipment temperature detection method, device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN112348863B (en) 2022-06-21
CN112348863A (en) 2021-02-09

Similar Documents

Publication Publication Date Title
WO2022095596A1 (en) Image alignment method, image alignment apparatus and terminal device
WO2021115071A1 (en) Three-dimensional reconstruction method and apparatus for monocular endoscope image, and terminal device
WO2020207191A1 (en) Method and apparatus for determining occluded area of virtual object, and terminal device
US7554575B2 (en) Fast imaging system calibration
WO2017181899A1 (en) Facial in-vivo verification method and device
US10915998B2 (en) Image processing method and device
WO2021136386A1 (en) Data processing method, terminal, and server
WO2021196548A1 (en) Distance determination method, apparatus and system
US10645364B2 (en) Dynamic calibration of multi-camera systems using multiple multi-view image frames
CN112085771B (en) Image registration method, device, terminal equipment and computer readable storage medium
CN111160178A (en) Image processing method and device, processor, electronic device and storage medium
WO2021179745A1 (en) Environment reconstruction method and device
CN112233189B (en) Multi-depth camera external parameter calibration method and device and storage medium
WO2018184255A1 (en) Image correction method and device
CN113793387A (en) Calibration method, device and terminal of monocular speckle structured light system
CN114298902A (en) Image alignment method and device, electronic equipment and storage medium
WO2016208404A1 (en) Device and method for processing information, and program
CN111383254A (en) Depth information acquisition method and system and terminal equipment
CN114078165A (en) Calibration method of optical imaging module, distortion correction method and related equipment
CN114187333A (en) Image alignment method, image alignment device and terminal equipment
WO2023010565A1 (en) Method and apparatus for calibrating monocular speckle structured light system, and terminal
CN111210506A (en) Three-dimensional reduction method, system, terminal equipment and storage medium
CN112102378A (en) Image registration method and device, terminal equipment and computer readable storage medium
CN112200842B (en) Image registration method, device, terminal equipment and storage medium
CN111814869B (en) Method and device for synchronous positioning and mapping, electronic equipment and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21888295

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21888295

Country of ref document: EP

Kind code of ref document: A1