WO2021092797A1 - 图像的配准方法、终端以及计算机存储介质 - Google Patents

图像的配准方法、终端以及计算机存储介质 Download PDF

Info

Publication number
WO2021092797A1
WO2021092797A1 PCT/CN2019/118049 CN2019118049W WO2021092797A1 WO 2021092797 A1 WO2021092797 A1 WO 2021092797A1 CN 2019118049 W CN2019118049 W CN 2019118049W WO 2021092797 A1 WO2021092797 A1 WO 2021092797A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
pixel
block
image block
clustered
Prior art date
Application number
PCT/CN2019/118049
Other languages
English (en)
French (fr)
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广东移动通信有限公司
Priority to PCT/CN2019/118049 priority Critical patent/WO2021092797A1/zh
Priority to CN201980101531.0A priority patent/CN114586059A/zh
Publication of WO2021092797A1 publication Critical patent/WO2021092797A1/zh
Priority to US17/742,825 priority patent/US20220270204A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/14Transformations for image registration, e.g. adjusting or mapping for alignment of images
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • G06T3/4053Scaling of whole images or parts thereof, e.g. expanding or contracting based on super-resolution, i.e. the output image resolution being higher than the sensor resolution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/20Analysis of motion
    • G06T7/223Analysis of motion using block-matching
    • 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/32Determination of transform parameters for the alignment of images, i.e. image registration using correlation-based methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/50Depth or shape recovery
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10024Color image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10028Range image; Depth image; 3D point clouds
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20021Dividing image into blocks, subimages or windows

Definitions

  • the embodiments of the present application relate to image registration technology, and in particular, to an image registration method, terminal, and computer storage medium.
  • Image registration is the process of matching and superimposing two or more images acquired at different times, different sensors or under different conditions. It has been widely used in remote sensing data analysis, computer vision, image processing and other fields.
  • block matching is commonly used, based on feature point matching or optical flow method to detect the movement of pixels on the original image, and then use the obtained movement to re-move the pixels of the original image to generate registration image.
  • Block matching and feature-based matching can only get sparse pixel movement. For scenes with moving objects, this method can only get a global motion model and cannot match local moving objects at the same time, which will cause a certain amount of image registration. Impact; using optical flow method, optical flow often does not accurately process the image edge information, resulting in blurred edges after matching, which will also reduce the accuracy of image registration; it can be seen that the registration accuracy of existing image registration methods Lower.
  • embodiments of the present application provide an image registration method, terminal, and computer storage medium, which can improve the accuracy of image registration.
  • an image registration method including:
  • the image block of the first image is moved according to the amount of movement of the image block of the first image to obtain a registered image.
  • an embodiment of the present application provides a terminal, including:
  • An obtaining module configured to obtain the first image and the second image
  • the block division module is configured to block the first image to obtain image blocks of the first image
  • the determining module is configured to call a preset similarity algorithm of the image block according to the pixel value of the image block of the first image, and determine the similar image block of the image block of the first image from the second image ;
  • a calculation module configured to calculate the movement amount of the image block of the first image according to the position information of the image block of the first image and the position information of the similar image block of the image block of the first image;
  • the clustering module is configured to cluster the first image according to the depth value of the first image, the amount of movement of the image block of the first image, and the position information of the first image to generate a cluster After the image block;
  • the moving module is configured to move the image block of the first image according to the amount of movement of the image block of the first image when the clustered image block meets a preset condition to obtain a registered image.
  • an embodiment of the present application provides a terminal, and the terminal includes:
  • an embodiment of the present application provides a computer-readable storage medium, in which executable instructions are stored, and when the executable instructions are executed by one or more processors, the processors execute one or more of the above The image registration method described in multiple embodiments.
  • the embodiments of the application provide an image registration method, a terminal, and a computer storage medium.
  • the first image and the second image are acquired, and the first image is divided into blocks to obtain image blocks of the first image.
  • the preset similarity algorithm of the image block is called, and the similar image block of the image block of the first image is determined from the second image, and the position information of the image block of the first image is compared with the position information of the first image.
  • the position information of the similar image blocks of the image block is calculated, and the movement amount of the image block of the first image is calculated.
  • the image is clustered to generate clustered image blocks.
  • the image blocks of the first image are moved according to the amount of movement of the image blocks of the first image to obtain registration Image; that is to say, in the embodiment of the present application, by looking for image blocks similar to the image blocks of the first image in the second image, to calculate the movement amount of the image blocks of the first image, and then use the first image
  • the depth value of an image, the movement amount of the image block of the first image, and the position information of the first image are clustered on the first image to generate clustered image blocks.
  • the clustered image blocks meet the requirements When setting the conditions, move the first image by moving the image block of the first image to obtain the registered image.
  • the depth information of the first image is taken into account in the image registration to form the clustered image block , Only when the clustered image blocks meet the preset conditions, the registered image is obtained by moving the image block of the first image according to the movement amount, thereby improving the accuracy of the registered image, and thus the effect of the obtained registered image Better.
  • FIG. 1 is a schematic flowchart of an optional image registration method provided by an embodiment of the application
  • Figure 2 is a schematic flow diagram of a matching method based on feature points
  • FIG. 3 is a schematic flowchart of an example of an optional image registration method provided by an embodiment of this application.
  • FIG. 4 is a schematic diagram of an optional process for segmenting an image to be registered according to an embodiment of the application
  • FIG. 5 is a schematic structural diagram of an optional search for a reference image provided in an embodiment of this application.
  • Fig. 6a is a schematic structural diagram of an optional image to be registered according to an embodiment of the application.
  • FIG. 6b is a schematic structural diagram of an optional reference image provided by an embodiment of this application.
  • FIG. 7a is a schematic structural diagram of another optional image to be registered according to an embodiment of this application.
  • FIG. 7b is a schematic structural diagram of another optional reference image provided by an embodiment of this application.
  • FIG. 7c is a schematic structural diagram of yet another optional reference image provided by an embodiment of the application.
  • FIG. 8a is a schematic structural diagram of an optional image block of an image to be registered according to an embodiment of this application.
  • FIG. 8b is a schematic structural diagram of an optional clustered image block provided by an embodiment of the application.
  • FIG. 9a is a schematic structural diagram of an optional overlapped pixel point of a registered image provided by an embodiment of the application.
  • FIG. 9b is a schematic structural diagram of an optional vacant pixel of a registered image according to an embodiment of the application.
  • FIG. 10 is a first structural schematic diagram of an optional terminal provided by an embodiment of the application.
  • FIG. 11 is a second schematic structural diagram of an optional terminal provided by an embodiment of this application.
  • FIG. 1 is a schematic flowchart of an optional image registration method provided by an embodiment of the application. As shown in FIG. 1, the above-mentioned image registration method may include :
  • S101 Acquire a first image and a second image
  • Figure 2 is a schematic diagram of the process of feature point-based matching method. As shown in Figure 2, the feature point-based matching method is adopted. Can include:
  • the acquired input image includes the image to be registered and the reference image;
  • feature detection is performed on the image to be registered and the reference image respectively to obtain the feature points of the image to be registered and the feature points of the reference image;
  • mapping function to find the feature points of the reference image that match the feature points of the image to be registered
  • the image space coordinate transformation parameters are obtained through the matched feature point pairs, and finally the image registration is performed by the coordinate transformation parameters to obtain the registered image, that is, the output image.
  • the matching method based on feature points can only get sparse pixel movement, and the same is true for block matching.
  • the above two methods can only get the global motion model and not at the same time. Taking into account the local moving objects, the accuracy of the image registration is not high at that time, and the optical flow method is used. Because the optical flow often does not accurately process the edge information of the image, the edge after the matching is blurred, resulting in the accuracy of the registered image. good.
  • the image to be registered and the reference image are first acquired, where in S101, the first image acquired is the image to be registered, and the second image acquired is the reference image. In this way, The first image and the second image are used for registration to obtain a registered image.
  • the acquired first image not only includes the pixel value and position information of the first image, but also includes the depth value of the first image.
  • the acquired second image not only includes the pixels of the second image. The value also includes the depth value of the second image.
  • the pixel value of the first image and the pixel value of the second image may be color information of the image, such as RGB information, or grayscale information, which is not specifically limited in the embodiment of the present application.
  • S102 Divide the first image into blocks to obtain image blocks of the first image
  • the first image needs to be divided into blocks.
  • the first image can be divided into ordinary rectangular blocks, for example, the first image block is divided into several blocks according to a given size. Get the image block of the first image.
  • S103 According to the pixel value of the image block of the first image, call a preset similarity algorithm of the image block, and determine a similar image block of the image block of the first image from the second image;
  • the second image is searched and traversed to obtain the search traversal to For each image block of, calculate the similarity between the reference block and each image block traversed by the search, and determine the image block with the largest calculated similarity value as the similar image block of the first image; here, the similarity is calculated
  • the sum of absolute difference SAD, Sum of Abstract Difference
  • NCC Normalized Cross Correlation
  • the NCC method is often used to calculate the similarity between the two image blocks.
  • S104 Calculate the movement amount of the image block of the first image according to the position information of the image block of the first image and the position information of the similar image block of the image block of the first image;
  • the movement amount of the image block of the first image can be calculated according to the position information of the image block of the first image and the position information of the image block of the first image.
  • S104 may include:
  • the initial movement amount of the pixel point of the image block of the first image is corrected to obtain the movement amount of the image block of the first image.
  • the lower left corner of the image can be set as the origin of the two-dimensional coordinates, and the distance between the length and width of the image block and the horizontal and vertical coordinates can be recorded as the image block Position information.
  • the horizontal and vertical coordinates in the position information of the image block of the first image are (x1, y1)
  • the horizontal and vertical coordinates in the position information of similar image blocks of the image block of the first image are (x2, y2)
  • the first The image block of the image includes several pixels.
  • the initial movement of the pixels in the same image block is the same.
  • the horizontal and vertical coordinates of the image block of the first image are the same as those of the similar image block of the image block of the first image.
  • correcting the initial movement amount of the pixel point of the image block of the first image to obtain the movement amount of the image block of the first image includes:
  • the initial movement amount of the pixel after the movement is weighted and summed to obtain the movement amount of the image block of the first image.
  • a pixel is selected in it, and based on the horizontal and vertical coordinates of the selected pixel, it is within a preset range from the selected pixel, for example , Take the selected pixel as the center, sample the pixel in the adjacent image block of the image block where the selected pixel is located.
  • different adjacent image blocks are usually selected Sampling is performed separately, so that a preset number of pixels can be obtained.
  • the initial movement amount of the preset number of pixels can be obtained.
  • the position information of the selected pixel is moved according to the movement amount of the preset number of pixels. Can generate pixels after moving.
  • the weights of the moved pixels can be determined according to the pixel values of the pixels at the same position as the moved pixels, that is, each moved pixel corresponds to a weight value.
  • the initial movement amount of the moved pixel can be weighted and summed according to the weight of the moved pixel, and the value obtained by the weighted summation can be determined as the movement amount of the image block of the first image.
  • determining the weight for the moved pixel according to the pixel value of the moved pixel includes:
  • the weight corresponding to the absolute value of the difference between the pixel value of the pixel at the same position and the pixel value of the selected pixel is determined as the weight of the moved pixel.
  • the pixel value of each pixel at the same position in the second image is obtained, and the pixel value of each pixel at the same position is calculated with the selected pixel value.
  • the absolute value of the pixel value difference between pixels, and the absolute value of the difference between the pixel value of each pixel at the same position and the selected pixel corresponds to the weight value, then the corresponding weight The value can be determined as the weight value of the moved pixel.
  • the weight value corresponding to the absolute value of the difference between the pixel value of each pixel at the same position and the selected pixel can be set in advance or input in real time.
  • the embodiment of the present application There is no specific restriction on this.
  • S105 Cluster the first image according to the depth value of the first image, the movement amount of the image block of the first image, and the position information of the first image to generate clustered image blocks;
  • the first image is clustered first, and the clustered image Block to determine whether the amount of movement of the image block of the first image is available.
  • the method could also include:
  • S105 may include:
  • the first image is clustered to generate the clustered image block.
  • the depth value of the first image is enlarged, so that the resolution of the depth value after the enlargement of the first image is
  • the resolution of the depth value of the first image is greater than the resolution of the pixel value of the first image
  • the depth value of the first image is reduced to make the first image
  • the resolution of the depth value after the image reduction processing is equal to the resolution of the pixel value of the first image, so that the resolution of the depth value after the first image processing is equal to the resolution of the pixel value of the first image.
  • the first image needs to be clustered according to the processed depth value of the first image, the movement amount of the image block of the first image, and the position information of the first image. Generate clustered image blocks.
  • the depth value of the first image can also be preprocessed and corrected.
  • the first image that uses a bitmap to represent the depth value it can be reconstructed by a triangular plane. Method to restore the surface information of the object, and perform smoothing and interpolation processing.
  • the first image that uses the depth map to represent the depth value it is necessary to detect and denoise the first image to ensure that the obtained depth value has a good value. The precision.
  • S105 may include:
  • the amount of movement of the pixels of the first image and the position information of the pixels of the first image are respectively multiplied by the corresponding weight values to form an array of the first image;
  • the obtained movement amount of the image block of the first image is the movement amount of the pixel in the image block of the first image.
  • the corresponding depth value of the pixel is The moving amount of the pixel and the position coordinate of the pixel multiplied by the corresponding weight value can form an array, that is, the array of the first image.
  • a preset clustering algorithm is used to cluster the array of the first image, where the preset clustering algorithm can be a mean shift algorithm (Mean-Shift Clustering), or a K-means clustering algorithm (K- means clustering algorithm), here, the embodiment of the present application does not specifically limit this.
  • Mean-Shift Clustering mean shift algorithm
  • K-means clustering algorithm K- means clustering algorithm
  • clustering the array of the first image according to a preset clustering algorithm to generate clustered image blocks includes:
  • the initial clustered image block After clustering using the preset clustering algorithm, the initial clustered image block can be obtained. Since there may be some image blocks with a small number of pixels in the initial clustered image block, these image blocks have no reference significance. Therefore, the category of this type of image block needs to be discarded.
  • a first preset threshold is preset, and from the initial clustered image blocks, an image block whose number of pixels is less than the first preset threshold is selected, the category is discarded, and the classification is performed again.
  • the selected image blocks are reclassified to obtain a clustered image Blocks, including:
  • the category of the selected image block is attributed to the image block closest to the selected image block to obtain the clustered image block.
  • clustered image blocks there is a distance between each class of image blocks.
  • the category of the selected image block is attributed to the image block with the closest distance, so that the pixels are discarded In order to get clustered image blocks.
  • the clustered image blocks are judged to determine whether the clustered image blocks meet the preset conditions. Only when the clustered image blocks meet the preset conditions, the calculated image blocks of the first image are described. The accuracy of the movement amount is required by the sign. Therefore, at this time, the image block of the first image is moved according to the movement amount of the image block of the first image to obtain the final registered image.
  • the above-mentioned image registration method may further include:
  • the clustered image block is determined as the image block of the first image to update the image block of the first image, and the execution is performed according to the pixel value of the image block of the first image , Call the preset similarity algorithm of the image block, and determine the similar image block of the image block of the first image from the second image.
  • the clustered image blocks do not meet the preset conditions, it means that the calculated accuracy of the movement amount of the image block of the first image is not enough, and the movement amount of the image block of the first image needs to be recalculated.
  • the clustered image block is determined as the image block of the first image, the block method of the first image is updated, and then S103 to S106 are executed again until the obtained clustered image block satisfies the pre- Set conditions to obtain a higher-precision registration image.
  • the clustered image blocks satisfy the preset conditions, including:
  • the clustered image blocks meet the preset condition.
  • the clustered image blocks do not meet the preset condition, including:
  • the clustered image blocks do not meet the preset condition.
  • the clustered image blocks are one-to-one corresponding to the image blocks of the first image.
  • the image blocks of the first image are searched for and Compared with the first image block, the image block with the least number of changed pixels is corresponding to the two.
  • the second image block look for the second image block among the remaining image blocks of the first image. Compare the image block with the least number of pixels that have changed compared to the block.
  • the image block of the first image is updated to update the block method, thereby re-determining the movement of the image block of the first image until the clustered image block meets the preset conditions, so as to obtain a more accurate configuration. Quasi-image.
  • the method may further include:
  • a pixel value is selected from the pixel values of the first image corresponding to the overlapping pixels, and the selected pixel value is determined as the pixel value of the overlapping pixel.
  • a pixel value can be arbitrarily selected from the pixel value of the first image corresponding to the overlapped pixel as the pixel value of the overlapped pixel, or it can be selected from the first image corresponding to the overlapped pixel in a preset manner.
  • One of the pixel values of an image is selected as the pixel value of the overlapped pixel.
  • the pixel value of the overlapped pixel can also be calculated through some preset algorithms.
  • the embodiment of the present application does not specifically limit this.
  • a pixel value is selected from the pixel value of the first image corresponding to the overlapping pixel, and the selected pixel value is determined as the overlapping pixel
  • the pixel value of includes:
  • the pixel value of the overlapping pixel is determined according to the relationship between the absolute value of the difference between the at least two pixel values and the pixel value of the second image corresponding to the overlapping pixel.
  • the method may further include:
  • the pixel value of the vacant pixel is determined by using a preset algorithm according to the pixel value of the adjacent pixel of the vacant pixel;
  • the vacant pixel refers to a pixel whose pixel value does not exist.
  • the neighboring pixels of the vacant pixel can be obtained first .
  • the pixel value of the vacant pixel can be calculated according to the preset interpolation algorithm or the global movement model, so as to obtain a more accurate and complete registration image.
  • FIG. 3 is a schematic flowchart of an example of an optional image registration method provided by an embodiment of this application. As shown in FIG. 3, the image registration method may include:
  • two or more images (videos) and depth maps (depth information, equivalent to the above-mentioned depth value) are obtained by shooting by the shooting equipment of the terminal.
  • one image is used as the waiting image.
  • the other image is used as the reference image, and the registered image is the registered image.
  • the image information can be RGB values or grayscale information.
  • grayscale information is taken as an example.
  • the depth information may be a dot matrix or a depth map, it is necessary to do a preprocessing and correction of the depth information. If it is a dot matrix image, it is necessary to restore the surface information of the object by means of triangular plane reconstruction, and perform smoothing and interpolation processing; if it is depth Figure, it is necessary to detect and denoise the dead pixels to ensure that the depth information obtained has good accuracy.
  • the depth information After correcting the depth information, it is necessary to match the depth map and the gray information. Since the depth information often does not have a higher resolution like the gray information, the depth information needs to be up-sampled and matched; if the depth information and the gray information The information has not been calibrated, it needs to be calibrated and calibrated to ensure the matching accuracy. When upsampling, the edge accuracy can be ensured by guiding filtering and other methods. After the matching is completed, the depth information of the whole image can be obtained.
  • Fig. 4 is an optional flowchart of the image to be registered for block division provided by an embodiment of this application.
  • the image to be registered is divided into blocks.
  • the image to be registered is divided into blocks according to a fixed size to obtain the image blocks of the image to be registered.
  • the image pointed to by the arrow in Figure 4 is divided into blocks. After the block of the image to be registered, it can be seen that the image to be registered is divided into several rectangular blocks.
  • S303 Search the reference image, find the image block that is closest to the content of the block to obtain the movement amount of the image block;
  • FIG. 5 is an optional structural diagram for searching the reference image provided in an embodiment of the application.
  • the current macro block is searched in the search window, that is, the input reference image is searched in the search window until the image block with the content of the image block to be registered is found.
  • the similarity of the image block The SAD method can be used for the evaluation. If the overall grayscale information of the image to be registered and the reference image are quite different, the NCC index can also be used to evaluate the similarity of the image blocks.
  • FIG. 6a is an optional to-be-registered image block provided by an embodiment of this application. Schematic diagram of the structure of the quasi-image.
  • FIG. 6b is a schematic diagram of the structure of an optional reference image provided by an embodiment of the application, as shown in FIG. 6a and FIG. 6b. In FIG.
  • the amount of movement can be used as the amount of movement of all pixels in the image block, so that the amount of movement of all pixels of the image to be registered is obtained.
  • the accuracy of the movement amount of the pixels obtained in this way is low, and the movement amount of all pixels will be further corrected and refined.
  • Figure 7a is a schematic structural diagram of another optional image to be registered provided by an embodiment of the application.
  • Figure 7a for a certain pixel point A, the position P and the pixel value BV of the pixel point are obtained, and the distance The pixel point A is the center, the movement amount of the pixel within the radius r is sampled, and N different movement amounts mv 0 ⁇ mv N-1 are obtained by sampling, and the pixel point A is moved according to these movement amounts to obtain a new position P+ mv
  • Figure 7b is a schematic structural diagram of another optional reference image provided by an embodiment of the application. As shown in Figure 7b, the pixel values RV 0 to RV N- of the reference image at the new position (BCD position in the figure) are acquired. 1.
  • Fig. 7c is a schematic structural diagram of yet another optional reference image provided by an embodiment of the application.
  • the pixel value difference diff
  • is calculated, and N different pixel values are calculated according to the pixel value difference.
  • the movement amount mv 0 ⁇ mv N-1 is weighted and summed to obtain a new mv.
  • the depth information d, the amount of movement [mv x , mv y ] and the position information [x, y] of all pixels are obtained, all the data are normalized, and each data is multiplied by the weight w.
  • FIG. 8a is a schematic structural diagram of an optional image block of the image to be registered provided in an embodiment of this application
  • FIG. 8b is an embodiment of this application.
  • thresh2 For all classes, define the threshold value thresh2. If the number of pixels of this class is less than thresh2, discard this class and reclassify the pixels of this class to other classes closest to this pixel.
  • the counter returns to 0. For each pixel in the old image block, if it does not belong to the new image Block, add 1 to the counter, so that after counting all the pixels in the old image block, the number of changed pixels m is obtained. If the size of the old image block is n, the ratio of pixel changes m/n can be obtained, and the threshold value thresh1 If the ratio is less than thresh1, the algorithm is determined to converge, and the movement amount of the pixels in the whole image is obtained, and S307 is executed. Otherwise, the algorithm is continued. If it is determined not to converge, the search is performed again in the manner of S303 according to the obtained new image block.
  • Figure 9a is an implementation of this application.
  • the example provides a schematic structural diagram of the overlapping pixels of an optional registration image. As shown in Figure 9a, two or more pixels have been moved to the same position.
  • Figure 9b is an optional configuration provided by an embodiment of this application.
  • the two pixel values P1 and P2 After moving the pixels to the same position, obtain the pixel value Pref at that position of the reference image, calculate the pixel value difference, if
  • interpolation can be used to fill the pixel at the location, or a global movement model (such as an affine matrix or a homography matrix) can be calculated to calculate the pixel value of the hole.
  • Model prediction is not used for moving objects (the motion model of local moving objects is difficult to match with a single model), but a single pixel is calculated
  • the flow the registration of the moving object area is more accurate, the search adopts irregular block search, and the matching of objects with irregular edges is more accurate.
  • the embodiment of this application adopts a method similar to dense optical flow estimation, gives motion estimation of all pixels and reconfigures the image, does not rely on a single motion model, and introduces scene depth information and irregular shapes in the search
  • the block matching has a strong adaptability to complex motion scenes.
  • the embodiment of the present application provides an image registration method, acquiring a first image and a second image, dividing the first image into blocks to obtain image blocks of the first image, and according to the pixel values of the image blocks of the first image, Call the preset similarity algorithm of the image block, determine the similar image block of the image block of the first image from the second image, according to the position information of the image block of the first image and the similar image block of the image block of the first image. The position information of the first image is calculated, and the movement amount of the image block of the first image is calculated.
  • the movement amount of the image block of the first image and the position information of the first image the first image is clustered to generate After the clustered image block, when the clustered image block meets the preset condition, the image block of the first image is moved according to the movement amount of the image block of the first image to obtain the registered image; that is, In the embodiment of the present application, by searching for image blocks similar to the image blocks of the first image in the second image, the amount of movement of the image blocks of the first image is calculated by this, and then the depth value of the first image is used, The movement amount of the image block of the first image and the position information of the first image cluster the first image to generate clustered image blocks.
  • the first image The image block of an image is moved to move the first image to obtain the registered image.
  • the depth information of the first image is taken into account in the image registration to form the image block after clustering. Only when the image block of the first image meets the preset condition is moved according to the amount of movement of the image block of the first image to obtain the registered image, thereby improving the accuracy of the registered image, and thereby the effect of the obtained registered image is better.
  • FIG. 10 is a schematic structural diagram 1 of an optional terminal provided by an embodiment of the present application.
  • the terminal may include: an acquisition module 101, The blocking module 102, the determining module 103, the calculating module 104, the clustering module 105 and the moving module 106; among them,
  • the obtaining module 101 is configured to obtain the first image and the second image
  • the block division module 102 is configured to block the first image to obtain image blocks of the first image
  • the determining module 103 is configured to call a preset similarity algorithm of the image block according to the pixel value of the image block of the first image, and determine the similar image block of the image block of the first image from the second image;
  • the calculation module 104 is configured to calculate the movement amount of the image block of the first image according to the position information of the image block of the first image and the position information of the similar image block of the image block of the first image;
  • the clustering module 105 is configured to cluster the first image according to the depth value of the first image, the movement amount of the image block of the first image, and the position information of the first image to generate clustered image blocks;
  • the moving module 106 is configured to move the image block of the first image according to the amount of movement of the image block of the first image when the clustered image block meets a preset condition, to obtain a registered image.
  • the terminal is further configured to:
  • the clustered image block is determined as the image block of the first image to update the image block of the first image, and the execution is performed according to the pixel value of the image block of the first image , Call the preset similarity algorithm of the image block, and determine the similar image block of the image block of the first image from the second image.
  • the terminal is further configured to:
  • the amount of movement of the image block of the first image and the position information of the first image, and generating the clustered image block, according to the pixel value of the first image The resolution of the depth value of the first image is scaled to obtain the processed depth value of the first image;
  • the clustering module 105 is specifically configured as follows:
  • the first image is clustered to generate the clustered image block.
  • calculation module 104 is specifically configured as follows:
  • the initial movement amount of the pixel point of the image block of the first image is corrected to obtain the movement amount of the image block of the first image.
  • the calculation module 104 corrects the initial movement amount of the pixel point of the image block of the first image to obtain the movement amount of the image block of the first image, including:
  • the initial movement amount of the pixel after the movement is weighted and summed to obtain the movement amount of the image block of the first image.
  • the calculation module 104 determines the weight for the moved pixel according to the pixel value of the pixel at the same position, including:
  • the weight corresponding to the absolute value of the difference between the pixel value of the pixel at the same position and the pixel value of the selected pixel is determined as the weight of the moved pixel.
  • the clustering module 105 is specifically configured as follows:
  • the amount of movement of the pixels of the first image and the position information of the pixels of the first image are respectively multiplied by the corresponding weight values to form an array of the first image;
  • the clustering module 105 clusters the array of the first image according to a preset clustering algorithm, and generates clustered image blocks including:
  • the clustering module 105 re-categorizes the selected image blocks, and the clustered image blocks include:
  • the category of the selected image block is attributed to the image block closest to the selected image block to obtain the clustered image block.
  • the clustered image blocks satisfy a preset condition, including:
  • the clustered image blocks meet the preset condition.
  • the clustered image blocks do not meet the preset condition, including:
  • the clustered image blocks do not meet the preset condition.
  • the terminal is further configured to:
  • the image blocks of the first image are moved according to the amount of movement of the image blocks of the first image, and after the registered image is obtained, when there are overlapping pixels in the registered image At this time, a pixel value is selected from the pixel values of the first image corresponding to the overlapped pixel point, and the selected pixel value is determined as the pixel value of the overlapped pixel point.
  • the terminal selects a pixel value from the pixel value of the first image corresponding to the overlapped pixel, and determines the selected pixel value as the pixel value of the overlapped pixel, including:
  • the pixel value of the overlapping pixel is determined according to the relationship between the absolute value of the difference between the at least two pixel values and the pixel value of the second image corresponding to the overlapping pixel.
  • the terminal is further configured to:
  • the image blocks of the first image are moved according to the amount of movement of the image blocks of the first image, and after the registered image is obtained, when there are vacant pixels in the registered image
  • the image blocks of the first image are moved according to the amount of movement of the image blocks of the first image, and after the registered image is obtained, when there are vacant pixels in the registered image
  • the vacant pixel refers to a pixel whose pixel value does not exist.
  • the acquisition module 101, the block module 102, the determination module 103, the calculation module 104, the clustering module 105, and the mobile module 106 may be implemented by a processor located on the terminal, specifically a central processing unit (CPU, Central Processing Unit). Unit), microprocessor (MPU, Microprocessor Unit), digital signal processor (DSP, Digital Signal Processing), or Field Programmable Gate Array (FPGA, Field Programmable Gate Array) and other implementations.
  • CPU Central Processing Unit
  • MPU Microprocessor Unit
  • DSP Digital Signal Processing
  • FPGA Field Programmable Gate Array
  • FIG. 11 is a second structural diagram of an optional terminal provided by an embodiment of the application. As shown in FIG. 11, an embodiment of the application provides a terminal 1100, including:
  • the storage medium 112 relies on the processor 111 to perform operations through the communication bus 113.
  • the image registration method executed by the above-mentioned image processor is executed.
  • the communication bus 113 is used to implement connection and communication between these components.
  • the communication bus 113 also includes a power bus, a control bus, and a status signal bus.
  • various buses are marked as the communication bus 113 in FIG. 11.
  • An embodiment of the present application provides a computer storage medium that stores executable instructions.
  • the processor executes the terminal operations in the one or more embodiments above.
  • the registration method of the executed image is described below.
  • the memory in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memory.
  • the non-volatile memory can be read-only memory (Read-Only Memory, ROM), programmable read-only memory (Programmable ROM, PROM), erasable programmable read-only memory (Erasable PROM, EPROM), and electrically available Erase programmable read-only memory (Electrically EPROM, EEPROM) or flash memory.
  • the volatile memory may be random access memory (Random Access Memory, RAM), which is used as an external cache.
  • RAM static random access memory
  • DRAM dynamic random access memory
  • DRAM synchronous dynamic random access memory
  • DDRSDRAM Double Data Rate Synchronous Dynamic Random Access Memory
  • Enhanced SDRAM, ESDRAM Synchronous Link Dynamic Random Access Memory
  • Synchlink DRAM Synchronous Link Dynamic Random Access Memory
  • DRRAM Direct Rambus RAM
  • the processor may be an integrated circuit chip with signal processing capabilities.
  • each step of the above method can be completed by an integrated logic circuit of hardware in the processor or instructions in the form of software.
  • the above-mentioned processor may be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (ASIC), a ready-made programmable gate array (Field Programmable Gate Array, FPGA) or other Programming logic devices, discrete gates or transistor logic devices, discrete hardware components.
  • DSP Digital Signal Processor
  • ASIC application specific integrated circuit
  • FPGA ready-made programmable gate array
  • the methods, steps, and logical block diagrams disclosed in the embodiments of the present application can be implemented or executed.
  • the general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
  • the steps of the method disclosed in the embodiments of the present application can be directly embodied as being executed and completed by a hardware decoding processor, or executed and completed by a combination of hardware and software modules in the decoding processor.
  • the software module can be located in a mature storage medium in the field, such as random access memory, flash memory, read-only memory, programmable read-only memory, or electrically erasable programmable memory, registers.
  • the storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
  • the embodiments described herein can be implemented by hardware, software, firmware, middleware, microcode, or a combination thereof.
  • the processing unit can be implemented in one or more application specific integrated circuits (ASIC), digital signal processor (Digital Signal Processing, DSP), digital signal processing equipment (DSP Device, DSPD), programmable Logic device (Programmable Logic Device, PLD), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA), general-purpose processors, controllers, microcontrollers, microprocessors, and others for performing the functions described in this application Electronic unit or its combination.
  • ASIC application specific integrated circuits
  • DSP Digital Signal Processing
  • DSP Device digital signal processing equipment
  • PLD programmable Logic Device
  • PLD Field-Programmable Gate Array
  • FPGA Field-Programmable Gate Array
  • the technology described herein can be implemented by modules (for example, procedures, functions, etc.) that perform the functions described herein.
  • the software codes can be stored in the memory and executed by the processor.
  • the memory can be implemented in the processor or external to the processor.
  • the technical solution of this application essentially or the part that contributes to the existing technology can be embodied in the form of a software product, and the computer software product is stored in a storage medium (such as ROM/RAM, magnetic disk, The optical disc) includes several instructions to enable a terminal (which may be a mobile phone, a computer, a server, or a network device, etc.) to execute the method described in each embodiment of the present application.
  • a terminal which may be a mobile phone, a computer, a server, or a network device, etc.
  • the embodiments of the application provide an image registration method, a terminal, and a computer storage medium.
  • the first image and the second image are acquired, and the first image is divided into blocks to obtain image blocks of the first image.
  • the preset similarity algorithm of the image block is called, and the similar image block of the image block of the first image is determined from the second image, and the position information of the image block of the first image is compared with the position information of the first image.
  • the position information of the similar image blocks of the image block is calculated, and the movement amount of the image block of the first image is calculated.
  • the image is clustered to generate clustered image blocks.
  • the image blocks of the first image are moved according to the amount of movement of the image blocks of the first image to obtain registration Images can improve the accuracy of image registration.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Multimedia (AREA)
  • Image Analysis (AREA)

Abstract

本申请实施例公开了一种图像的配准方法、终端以及计算机存储介质,包括:获取第一图像和第二图像,对第一图像进行分块,得到第一图像的图像块,根据第一图像的图像块的像素值,调用预设的图像块的相似度算法,从第二图像中确定出第一图像的图像块的相似图像块,根据第一图像的图像块的位置信息与第一图像的图像块的相似图像块的位置信息,计算得到第一图像的图像块的移动量,根据第一图像的深度值,第一图像的图像块的移动量和第一图像的位置信息,对第一图像进行聚类,生成聚类后的图像块,当聚类后的图像块满足预设条件时,根据第一图像的图像块的移动量,对第一图像的图像块进行移动,得到配准图像,能够提高图像的深度值的精确度。

Description

图像的配准方法、终端以及计算机存储介质 技术领域
本申请实施例涉及图像配准技术,尤其涉及一种图像的配准方法、终端以及计算机存储介质。
背景技术
图像配准就是将不同时间、不同传感器或不同条件下获取到的两幅或多幅图像进行匹配、叠加的过程,它已经被广泛地应用于遥感数据分析、计算机视觉、图像处理等领域。
在图像配准中,常用块匹配,基于特征点的匹配或者光流法来检测出原图像上的像素点的移动,再利用得到的移动量重新对原图像的像素点进行移动,生成配准图像。
采用块匹配和基于特征点的匹配只能得到稀疏的像素移动量,对于有运动物体的场景,该方法只能得到全局运动模型而不能同时兼顾匹配局部移动物体,对图像配准结果会造成一定影响;采用光流法,光流往往对图像边缘信息的处理不够精准导致匹配后边缘模糊,也会降低图像配准的精度;由此可以看出,现有的图像配准方法的配准精度较低。
发明内容
为解决上述技术问题,本申请实施例提供一种图像的配准方法、终端以及计算机存储介质,能够提高图像的配准精确。
本申请实施例的技术方案可以如下实现:
第一方面,本申请实施例提供一种图像的配准方法,包括:
获取第一图像和第二图像;
对所述第一图像进行分块,得到所述第一图像的图像块;
根据所述第一图像的图像块的像素值,调用预设的图像块的相似度算法,从所述第二图像中确定出所述第一图像的图像块的相似图像块;
根据所述第一图像的图像块的位置信息与所述第一图像的图像块的相似图像块的位置信息,计算得到所述第一图像的图像块的移动量;
根据所述第一图像的深度值,所述第一图像的图像块的移动量和所述第一图像的位置信息,对所述第一图像进行聚类,生成聚类后的图像块;
当聚类后的图像块满足预设条件时,根据所述第一图像的图像块的移动量,对所述第一图像的图像块进行移动,得到配准图像。
第二方面,本申请实施例提供一种终端,包括:
获取模块,配置为获取第一图像和第二图像;
分块模块,配置为对所述第一图像进行分块,得到所述第一图像的图像块;
确定模块,配置为根据所述第一图像的图像块的像素值,调用预设的图像块的相似度算法,从所述第二图像中确定出所述第一图像的图像块的相似图像块;
计算模块,配置为根据所述第一图像的图像块的位置信息与所述第一图像的图像块 的相似图像块的位置信息,计算所述第一图像的图像块的移动量;
聚类模块,配置为根据所述第一图像的深度值,所述第一图像的图像块的移动量和所述第一图像的位置信息,对所述第一图像进行聚类,生成聚类后的图像块;
移动模块,配置为当聚类后的图像块满足预设条件时,根据所述第一图像的图像块的移动量,对所述第一图像的图像块进行移动,得到配准图像。
第三方面,本申请实施例提供一种终端,所述终端包括:
处理器以及存储有所述处理器可执行指令的存储介质,所述存储介质通过通信总线依赖所述处理器执行操作,当所述指令被所述处理器执行时,执行上述一个或多个实施例所述的图像的配准方法。
第四方面,本申请实施例提供一种计算机可读存储介质,其中,存储有可执行指令,当所述可执行指令被一个或多个处理器执行的时候,所述处理器执行上述一个或多个实施例所述的图像的配准方法。
本申请实施例提供了一种图像的配准方法、终端以及计算机存储介质,获取第一图像和第二图像,对第一图像进行分块,得到第一图像的图像块,根据第一图像的图像块的像素值,调用预设的图像块的相似度算法,从第二图像中确定出第一图像的图像块的相似图像块,根据第一图像的图像块的位置信息与第一图像的图像块的相似图像块的位置信息,计算得到第一图像的图像块的移动量,根据第一图像的深度值,第一图像的图像块的移动量和第一图像的位置信息,对第一图像进行聚类,生成聚类后的图像块,当聚类后的图像块满足预设条件时,根据第一图像的图像块的移动量,对第一图像的图像块进行移动,得到配准图像;也就是说,在本申请实施例中,通过在第二图像中寻找与第一图像的图像块相似的图像块,以此来计算得到第一图像的图像块的移动量,再采用第一图像的深度值,第一图像的图像块的移动量和第一图像的位置信息对第一图像进行聚类,从而生成聚类后的图像块,这样,在聚类后的图像块满足预设条件时,以第一图像的图像块的移动至来移动第一图像,从而得到配准图像,这样,在图像配准中将第一图像的深度信息考虑进去来形成聚类后的图像块,只有在聚类后的图像块满足预设条件时才根据第一图像的图像块的移动量移动得到配准图像,从而提高了配准图像的精度,进而使得的得到的配准图像的效果更佳。
附图说明
图1为本申请实施例提供的一种可选的图像的配准方法的流程示意图;
图2为基于特征点的匹配方法的流程示意图;
图3为本申请实施例提供的一种可选的图像的配准方法的实例的流程示意图;
图4为本申请实施例提供的一种可选的对待配准图像进行分块的流程示意图;
图5为本申请实施例中提供的一种可选的对基准图像进行搜索的结构示意图;
图6a为本申请实施例提供的一种可选的待配准图像的结构示意图;
图6b为本申请实施例提供的一种可选的基准图像的结构示意图;
图7a为本申请实施例提供的另一种可选的待配准图像的结构示意图;
图7b为本申请实施例提供的另一种可选的基准图像的结构示意图;
图7c为本申请实施例提供的再一种可选的基准图像的结构示意图;
图8a为本申请实施例提供的一种可选的待配准图像的图像块的结构示意图;
图8b为本申请实施例提供的一种可选的聚类后的图像块的结构示意图;
图9a为本申请实施例提供的一种可选的配准图像的重叠像素点的结构示意图;
图9b为本申请实施例提供的一种可选的配准图像的空置像素点的结构示意图;
图10为本申请实施例提供的一种可选的终端的结构示意图一;
图11为本申请实施例提供的一种可选的终端的结构示意图二。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。可以理解的是,此处所描述的具体实施例仅仅用于解释相关申请,而非对该申请的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与有关申请相关的部分。
本申请实施例提供一种图像的配准方法,图1为本申请实施例提供的一种可选的图像的配准方法的流程示意图,如图1所示,上述图像的配准方法可以包括:
S101:获取第一图像和第二图像;
目前,采用较多的图像的配准方法有块匹配,基于特征点的匹配和光流法,图2为基于特征点的匹配方法的流程示意图,如图2所示,采用基于特征点的匹配方法可以包括:
S201:输入图像;
具体来说,获取到的输入图像,输入图像包括待配准图像和基准图像;
S202:特征检测;
具体来说,对待配准图像和基准图像分别进行特征检测,得到待配准图像的特征点和基准图像的特征点;
S203:映射函数;
这里,利用映射函数,找到与待配准图像的特征点相匹配的基准图像的特征点;
S204:转换和重采样;
S205:输出图像。
然后,通过相匹配的特征点对得到图像空间坐标变换参数,最后由坐标变换参数进行图像配准,得到配准图像,即输出图像。
这样,通过基于特征点的匹配方法得到配准图像。
由上述方法可以看出,基于特征点的匹配方法只能得到稀疏的像素移动量,块匹配也是如此,然而对于有运动物体的场景来说,上述两种方法只能得到全局运动模型而不能同时兼顾局部移动物体,到时图像配准的结果精确度不高,并且采用光流法,由于光流往往对图像边缘信息的处理不够精确,导致匹配后边缘模糊,导致得到的配准图像精度不佳。
为了提高图像配准的精度,这里,首先获取待配准图像和基准图像,其中,在S101中,获取到的第一图像为待配准图像,获取到的第二图像为基准图像,这样,采用第一图像和第二图像来进行配准,以得到配准图像。
这里,需要说明的是,获取到的第一图像不仅包括第一图像的像素值和位置信息,还包括第一图像的深度值,同样的,获取到的第二图像不仅包括第二图像的像素值,还包括第二图像的深度值。
其中,上述第一图像的像素值和第二图像的像素值可以为图像的颜色信息,例如RGB信息,也可以为灰度信息,这里,本申请实施例对此不作具体限定。
S102:对第一图像进行分块,得到第一图像的图像块;
通过S101获取到第一图像和第二图像之后,需要对第一图像进行分块,这里,可以将第一图像分成普通的矩形块,例如按照给定的尺寸将第一图像块分成若干块,得到第一图像的图像块。
S103:根据第一图像的图像块的像素值,调用预设的图像块的相似度算法,从第二图像中确定出第一图像的图像块的相似图像块;
通过S102得到第一图像的图像块之后,针对第一图像的每块图像块来说,以第一图像的每块图像块的大小为基准块,对第二图像进行搜索遍历,得到搜索遍历到的每块图像块,计算基准块与搜索遍历到的每块图像块之间的相似度,将计算得到相似度的值最大的图像块确定为第一图像的相似图像块;这里,在计算相似度中,可以采用绝对差和(SAD,Sum of Abstract Difference)的方法,还可以采用归一化互相关图像匹配(NCC,Normalized Cross Correlation)的方法,这里,本申请实施例对此不作具体限定。
需要说明的是,当第一图像和第二图像的灰度信息相差较大时,常常采用NCC的方法来计算两个图像块之间的相似度。
这样,通过S103可以在第二图像中为第一图像的图像块寻找到相似图像块。
S104:根据第一图像的图像块的位置信息与第一图像的图像块的相似图像块的位置信息,计算得到第一图像的图像块的移动量;
在确定出第一图像的图像块的相似图像块之后,可以根据第一图像的图像块的位置信息和第一图像的图像块的位置信息来计算得到第一图像的图像块的移动量。
为了计算得到第一图像的图像块的移动量,在一种可选的实施例中,S104可以包括:
将第一图像的图像块的横纵坐标与第一图像的图像块的相似图像块的横纵坐标之间的差值,确定为第一图像的图像块的像素点的初始移动量;
对第一图像的图像块的像素点的初始移动量进行修正,得到第一图像的图像块的移动量。
具体来说,针对第一图像和第二图像来说,可以设定图像的左下角为二维坐标的原点,可以将图像块的长和宽与横纵坐标之间的距离记为图像块的位置信息,这样,假设第一图像的图像块的位置信息中横纵坐标为(x1,y1),第一图像的图像块的相似图像块的位置信息中横纵坐标为(x2,y2),那么计算两者之间的差值为(x1-x2,y1-y2),将得到的计算结果记为第一图像的图像块的像素点的初始移动量,这里,需要说明的是,第一图像的图像块中包括若干个像素点,在同一个图像块中的像素点的初始移动量相同,均为第一图像的图像块的横纵坐标与第一图像的图像块的相似图像块的横纵坐标之间的差值。
在计算得到第一图像的图像块的像素点的初始移动量之后,需要对该值继续修正,以得到第一图像的图像块的移动量;那么,为得到第一图像的图像块的移动量,在一种可选的实施例中,对第一图像的图像块的像素点的初始移动量进行修正,得到第一图像的图像块的移动量,包括:
以第一图像的图像块内任意一个选定的像素点的位置信息为基准,从第一图像的预设范围内进行采样,得到预设数目的像素点;
根据预设数目的像素点的初始移动量,对选定的像素点的位置信息进行移动,生成移动后的像素点;
从第二图像中获取与移动后的像素点同位置的像素点的像素值;
根据同位置的像素点的像素值,为移动后的像素点确定权重;
根据移动后的像素点的权重,对移动后的像素点的初始移动量进行加权求和,得到第一图像的图像块的移动量。
具体来说,针对第一图像的图像块来说,在其中选定一个像素点,并以选定的像素点的横纵坐标为基准,在距离该选定的像素点预设范围内,例如,以选定的像素点为中心,在选定的像素点所在的图像块的相邻图像块中对像素点进行采样,这里,为了采样 数据的种类更加丰富,通常选取不同的相邻图像块分别进行采样,这样,可以得到预设数目的像素点。
在采样得到预设数目的像素点之后,可以得到预设数目的像素点的初始移动量,此时,对选定的像素点的位置信息按照预设数目的像素点的移动量进行移动,便可以生成移动后的像素点。
针对移动后的像素点,可以根据与移动后的像素点同位置的像素点的像素值,确定移动后的像素点确定权重,也就是说,每个移动后的像素点均对应有权重值,这样,就可以根据移动后的像素点的权重,对移动后的像素点的初始移动量进行加权求和,将加权求和得到的值确定为第一图像的图像块的移动量。
为了确定出移动后的像素点的权重值,在一种可选的实施例中,根据移动后的像素点的像素值,为移动后的像素点确定权重,包括:
计算与同位置的像素点的像素值与选定的像素点的像素值之间的差值的绝对值;
将同位置的像素点的像素值与选定的像素点的像素值之间的差值的绝对值对应的权重,确定为移动后的像素点的权重。
具体来说,在得到移动后的像素点之后,获取每个移动后的像素点在第二图像中同位置的像素点的像素值,计算每个同位置的像素点的像素值与选定的像素点之间的像素值差值的绝对值,而每个同位置的像素点的像素值与选定的像素点之间的差值的绝对值均对应有权重值,那么,将对应的权重值就可以确定为移动后的像素点的权重值。
其中,上述每个同位置的像素点的像素值与选定的像素点之间的差值的绝对值均所对应的权重值,可以预先进行设置,也可以实时输入,这里,本申请实施例对此不作具体限定。
S105:根据第一图像的深度值,第一图像的图像块的移动量和第一图像的位置信息,对第一图像进行聚类,生成聚类后的图像块;
通过S104得到第一图像的图像块的移动量之后,需要确定第一图像的图像块的移动量是否可用,这里,为了确定是否可用,先对第一图像进行聚类,根据聚类后的图像块来确定第一图像的图像块的移动量是否可用。
并且,当第一图像的像素值的分辨率与第一图像的深度值的分辨率不同时,需要对第一图像的深度值的分辨率进行处理,在一种可选的实施例中,S105之前,该方法还可以包括:
根据第一图像的像素值的分辨率,对第一图像的深度值的分辨率进行缩放处理,得到第一图像处理后的深度值;
相应地,S105可以包括:
根据第一图像处理后的深度值,第一图像的图像块的移动量和第一图像的位置信息,对第一图像进行聚类,生成聚类后的图像块。
也就是说,当第一图像的深度值的分辨率小于第一图像的像素值的分辨率时,对第一图像的深度值进行放大处理,以使得第一图像放大处理后的深度值的分辨率与第一图像的像素值的分辨率相等;当第一图像的深度值的分辨率大于第一图像的像素值的分辨率时,对第一图像的深度值进行缩小处理,以使得第一图像缩小处理后的深度值的分辨率与第一图像的像素值的分辨率相等,这样,使得第一图像处理后的深度值的分辨率与第一图像的像素值的分辨率相等。
这样,在得到第一图像处理后的深度值之后,需要根据第一图像处理后的深度值,第一图像的图像块的移动量和第一图像的位置信息,对第一图像进行聚类,生成聚类后的图像块。
这里,需要说明的是,在缩放深度值时,还可以对第一图像的深度值进行预处理和 修正,对于以点阵图来表示深度值的第一图像来说,可以通过三角形平面重建的方式恢复物体表面信息,并且做平滑和插值处理,对于以深度图来表示深度值的第一图像来说,需要对第一图像的坏点检测和去噪,以保证得到的深度值具有较好的精度。
为了得到聚类后的图像块,在一种可选的实施例中,S105可以包括:
将第一图像的图像块的移动量,确定为第一图像的图像块的像素点的移动量;
利用第一图像的像素点对应的深度值,第一图像的像素点的移动量和第一图像的像素点的位置信息分别乘以对应的权重值,组成第一图像的数组;
按照预设的聚类算法,对第一图像的数组进行聚类,生成聚类后的图像块。
首先,所得到的第一图像的图像块的移动量也就是第一图像的图像块中像素点的移动量,针对第一图像的每个像素点来说,将像素点的对应的深度值,像素点的移动量和像素点的位置坐标乘以对应的权重值,可以组成一个数组,即第一图像的数组。
这里,采用预设的聚类算法对第一图像的数组进行聚类,其中,预设的聚类算法可以为均值漂移算法(Mean-Shift Clustering),还可以为K均值聚类算法(K-means clustering algorithm),这里,本申请实施例对此不作具体限定。
如此,可以生成聚类后的图像块。
进一步地,为了得到聚类后的图像块,在一种可选的实施例中,按照预设的聚类算法,对第一图像的数组进行聚类,生成聚类后的图像块,包括:
按照预设的聚类算法,对第一图像的数组进行聚类,得到初始聚类图像块;
从初始聚类图像块中选取出像素点的个数小于第一预设阈值的图像块;
对选取出的图像块重新进行归类,得到聚类后的图像块。
采用预设的聚类算法进行聚类之后,可以得到初始聚类图像块,由于在初始聚类图像块中有可能存在一些像素点的个数很少的图像块,这些图像块没有参考意义,所以需要将该类图像块的类别舍弃。
具体来说,预先设置有第一预设阈值,从初始聚类图像块中,将像素点的个数小于第一预设阈值的图像块选取出来,舍弃该类别并重新进行归类。
为了对像素点的个数小于第一预设阈值的图像块的类别重新进行归类,在一种可选的实施例中,对选取出的图像块重新进行归类,得到聚类后的图像块,包括:
从初始聚类图像块中确定出与选取出的图像块距离最近的图像块;
将选取出的图像块的类别归于,与选取出的图像块距离最近的图像块中,以得到聚类后的图像块。
需要说明的是,在聚类后的图像块中,每个类图像块之间均存在距离,这里,将选取出来的图像块的类别归于与之距离最近的图像块,这样,舍弃掉像素点的个数较少的类别,以得到聚类后的图像块。
S106:当聚类后的图像块满足预设条件时,根据第一图像的图像块的移动量,对第一图像的图像块进行移动,得到配准图像。
这里,对聚类后的图像块进行判断,判断聚类后的图像块是否满足预设条件,只有当聚类后的图像块满足预设条件时,说明计算得到的第一图像的图像块的移动量的精确度符号要求,所以,此时根据第一图像的图像块的移动量来移动第一图像的图像块,进而得到最终的配准图像。
针对聚类后的图像块不满足预设条件来说,在一种可选的实施例中,上述图像的配准方法还可以包括:
当聚类后的图像块不满足预设条件时,将聚类后的图像块确定为第一图像的图像块以更新第一图像的图像块,返回执行根据第一图像的图像块的像素值,调用预设的图像块的相似度算法,从第二图像中确定出第一图像的图像块的相似图像块。
也就是说,当聚类后的图像块不满足预设条件时,说明计算得到的第一图像的图像块的移动量的精确度不够,需要重新计算第一图像的图像块的移动量,此时,将聚类后的图像块的确定为第一图像的图像块,这样,来更新第一图像的分块方式,然后再去执行S103至S106,直至得到的聚类后的图像块满足预设条件,以得到精准度较高的配准图像。
针对上述预设条件,在一种可选的实施例中,聚类后的图像块满足预设条件,包括:
确定与聚类后的图像块一一对应的第一图像的图像块,将聚类后的图像块与对应的第一图像的图像块进行比较,确定聚类后的图像块中发生变化的像素点的个数;
当发生变化的像素点的个数与第一图像的尺寸之间的比值小于第二预设阈值时,聚类后的图像块满足预设条件。
在一种可选的实施例中,聚类后的图像块不满足预设条件,包括:
当发生变化的像素点的个数与第一图像的尺寸之间的比值大于等于所述第二预设阈值时,聚类后的图像块不满足所述预设条件。
具体来说,首先,将聚类后的图像块与第一图像的图像块一一对应起来,具体来说,针对聚类后的第一块图像块,在第一图像的图像块中寻找与第一块图像块相比发生变化像素点的个数最少的图像块,将两者对应起来,然后,针对第二块图像块,在剩余的第一图像的图像块中寻找与第二块图像块相比发生变化像素点的个数最少的图像块,将两者对应起来,依次类推,确定出与聚类后的图像块一一对应的第一图像的图像块,然后在比较得到聚类后的图像块中发生变化的像素点的个数,例如,针对聚类后的图像块中的一个图像块来说,从第一图像的图像块中找到与之对应的图像块,然后判断聚类后的图像块中消失的像素点和新增的像素点,即发生变化的像素点,这样可以统计出发生变化的像素点的个数。
再计算发生变化的像素点的个数与第一图像的尺寸之间的比值,比较比值与第二预设阈值时间的关系,只有在比值小于第二预设阈值时,才确定聚类后的图像块满足预设条件,可以采用计算得到的第一图像的图像块的移动量来移动第一图像以得到配准图像;否则确定聚类后的图像块不满足预设条件,用聚类后的图像块更新第一图像的图像块,这样来更新分块方式,从而重新确定第一图像的图像块的移动量,直至得到聚类后的图像块满足预设条件,以得到更加精准的配准图像。
在得到配准图像之后,可能存在重叠像素点和空置像素点,在一种可选的实施例中,在S106之后,该方法还可以包括:
当配准图像中存在重叠像素点时,从重叠像素点对应的第一图像的像素值中选取出一个像素值,将选取出的像素值确定为重叠像素点的像素值。
当配准图像中存在重叠像素点,也就是说,第一图像经过移动之后,有些像素点移动到了同一位置的像素点上,这样,使得配准图像中重叠像素点存在不止一个像素值,为了为重叠像素点确定出像素值,可以从重叠像素点对应的第一图像的像素值中任意选取一个像素值作为重叠像素点的像素值,也可以按照预先设置的方式从重叠像素点对应的第一图像的像素值中选取一个像素值作为重叠像素点的像素值,当然,还可以通过一些预设的算法来计算得到重叠像素点的像素值,这里,本申请实施例对此不作具体限定。
为了确定出重叠像素点的像素值,在一种可选的实施例中,从重叠像素点对应的第一图像的像素值中选取出一个像素值,将选取出的像素值确定为重叠像素点的像素值,包括:
获取重叠像素点对应的至少两个像素值;
分别确定至少两个像素值与重叠像素点对应的第二图像的像素值之间的差值;
根据至少两个像素值与重叠像素点对应的第二图像的像素值之间的差值的绝对值 之间的关系,确定重叠像素点的像素值。
具体来说,先获取重叠像素点对应的至少两个像素值,然后计算每个像素值与重叠像素点对应的第二图像的像素值之间的差值,并计算绝对值,最后,在根据至少两个像素值与重叠像素点对应的第二图像的像素值之间的差值的绝对值之间的关系,确定重叠像素点的像素值,例如,将绝对值较小的像素值确定为重叠像素值。
针对空置像素点来说,在一种可选的实施例中,在S106之后,该方法还可以包括:
当配准图像中存在空置像素点时,根据空置像素点的相邻像素点的像素值,采用预设算法,确定出空置像素点的像素值;
其中,空置像素点是指像素值不存在的像素点。
当配准图像中存在空置像素点,也就是说,在配准图像中存在像素值不存在的像素点,为了得到空置像素点的像素值,这里,可以先获取空置像素点的相邻像素点,可以根据预设的插值算法,或者全局移动模型计算出空置像素点的像素值,从而得到更加准确完整的配准图像。
下面举实例来对上述一个或多个实施例中所述的图像的配准方法进行说明。
图3为本申请实施例提供的一种可选的图像的配准方法的实例的流程示意图,如图3所示,该图像的配准方法可以包括:
S301:修正深度信息,并匹配深度信息和图像信息;
具体来说,由终端的拍摄设备拍摄得到2张或2张以上的图像(视频)和深度图(深度信息,相当于上述深度值),这里将2张图像进行配准时,一张图像作为待配准图像,另一张图像作为基准图像,经过配准后的图像就是配准图像。
在获取到待配准图像和基准图像之后,就可以获知待配准图像的图像信息和深度信息,其中,图像信息可以为RGB值,可以为灰度信息,这里,以灰度信息为例。
由于深度信息可能是点阵或者深度图,要对深度信息做一个预处理和修正,如果是点阵图,需要通过三角形平面重建的方式恢复物体表面信息,并且做平滑和插值处理;如果是深度图,需要对坏点检测并且去噪,保证得到的深度信息拥有良好的精度。
在修正深度信息以后,需要对深度图和灰度信息进行匹配,由于深度信息往往不像灰度信息那样拥有较高的分辨率,需要对深度信息进行升采样后匹配;如果深度信息和灰度信息是没有校准标定过的,需要对其进行校准和标定来保证匹配精度,在升采样的时候,可以通过引导滤波等方式来保证边缘精度,完成匹配后,可以得到全图像素的深度信息。
S302:对待配准图像进行分块;
得到每个像素点的深度信息以后,需要对待配准图像进行分块,第一次分块可以将待配准图像分成普通的矩形块,可给定适当的图像块尺寸,均匀分布图像块到全图,图像块的大小尺寸在算法进行中并不固定,图4为本申请实施例提供的一种可选的对待配准图像进行分块的流程示意图,如图4所示,在得到待配准图像和基准图像之后,先对待配准图像进行分块,这里按照一个固定的尺寸来对待配准图像进行分块,得到待配准图像的图像块,图4中箭头指向的图像为分块后的待配准图像,可以看出,将待配准图像分块呈若干个矩形块。
S303:搜索基准图像,找到与该块内容最相近的图像块得到图像块的移动量;
逐一选定待配准图像上的图像块,移动基准图像上同位置同样大小的图像块进行搜索,图5为本申请实施例中提供的一种可选的对基准图像进行搜索的结构示意图,如图5所示,在搜索窗口中对当前宏区块进行搜索,即在搜索窗口中对输入的基准图像进行搜索,直到找到与待配准图像块内容最相近的图像块,图像块相似性的评价可以采用SAD的方法,如果待配准图像和基准图像的整体灰度信息相差较大,也可以采用NCC 指标来评价图像块的相似性。
另外,完成搜索后,将待配准图像的图像块和与其相似的基准图像块的位置差作为待配准图像块的移动量,图6a为本申请实施例提供的一种可选的待配准图像的结构示意图,图6b为本申请实施例提供的一种可选的基准图像的结构示意图,如图6a和图6b所示,在图6a中,针对待配准图像中的一个图像块来说,该图像块的位置坐标为(x1,y1),该图像块的相似图像块(在基准图像中)的位置如图6b所示,位置坐标为(x2,y2),那么这样可以得到该图像块的移动量mv:
mv=[x1-x2,y1-y2]              (1)
由于图像块之间没有重叠,所以可以将该移动量作为图像块内所有像素点的移动量,这样就得到了待配准图像所有像素点的移动量。
S304:修正图像块的移动量;
由于块搜索的方式粒度较低,这样得到的像素点的移动量精度较低,会对所有像素点的移动量做进一步的修正和精炼。
图7a为本申请实施例提供的另一种可选的待配准图像的结构示意图,如图7a所示,对于某一像素点A,获取该像素点的位置P和像素值BV,对距离该像素点A为中心,半径r以内的像素点的移动量进行采样,采样得到N个不同的移动量mv 0~mv N-1,按这些移动量移动该像素点A,得到新位置P+mv,图7b为本申请实施例提供的另一种可选的基准图像的结构示意图,如图7b所示,获取基准图像在新位置(图中BCD位置)的像素值RV 0~RV N-1,图7c为本申请实施例提供的再一种可选的基准图像的结构示意图,如图7c所示,计算像素值差diff=|RV-BV|,根据像素值差对N个不同的移动量mv 0~mv N-1进行加权求和得到新的mv。
S305:整合位置信息、移动量和深度信息并重新聚类,得到新的图像块;
经过上述方法,得到所有像素点的深度信息d、移动量[mv x,mv y]和位置信息[x,y],对所有数据进行正规化处理,并且对每种数据乘以权重w,重新得到高维数组[x*w 1,y*w 2,mv x*w 3,mv y*w 4,d*w 5],对该数组进行聚类处理,聚类方法可选均值漂移算法,也可事先指定类的数量利用K均值聚类算法进行聚类,图8a为本申请实施例提供的一种可选的待配准图像的图像块的结构示意图,图8b为本申请实施例提供的一种可选的聚类后的图像块的结构示意图,如图8a和图8b所示,把聚成一类的像素重新定义成新的图像块(如图8b),对于完成聚类后的所有类,定义阈值thresh2,如果该类的像素个数小于thresh2,抛弃该类,将该类的像素重归为距离该像素最近的其他类。
S306:判断是否收敛,若收敛执行S307,若不收敛,返回执行S303;
将得到的新图像块和旧图像块进行比较,统计像素点变化的个数,采用计数器进行计数,首先,计数器归0,对于旧图像块内部的每个像素点,如果它不属于新的图像块,就对计数器加1,这样统计完旧图像块内的全部像素后,得到变化像素的个数m,如果旧图像块尺寸为n,可以得到像素变化的比例m/n,设定阈值thresh1,如果该比例小于thresh1,则判定算法收敛,得到全图像素的移动量,执行S307,否则继续算法,如果判定不收敛,根据得到的新图像块按S303的方式再次进行搜索。
S307:重配图像得到配准图像。
根据上述方法,得到了所有像素点的移动量,按照所有像素点的移动量移动像素点,得到配准后的图像即配准图像,移动后的图像可能会有重叠,图9a为本申请实施例提供的一种可选的配准图像的重叠像素点的结构示意图,如图9a所示,两个以上像素经过移动到了同一位置,图9b为本申请实施例提供的一种可选的配准图像的空置像素点的结构示意图,如图9b所示,配准图像存在空洞,即没有像素移动到该位置,对于重叠的情况,如图9a所示,比如像素值为P1和P2的两个像素经移动后到了同一位置, 获取基准图像该位置的像素值P ref,计算像素值差,如果|P1-Pref|<|P2-Pref|,则将配准图像该位置的像素值设为P1,反之则为P2。对于空洞(相当于空置像素点)的情况,可以采用插值的方法对该处像素进行填补,或者计算全局移动模型(如affine矩阵或者homography矩阵)对该空洞的像素值进行计算。
通过上述实例可知,利用深度信息辅助配准,比只用图像信息精度更高,对于运动物体不采用模型预估(局部运动物体的运动模型很难用单一模型匹配),而是计算单一像素点的流动,对运动物体区域的配准更佳精确,搜索采用不规则块搜索,对于拥有不规则边缘的物体匹配更佳精确。
也就是说,本申请实施例采用类似于稠密光流估计的方法,给出所有像素点的运动估计并重配图像,不依赖于单一运动模型,并且在搜索中引入了场景深度信息和不规则形状的块匹配,对于复杂运动场景的适配性较强。
本申请实施例提供了一种图像的配准方法,获取第一图像和第二图像,对第一图像进行分块,得到第一图像的图像块,根据第一图像的图像块的像素值,调用预设的图像块的相似度算法,从第二图像中确定出第一图像的图像块的相似图像块,根据第一图像的图像块的位置信息与第一图像的图像块的相似图像块的位置信息,计算得到第一图像的图像块的移动量,根据第一图像的深度值,第一图像的图像块的移动量和第一图像的位置信息,对第一图像进行聚类,生成聚类后的图像块,当聚类后的图像块满足预设条件时,根据第一图像的图像块的移动量,对第一图像的图像块进行移动,得到配准图像;也就是说,在本申请实施例中,通过在第二图像中寻找与第一图像的图像块相似的图像块,以此来计算得到第一图像的图像块的移动量,再采用第一图像的深度值,第一图像的图像块的移动量和第一图像的位置信息对第一图像进行聚类,从而生成聚类后的图像块,这样,在聚类后的图像块满足预设条件时,以第一图像的图像块的移动至来移动第一图像,从而得到配准图像,这样,在图像配准中将第一图像的深度信息考虑进去来形成聚类后的图像块,只有在聚类后的图像块满足预设条件时才根据第一图像的图像块的移动量移动得到配准图像,从而提高了配准图像的精度,进而使得的得到的配准图像的效果更佳。
实施例二
基于同一发明构思,本申请实施例提供了一种终端,图10为本申请实施例提供的一种可选的终端的结构示意图一,如图10所示,该终端可以包括:获取模块101,分块模块102,确定模块103,计算模块104,聚类模块105和移动模块106;其中,
获取模块101,配置为获取第一图像和第二图像;
分块模块102,配置为对第一图像进行分块,得到第一图像的图像块;
确定模块103,配置为根据第一图像的图像块的像素值,调用预设的图像块的相似度算法,从第二图像中确定出第一图像的图像块的相似图像块;
计算模块104,配置为根据第一图像的图像块的位置信息与第一图像的图像块的相似图像块的位置信息,计算第一图像的图像块的移动量;
聚类模块105,配置为根据第一图像的深度值,第一图像的图像块的移动量和第一图像的位置信息,对第一图像进行聚类,生成聚类后的图像块;
移动模块106,配置为当聚类后的图像块满足预设条件时,根据第一图像的图像块的移动量,对第一图像的图像块进行移动,得到配准图像。
在一种可选的实施例中,该终端还配置为:
当聚类后的图像块不满足预设条件时,将聚类后的图像块确定为第一图像的图像块以更新第一图像的图像块,返回执行根据第一图像的图像块的像素值,调用预设的图像块的相似度算法,从第二图像中确定出第一图像的图像块的相似图像块。
在一种可选的实施例中,当第一图像的像素值的分辨率与第一图像的深度值的分辨率不同时,相应地,该终端还配置为:
在根据第一图像的深度值,第一图像的图像块的移动量和第一图像的位置信息,对第一图像进行聚类,生成聚类后的图像块之前,根据第一图像的像素值的分辨率,对第一图像的深度值的分辨率进行缩放处理,得到第一图像处理后的深度值;
相应地,聚类模块105具体配置为:
根据第一图像处理后的深度值,第一图像的图像块的移动量和第一图像的位置信息,对第一图像进行聚类,生成聚类后的图像块。
在一种可选的实施例中,计算模块104,具体配置为:
将第一图像的图像块的横纵坐标与第一图像的图像块的相似图像块的横纵坐标之间的差值,确定为第一图像的图像块的像素点的初始移动量;
对第一图像的图像块的像素点的初始移动量进行修正,得到第一图像的图像块的移动量。
在一种可选的实施例中,计算模块104对第一图像的图像块的像素点的初始移动量进行修正,得到第一图像的图像块的移动量中,包括:
以第一图像的图像块内任意一个选定的像素点的位置信息为基准,从第一图像的预设范围内进行采样,得到预设数目的像素点;
根据预设数目的像素点的初始移动量,对选定的像素点的位置信息进行移动,生成移动后的像素点;
从第二图像中获取与移动后的像素点同位置的像素点的像素值;
根据同位置的像素点的像素值,为移动后的像素点确定权重;
根据移动后的像素点的权重,对移动后的像素点的初始移动量进行加权求和,得到第一图像的图像块的移动量。
在一种可选的实施例中,计算模块104根据同位置的像素点的像素值,为移动后的像素点确定权重中,包括:
计算同位置的像素点的像素值与选定的像素点的像素值之间的差值的绝对值;
将同位置的像素点的像素值与选定的像素点的像素值之间的差值的绝对值对应的权重,确定为移动后的像素点的权重。
在一种可选的实施例中,聚类模块105,具体配置为:
将第一图像的图像块的移动量,确定为第一图像的图像块的像素点的移动量;
利用第一图像的像素点对应的深度值,第一图像的像素点的移动量和第一图像的像素点的位置信息分别乘以对应的权重值,组成第一图像的数组;
按照预设的聚类算法,对第一图像的数组进行聚类,生成聚类后的图像块。
在一种可选的实施例中,聚类模块105按照预设的聚类算法,对第一图像的数组进行聚类,生成聚类后的图像块中,包括::
按照预设的聚类算法,对第一图像的数组进行聚类,得到初始聚类图像块;
从初始聚类图像块中选取出像素点的个数小于第一预设阈值的图像块;
对选取出的图像块重新进行归类,得到聚类后的图像块。
在一种可选的实施例中,聚类模块105对选取出的图像块重新进行归类,得到聚类后的图像块中,包括:
从初始聚类图像块中确定出与选取出的图像块距离最近的图像块;
将选取出的图像块的类别归于,与选取出的图像块距离最近的图像块中,以得到聚类后的图像块。
在一种可选的实施例中,聚类后的图像块满足预设条件,包括:
确定与聚类后的图像块一一对应的第一图像的图像块,将聚类后的图像块与对应的第一图像的图像块进行比较,确定聚类后的图像块中发生变化的像素点的个数;
当发生变化的像素点的个数与第一图像的尺寸之间的比值小于第二预设阈值时,聚类后的图像块满足预设条件。
在一种可选的实施例中,聚类后的图像块不满足预设条件,包括:
当发生变化的像素点的个数与第一图像的尺寸之间的比值大于等于第二预设阈值时,聚类后的图像块不满足预设条件。
在一种可选的实施例中,该终端还配置为:
在当聚类后的图像块满足预设条件时,根据第一图像的图像块的移动量,对第一图像的图像块进行移动,得到配准图像之后,当配准图像中存在重叠像素点时,从重叠像素点对应的第一图像的像素值中选取出一个像素值,将选取出的像素值确定为叠像素点的像素值。
在一种可选的实施例中,终端从重叠像素点对应的第一图像的像素值中选取出一个像素值,将选取出的像素值确定为重叠像素点的像素值中,包括:
获取重叠像素点对应的至少两个像素值;
分别确定至少两个像素值与重叠像素点对应的第二图像的像素值之间的差值;
根据至少两个像素值与重叠像素点对应的第二图像的像素值之间的差值的绝对值之间的关系,确定重叠像素点的像素值。
在一种可选的实施例中,该终端还配置为:
在当聚类后的图像块满足预设条件时,根据第一图像的图像块的移动量,对第一图像的图像块进行移动,得到配准图像之后,当配准图像中存在空置像素点时,根据空置像素点的相邻像素点的像素值,采用预设算法,确定出空置像素点的像素值;
其中,空置像素点是指像素值不存在的像素点。
在实际应用中,上述获取模块101、分块模块102、确定模块103、计算模块104、聚类模块105和移动模块106可由位于终端上的处理器实现,具体为中央处理器(CPU,Central Processing Unit)、微处理器(MPU,Microprocessor Unit)、数字信号处理器(DSP,Digital Signal Processing)或现场可编程门阵列(FPGA,Field Programmable Gate Array)等实现。
图11为本申请实施例提供的一种可选的终端的结构示意图二,如图11所示,本申请实施例提供了一种终端1100,包括:
处理器111以及存储有所述处理器111可执行指令的存储介质112,所述存储介质112通过通信总线113依赖所述处理器111执行操作,当所述指令被所述处理器111执行时,执行上述图像处理器执行的所述的图像的配准方法。
需要说明的是,实际应用时,终端中的各个组件通过通信总线113耦合在一起。可理解,通信总线113用于实现这些组件之间的连接通信。通信总线113除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。但是为了清楚说明起见,在图11中将各种总线都标为通信总线113。
本申请实施例提供了一种计算机存储介质,存储有可执行指令,当所述可执行指令被一个或多个处理器执行的时候,所述处理器执行上述一个或多个实施例中终端所执行的图像的配准方法。
可以理解,本申请实施例中的存储器可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(Read-Only Memory,ROM)、可编程只读存储器(Programmable ROM,PROM)、可擦除可编程只读存储器(Erasable PROM,EPROM)、电可擦除可编程只读存储器 (Electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(Random Access Memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(Static RAM,SRAM)、动态随机存取存储器(Dynamic RAM,DRAM)、同步动态随机存取存储器(Synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(Double Data Rate SDRAM,DDRSDRAM)、增强型同步动态随机存取存储器(Enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(Synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(Direct Rambus RAM,DRRAM)。本文描述的系统和方法的存储器旨在包括但不限于这些和任意其它适合类型的存储器。
而处理器可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器可以是通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器,处理器读取存储器中的信息,结合其硬件完成上述方法的步骤。
可以理解的是,本文描述的这些实施例可以用硬件、软件、固件、中间件、微码或其组合来实现。对于硬件实现,处理单元可以实现在一个或多个专用集成电路(Application Specific Integrated Circuits,ASIC)、数字信号处理器(Digital Signal Processing,DSP)、数字信号处理设备(DSP Device,DSPD)、可编程逻辑设备(Programmable Logic Device,PLD)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、通用处理器、控制器、微控制器、微处理器、用于执行本申请所述功能的其它电子单元或其组合中。
对于软件实现,可通过执行本文所述功能的模块(例如过程、函数等)来实现本文所述的技术。软件代码可存储在存储器中并通过处理器执行。存储器可以在处理器中或在处理器外部实现。
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端(可以是手机、计算机、服务器、或者网络设备等)执行本申请各个实施例所述的方法。
上面结合附图对本申请的实施例进行了描述,但是本申请并不局限于上述的具体实 施方式,上述的具体实施方式仅仅是示意性的,而不是限制性的,本领域的普通技术人员在本申请的启示下,在不脱离本申请宗旨和权利要求所保护的范围情况下,还可做出很多形式,这些均属于本申请的保护之内。
工业实用性
本申请实施例提供了一种图像的配准方法、终端以及计算机存储介质,获取第一图像和第二图像,对第一图像进行分块,得到第一图像的图像块,根据第一图像的图像块的像素值,调用预设的图像块的相似度算法,从第二图像中确定出第一图像的图像块的相似图像块,根据第一图像的图像块的位置信息与第一图像的图像块的相似图像块的位置信息,计算得到第一图像的图像块的移动量,根据第一图像的深度值,第一图像的图像块的移动量和第一图像的位置信息,对第一图像进行聚类,生成聚类后的图像块,当聚类后的图像块满足预设条件时,根据第一图像的图像块的移动量,对第一图像的图像块进行移动,得到配准图像,能够提高图像配准的精确度。

Claims (17)

  1. 一种图像的配准方法,其中,包括:
    获取第一图像和第二图像;
    对所述第一图像进行分块,得到所述第一图像的图像块;
    根据所述第一图像的图像块的像素值,调用预设的图像块的相似度算法,从所述第二图像中确定出所述第一图像的图像块的相似图像块;
    根据所述第一图像的图像块的位置信息与所述第一图像的图像块的相似图像块的位置信息,计算得到所述第一图像的图像块的移动量;
    根据所述第一图像的深度值,所述第一图像的图像块的移动量和所述第一图像的位置信息,对所述第一图像进行聚类,生成聚类后的图像块;
    当聚类后的图像块满足预设条件时,根据所述第一图像的图像块的移动量,对所述第一图像的图像块进行移动,得到配准图像。
  2. 根据权利要求1所述的方法,其中,所述方法还包括:
    当聚类后的图像块不满足所述预设条件时,将聚类后的图像块确定为所述第一图像的图像块以更新所述第一图像的图像块,返回执行所述根据所述第一图像的图像块的像素值,调用预设的图像块的相似度算法,从所述第二图像中确定出所述第一图像的图像块的相似图像块。
  3. 根据权利要求1所述的方法,其中,当所述第一图像的像素值的分辨率与所述第一图像的深度值的分辨率不同时,相应地,在根据所述第一图像的深度值,所述第一图像的图像块的移动量和所述第一图像的位置信息,对所述第一图像进行聚类,生成聚类后的图像块之前,所述方法还包括:
    根据所述第一图像的像素值的分辨率,对所述第一图像的深度值的分辨率进行缩放处理,得到所述第一图像处理后的深度值;
    相应地,所述根据所述第一图像的深度值,所述第一图像的图像块的移动量和所述第一图像的位置信息,对所述第一图像进行聚类,生成聚类后的图像块,包括:
    根据所述第一图像处理后的深度值,所述第一图像的图像块的移动量和所述第一图像的位置信息,对所述第一图像进行聚类,生成聚类后的图像块。
  4. 根据权利要求1所述的方法,其中,所述根据所述第一图像的图像块的位置信息与所述第一图像的图像块的相似图像块的位置信息,计算得到所述第一图像的图像块的移动量,包括:
    将所述第一图像的图像块的横纵坐标与所述第一图像的图像块的相似图像块的横纵坐标之间的差值,确定为所述第一图像的图像块的像素点的初始移动量;
    对所述第一图像的图像块的像素点的初始移动量进行修正,得到所述第一图像的图像块的移动量。
  5. 根据权利要求4所述的方法,其中,所述对所述第一图像的图像块的像素点的初始移动量进行修正,得到所述第一图像的图像块的移动量,包括:
    以所述第一图像的图像块内任意一个选定的像素点的位置信息为基准,从所述第一图像的预设范围内进行采样,得到预设数目的像素点;
    根据所述预设数目的像素点的初始移动量,对所述选定的像素点的位置信息进行移动,生成移动后的像素点;
    从所述第二图像中获取与移动后的像素点同位置的像素点的像素值;
    根据同位置的像素点的像素值,为移动后的像素点确定权重;
    根据移动后的像素点的权重,对移动后的像素点的初始移动量进行加权求和,得到所述第一图像的图像块的移动量。
  6. 根据权利要求5所述的方法,其中,所述根据同位置的像素点的像素值,为移动后的像素点确定权重,包括:
    计算同位置的像素点的像素值与所述选定的像素点的像素值之间的差值的绝对值;
    将同位置的像素点的像素值与所述选定的像素点的像素值之间的差值的绝对值对应的权重,确定为移动后的像素点的权重。
  7. 根据权利要求1所述的方法,其中,所述根据所述第一图像的深度值,所述第一图像的图像块的移动量和所述第一图像的位置信息,对所述第一图像进行聚类,生成聚类后的图像块,包括:
    将所述第一图像的图像块的移动量,确定为所述第一图像的图像块的像素点的移动量;
    利用所述第一图像的像素点对应的深度值,所述第一图像的像素点的移动量和所述第一图像的像素点的位置信息分别乘以对应的权重值,组成所述第一图像的数组;
    按照预设的聚类算法,对所述第一图像的数组进行聚类,生成聚类后的图像块。
  8. 根据权利要求7所述的方法,其中,所述按照预设的聚类算法,对所述第一图像的数组进行聚类,生成聚类后的图像块,包括:
    按照预设的聚类算法,对所述第一图像的数组进行聚类,得到初始聚类图像块;
    从所述初始聚类图像块中选取出像素点的个数小于第一预设阈值的图像块;
    对选取出的图像块重新进行归类,得到聚类后的图像块。
  9. 根据权利要求8所述的方法,其中,所述对选取出的图像块重新进行归类,得到聚类后的图像块,包括:
    从所述初始聚类图像块中确定出与选取出的图像块距离最近的图像块;
    将选取出的图像块的类别归于,与选取出的图像块距离最近的图像块中,以得到聚类后的图像块。
  10. 根据权利要求1或2所述的方法,其中,所述聚类后的图像块满足预设条件,包括:
    确定与聚类后的图像块一一对应的所述第一图像的图像块,将聚类后的图像块与对应的所述第一图像的图像块进行比较,确定聚类后的图像块中发生变化的像素点的个数;
    当发生变化的像素点的个数与所述第一图像的尺寸之间的比值小于第二预设阈值时,聚类后的图像块满足所述预设条件。
  11. 根据权利要求10所述的方法,其中,所述聚类后的图像块不满足所述预设条件,包括:
    当发生变化的像素点的个数与所述第一图像的尺寸之间的比值大于等于所述第二预设阈值时,聚类后的图像块不满足所述预设条件。
  12. 根据权利要求1所述的方法,其中,在当聚类后的图像块满足预设条件时,根据所述第一图像的图像块的移动量,对所述第一图像的图像块进行移动,得到配准图像之后,所述方法还包括:
    当所述配准图像中存在重叠像素点时,从所述重叠像素点对应的第一图像的像素值中选取出一个像素值,将选取出的像素值确定为所述重叠像素点的像素值。
  13. 根据权利要求12所述的方法,其中,所述从所述重叠像素点对应的第一图像的像素值中选取出一个像素值,将选取出的像素值确定为所述重叠像素点的像素值,包括:
    获取所述重叠像素点对应的至少两个像素值;
    分别确定至少两个像素值与所述重叠像素点对应的第二图像的像素值之间的差值;
    根据至少两个像素值与所述重叠像素点对应的第二图像的像素值之间的差值的绝对值之间的关系,确定所述重叠像素点的像素值。
  14. 根据权利要求1所述的方法,其中,在当聚类后的图像块满足预设条件时,根据所述第一图像的图像块的移动量,对所述第一图像的图像块进行移动,得到配准图像之后,所述方法还包括:
    当所述配准图像中存在空置像素点时,根据所述空置像素点的相邻像素点的像素值,采用预设算法,确定出所述空置像素点的像素值;
    其中,所述空置像素点是指像素值不存在的像素点。
  15. 一种终端,其中,包括:
    获取模块,配置为获取第一图像和第二图像;
    分块模块,配置为对所述第一图像进行分块,得到所述第一图像的图像块;
    确定模块,配置为根据所述第一图像的图像块的像素值,调用预设的图像块的相似度算法,从所述第二图像中确定出所述第一图像的图像块的相似图像块;
    计算模块,配置为根据所述第一图像的图像块的位置信息与所述第一图像的图像块的相似图像块的位置信息,计算所述第一图像的图像块的移动量;
    聚类模块,配置为根据所述第一图像的深度值,所述第一图像的图像块的移动量和所述第一图像的位置信息,对所述第一图像进行聚类,生成聚类后的图像块;
    移动模块,配置为当聚类后的图像块满足预设条件时,根据所述第一图像的图像块的移动量,对所述第一图像的图像块进行移动,得到配准图像。
  16. 一种终端,其中,包括:
    处理器以及存储有所述处理器可执行指令的存储介质,所述存储介质通过通信总线依赖所述处理器执行操作,当所述指令被所述处理器执行时,执行上述的权利要求1至14任一项所述的图像的配准方法。
  17. 一种计算机可读存储介质,其中,存储有可执行指令,当所述可执行指令被一个或多个处理器执行的时候,所述处理器执行所述权利要求1至14任一项所述的图像的配准方法。
PCT/CN2019/118049 2019-11-13 2019-11-13 图像的配准方法、终端以及计算机存储介质 WO2021092797A1 (zh)

Priority Applications (3)

Application Number Priority Date Filing Date Title
PCT/CN2019/118049 WO2021092797A1 (zh) 2019-11-13 2019-11-13 图像的配准方法、终端以及计算机存储介质
CN201980101531.0A CN114586059A (zh) 2019-11-13 2019-11-13 图像的配准方法、终端以及计算机存储介质
US17/742,825 US20220270204A1 (en) 2019-11-13 2022-05-12 Image registration method, terminal, and computer storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/118049 WO2021092797A1 (zh) 2019-11-13 2019-11-13 图像的配准方法、终端以及计算机存储介质

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US17/742,825 Continuation US20220270204A1 (en) 2019-11-13 2022-05-12 Image registration method, terminal, and computer storage medium

Publications (1)

Publication Number Publication Date
WO2021092797A1 true WO2021092797A1 (zh) 2021-05-20

Family

ID=75911609

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/118049 WO2021092797A1 (zh) 2019-11-13 2019-11-13 图像的配准方法、终端以及计算机存储介质

Country Status (3)

Country Link
US (1) US20220270204A1 (zh)
CN (1) CN114586059A (zh)
WO (1) WO2021092797A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116523852A (zh) * 2023-04-13 2023-08-01 成都飞机工业(集团)有限责任公司 一种基于特征匹配的碳纤维复合材料的异物检测方法

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116152051B (zh) * 2023-02-27 2023-12-01 上海福柯斯智能科技有限公司 一种x射线图像的分块配准图像剪影方法和装置
CN116668709B (zh) * 2023-07-28 2023-10-17 天津卓朗昆仑云软件技术有限公司 图像传输方法、装置、服务端设备及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2007135659A2 (en) * 2006-05-23 2007-11-29 Elbit Systems Electro-Optics Elop Ltd. Clustering - based image registration
KR20140081481A (ko) * 2012-12-21 2014-07-01 서울시립대학교 산학협력단 블록단위 영상 정합을 이용한 초해상도 영상 복원 방법 및 장치
CN107437257A (zh) * 2017-08-08 2017-12-05 重庆信络威科技有限公司 一种移动背景下的运动物体检测与分割方法
CN108682025A (zh) * 2018-05-23 2018-10-19 沈阳东软医疗系统有限公司 一种图像配准方法及装置
CN109064504A (zh) * 2018-08-24 2018-12-21 深圳市商汤科技有限公司 图像处理方法、装置和计算机存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2007135659A2 (en) * 2006-05-23 2007-11-29 Elbit Systems Electro-Optics Elop Ltd. Clustering - based image registration
KR20140081481A (ko) * 2012-12-21 2014-07-01 서울시립대학교 산학협력단 블록단위 영상 정합을 이용한 초해상도 영상 복원 방법 및 장치
CN107437257A (zh) * 2017-08-08 2017-12-05 重庆信络威科技有限公司 一种移动背景下的运动物体检测与分割方法
CN108682025A (zh) * 2018-05-23 2018-10-19 沈阳东软医疗系统有限公司 一种图像配准方法及装置
CN109064504A (zh) * 2018-08-24 2018-12-21 深圳市商汤科技有限公司 图像处理方法、装置和计算机存储介质

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116523852A (zh) * 2023-04-13 2023-08-01 成都飞机工业(集团)有限责任公司 一种基于特征匹配的碳纤维复合材料的异物检测方法

Also Published As

Publication number Publication date
US20220270204A1 (en) 2022-08-25
CN114586059A (zh) 2022-06-03

Similar Documents

Publication Publication Date Title
US20240078646A1 (en) Image processing method, image processing apparatus, and non-transitory storage medium
WO2021092797A1 (zh) 图像的配准方法、终端以及计算机存储介质
CN109359602A (zh) 车道线检测方法和装置
CN110781756A (zh) 基于遥感图像的城市道路提取方法及装置
CN110232693B (zh) 一种结合热力图通道及改进U-Net的图像分割方法
CN113447923A (zh) 目标检测方法、装置、系统、电子设备及存储介质
CN113421305A (zh) 目标检测方法、装置、系统、电子设备及存储介质
US20220351413A1 (en) Target detection method, computer device and non-transitory readable storage medium
CN113744144A (zh) 遥感影像建筑物边界优化方法、系统、设备及存储介质
CN111563517B (zh) 图像处理方法、装置、电子设备及存储介质
CN114359932B (zh) 文本检测方法、文本识别方法及装置
CN114638862A (zh) 一种视觉跟踪方法及跟踪装置
CN113808033A (zh) 图像文档校正方法、系统、终端及介质
CN117291790A (zh) 一种sar图像配准方法、装置、设备及介质
CN112508832A (zh) 一种面向对象的遥感影像数据时空融合方法、系统及设备
CN116310832A (zh) 遥感图像处理方法、装置、设备、介质及产品
CN116630216A (zh) 基于雷达和影像的目标融合方法、装置、设备及存储介质
WO2022206679A1 (zh) 图像处理方法、装置、计算机设备和存储介质
CN113110418B (zh) 栅格地图优化方法、存储介质和移动机器人
CN114004839A (zh) 全景图像的图像分割方法、装置、计算机设备和存储介质
US11227166B2 (en) Method and device for evaluating images, operating assistance method, and operating device
CN117726666B (zh) 跨相机单目图片度量深度估计方法、装置、设备及介质
US11443521B2 (en) Method and device for evaluating images, operational assistance method and operating device
CN118097120A (zh) 基于示踪物识别的水流测速方法、装置、介质及电子设备
Wang et al. Salient object detection by optimizing robust background detection

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: 19952808

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: 19952808

Country of ref document: EP

Kind code of ref document: A1