Machine vision fusion splicing method and system
Through the Harris corner point extraction model and RANSAC algorithm, the geometric correspondence between images is established, the homography matrix is calculated for image deformation and fusion, which solves the problem of inaccurate feature matching when the image pixel intensities are similar, and improves the clarity of image splicing. .
Patent Information
- Application Number
- CN202410794407.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-19
- Publication Date
- 2024-09-10
AI Technical Summary
The existing technology cannot perform accurate feature matching when the image pixel intensities are similar, resulting in reduced image splicing clarity.
The Harris corner point extraction model is used to extract features from the input image, and the corner point measurement is obtained by calculating the autocorrelation matrix and Gaussian filtering. The threshold is set to select the local maximum point as the corner point, and is verified through the RANSAC algorithm to establish the geometric correspondence between the images. relations, calculating homography matrices for image deformation and fusion.
It improves the clarity of image splicing, maintains stability when the viewpoint changes through corner matching, and solves the problem of inaccurate feature matching when pixel intensities are similar.
Smart Images

Figure CN118628346A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a method and system for machine vision fusion and splicing. Background Art
[0002] Image stitching technology is to stitch together several overlapping images into a seamless panorama or high-resolution image. The images to be stitched can be obtained at different times, from different perspectives, or with different sensors. Currently, image stitching technology has been widely used in military and commercial fields.
[0003] Existing feature extraction directly obtains feature points through deep learning algorithms. When the pixel intensities of images are very similar, accurate feature matching cannot be performed, which will reduce the clarity of image stitching. Summary of the invention
[0004] The purpose of the present invention is to provide a method and system for machine vision fusion stitching, aiming to solve the problem that when the pixel intensities of images are very similar, accurate feature matching cannot be performed, which will reduce the clarity of image stitching.
[0005] To achieve the above object, in a first aspect, the present invention provides a method for machine vision fusion stitching, comprising the following steps:
[0006] Extract features from the input image based on machine vision algorithms to obtain feature points;
[0007] Performing image registration based on the feature points to establish a geometric correspondence between the images;
[0008] Calculate a homography matrix based on the geometric correspondence;
[0009] Image deformation and image fusion are performed based on the homography matrix to obtain a spliced image.
[0010] The step of extracting features from the input image based on a machine vision algorithm to obtain feature points includes:
[0011] Build machine vision algorithm models;
[0012] Inputting the input image into the machine vision algorithm model to extract corner points and obtain corner points;
[0013] The corner points are used to perform quantitative measurement to obtain feature points.
[0014] Wherein, the machine vision algorithm model includes a Harris corner point extraction model.
[0015] The step of inputting the input image into the machine vision algorithm model to extract features and obtain corner points includes:
[0016] Inputting the input image into the Harris corner point extraction model;
[0017] The Harris corner point extraction model calculates an autocorrelation matrix for each pixel point of an input image; performs Gaussian filtering on each pixel point of the input image to obtain a new autocorrelation matrix; calculates a corner point metric for each pixel point based on the autocorrelation matrix and the new autocorrelation matrix; selects a local maximum point from the corner point metric; and sets a threshold. If the local maximum point is higher than the threshold, it is a corner point.
[0018] Among them, the algorithms used in calculating the homography matrix based on the geometric correspondence include an algorithm that directly uses the pixel values of the image, an algorithm that processes in the frequency domain, an algorithm for low-level features, and an algorithm for high-level features.
[0019] Wherein, the algorithm that directly uses the pixel value of the image includes correlation methods;
[0020] The algorithm for processing in the frequency domain includes a method based on fast Fourier transform;
[0021] The algorithms for the low-level features include feature-based methods;
[0022] The algorithms for the high-level features include graph theory methods.
[0023] The step of performing image deformation and image fusion based on the homography matrix to obtain a spliced image includes:
[0024] Reprojecting each input image based on the homography matrix and placing it on the canvas;
[0025] The stitched image is obtained by changing the image grayscale at each input image boundary, removing the gaps, and creating a mixed image.
[0026] In a second aspect, the present invention provides a system for machine vision fusion and stitching, comprising a feature extraction module, an image registration module, a calculation module and a deformation fusion module, wherein the feature extraction module, the image registration module, the calculation module and the deformation fusion module are connected in sequence;
[0027] The feature extraction module is used to extract features from the input image to obtain feature points;
[0028] The image registration module performs image registration based on the feature points to establish a geometric correspondence between images;
[0029] The calculation module calculates a homography matrix based on the geometric correspondence;
[0030] The deformation and fusion module performs image deformation and image fusion based on the homography matrix to obtain a spliced image.
[0031] The present invention discloses a method for machine vision fusion and splicing, which extracts features from an input image to obtain feature points. Specifically, the input image is input into the Harris corner point extraction model; the Harris corner point extraction model calculates an autocorrelation matrix for each pixel of the input image; Gaussian filtering is performed on each pixel of the input image to obtain a new autocorrelation matrix; the corner point metric of each pixel is calculated based on the autocorrelation matrix and the new autocorrelation matrix; a local maximum point is selected from the corner point metric; a threshold is set, and if the local maximum point is higher than the threshold, it is a corner point; the corner point is used for quantitative measurement to obtain feature points. Image registration is performed based on the feature points to establish a geometric correspondence between images. A homography matrix is calculated based on the geometric correspondence; image deformation and image fusion are performed based on the homography matrix to obtain a spliced image. The present invention adopts corner point matching to perform quantitative measurement in order to provide better feature matching for image pairs in the above manner. Corner points are good matching characteristics. When the viewpoint changes, the corner point feature is stable, which solves the problem that when the pixel intensity of the image is very similar, accurate feature matching cannot be performed, which reduces the clarity of image splicing. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0033] Figure 1 The present invention provides a flowchart of a method for machine vision fusion and splicing.
[0034] Figure 2 This is a schematic diagram of pixel intensities that are very close when matching features.
[0035] Figure 3 It is a structural schematic diagram of a machine vision fusion and splicing system provided by the present invention.
[0036] 1-Feature extraction module, 2-Image registration module, 3-Calculation module, 4-Deformation fusion module. DETAILED DESCRIPTION
[0037] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present invention, and should not be construed as limiting the present invention.
[0038] See also Figure 1 to Figure 2 In a first aspect, the present invention provides a method for machine vision fusion stitching, comprising the following steps:
[0039] S1 performs feature extraction on the input image based on machine vision algorithm to obtain feature points;
[0040] Features are elements in the two input images to be matched, which are inside image patches. These image patches are groups of pixels in the image. Patch matching is performed on the input images. The specific explanation is as follows: Figure 2 As shown, fig1 and fig2 give a good patch match because there is a patch in fig2 that looks very similar to the patch in fig1. When we consider fig3 and fig4, the patches here do not match because there are many similar patches in fig4 that look very similar to the patches in fig3. Since the pixel intensities are very close, it is impossible to make an accurate feature match.
[0041] In order to provide better feature matching for image pairs, corner matching is used to perform quantitative measurement. Corners are good matching features. Corner features are stable when the viewpoint changes.
[0042] Specifically, a machine vision algorithm model is constructed; the input image is input into the machine vision algorithm model to extract corner points to obtain corner points.
[0043] The machine vision algorithm model includes a Harris corner point extraction model.
[0044] Harris corner detection algorithm:
[0045] Harris algorithm is a point feature extraction algorithm based on Moravec algorithm. In 1988, C.Harris and M.JStephens designed a local image detection window. By moving a small number of windows in different directions, the average change in intensity can be determined. We can easily identify corners by observing the intensity values in a small window. When moving the window, flat areas will not show intensity changes in all directions. The edge area will not change intensity along the edge direction. For corners, significant intensity changes occur in all directions. Harris corner detector gives a mathematical method for detecting flat areas, edges and corners. Harris detects more features with rotation invariance and scale variability. Intensity changes under displacement [u, v]:
[0046] E(u,v)= x,y w(x,y)[I(x+u,y+v)I(x,y)] 2
[0047] Where w(x, y) is the window function, I(x+u, y+v) is the intensity after the shift, and I(x, y) is the intensity at a single pixel location.
[0048] The step of inputting the input image into the machine vision algorithm model to extract features and obtain corner points comprises:
[0049] S101 inputs the input image into the Harris corner point extraction model;
[0050] S102 The Harris corner point extraction model calculates the autocorrelation matrix for each pixel point of the input image;
[0051] Specifically, the autocorrelation matrix M is calculated for each pixel (x, y) in the image:
[0052]
[0053] Among them I x , I y is the partial derivative of I(x, y).
[0054] S103 performs Gaussian filtering on each pixel of the input image to obtain a new autocorrelation matrix;
[0055] Specifically, a Gaussian filter is performed on each pixel in the image to obtain a new matrix M. The discrete two-dimensional zero-mean Gaussian function is
[0056] Gauss = exp(-u 2 +v 2 ) / 2δ 2.
[0057] S104 calculates the corner point metric of each pixel based on the autocorrelation matrix and the new autocorrelation matrix;
[0058] Specifically, the corner metric of each pixel (x, y) is calculated to obtain R = Det(M) - k*trace(M), where the range of k is 0.04k0.06.
[0059] S105 selects a local maximum point from the corner point metric;
[0060] Specifically, the Harris method considers that the feature point corresponds to the pixel value of the local maximum interest point.
[0061] S106 sets a threshold. If the local maximum point is higher than the threshold, it is a corner point.
[0062] Specifically, a threshold T is set to detect corner points. If the local maximum of R is higher than the threshold T, then this point is a corner point.
[0063] In addition, the RANSAC algorithm is used to verify the obtained corner points, eliminate the incorrectly matched corner points, and obtain the correct matching corner points. RANSAC is the abbreviation of "Random Sample Consensus", which was first proposed by Fischler and Bolles in 1981. It is an algorithm that iteratively estimates the parameters of a mathematical model from a set of data containing abnormal data to obtain valid data. RANSAC generally uses relatively few points to estimate the model, and then uses the remaining points to verify the model, which reduces the impact of abnormal data on model parameter estimation when there are serious error points.
[0064] Finally, the corner points are used for quantitative measurement to obtain feature points.
[0065] S2 performs image registration based on the feature points to establish a geometric correspondence between the images;
[0066] S3 calculates a homography matrix based on the geometric correspondence;
[0067] Specifically, the algorithms used in calculating the homography matrix based on the geometric correspondence include algorithms that directly use the pixel values of the image, algorithms that process in the frequency domain, algorithms for low-level features, and algorithms for high-level features. The algorithms that directly use the pixel values of the image include correlation methods; the algorithms that process in the frequency domain include methods based on fast Fourier transform (FFT-based); the algorithms for low-level features, which usually use edges and corners, include feature-based methods; the algorithms for high-level features, which usually use overlapping parts of image objects and feature relationships, include graph-theoretic methods.
[0068] S4 performs image deformation and image fusion based on the homography matrix to obtain a spliced image.
[0069] Specifically, each input image is reprojected based on the homography matrix and placed on a larger canvas; the grayscale of each input image boundary is changed to remove the gaps and create a mixed image to obtain a spliced image. Blend modes are used to blend two layers together.
[0070] Before step S1, feature extraction is performed on the input image based on a machine vision algorithm to obtain feature points, the method further includes:
[0071] The input image is sequentially encoded and then denoised.
[0072] The denoising process includes constructing a denoising network model, the backbone network of the denoising network model is an improved Noise to Noise network, and the improved Noise to Noise network includes: a downsampling part, a jump connection part and an upsampling part; wherein, the feature map size and the number of channels of the same stage of the downsampling part and the upsampling part are the same, and the downsampling part introduces a residual module to solve the gradient disappearance and network degradation, and the jump connection part introduces an attention mechanism to fuse the multi-scale feature maps of different levels extracted by the convolutional neural network.
[0073] The improved Noise to Noise network is trained and optimized by using a training data set with different levels of Gaussian random noise with a mean of zero, and a final model is obtained. Finally, the input images are input into the final model one by one based on the sequential coding to perform denoising, simplify the image data, and eliminate interference.
[0074] For the purpose of sequential coding, feature extraction can be performed on multiple input images in sequence based on the sequential coding during feature extraction, and the multiple input images can be processed one by one subsequently according to the sequential coding, so that the whole process proceeds in an orderly manner.
[0075] See also Figure 3 In a second aspect, the present invention provides a system for machine vision fusion and stitching, comprising a feature extraction module 1, an image registration module 2, a calculation module 3 and a deformation fusion module 4, wherein the feature extraction module 1, the image registration module 2, the calculation module 3 and the deformation fusion module 4 are connected in sequence;
[0076] The feature extraction module 1 is used to extract features from the input image to obtain feature points;
[0077] The image registration module 2 performs image registration based on the feature points to establish a geometric correspondence between images;
[0078] The calculation module 3 calculates a homography matrix based on the geometric correspondence;
[0079] The deformation and fusion module 4 performs image deformation and image fusion based on the homography matrix to obtain a spliced image.
[0080] Specifically, the feature extraction module 1 inputs the input image into the Harris corner extraction model; the Harris corner extraction model calculates the autocorrelation matrix for each pixel of the input image; performs Gaussian filtering on each pixel of the input image to obtain a new autocorrelation matrix; calculates the corner metric of each pixel based on the autocorrelation matrix and the new autocorrelation matrix; selects a local maximum point from the corner metric; sets a threshold, and if the local maximum point is higher than the threshold, it is a corner point; uses the corner point for quantitative measurement to obtain a feature point. The image registration module 2 performs image registration based on the feature points to establish a geometric correspondence between images. The calculation module 3 calculates the homography matrix based on the geometric correspondence; the deformation fusion module 4 performs image deformation and image fusion based on the homography matrix to obtain a spliced image. Corner points are good matching characteristics. When the viewpoint changes, the corner point feature is stable, which solves the problem that when the pixel intensity of the image is very similar, accurate feature matching cannot be performed, which will reduce the clarity of the image splicing.
[0081] What is disclosed above is only a preferred embodiment of a method and system for machine vision fusion and stitching of the present invention. Of course, this cannot be used to limit the scope of rights of the present invention. Ordinary technicians in this field can understand that all or part of the processes of the above embodiments and equivalent changes made according to the claims of the present invention still fall within the scope of the invention.
Claims
1. A method for machine vision fusion and splicing, It is characterized in that The following steps are involved: Extract features from the input image based on machine vision algorithms to obtain feature points; Performing image registration based on the feature points to establish a geometric correspondence between the images; Calculate a homography matrix based on the geometric correspondence; Image deformation and image fusion are performed based on the homography matrix to obtain a spliced image.
2. The method for machine vision fusion and splicing as claimed in claim 1, It is characterized in that The method of extracting features from the input image based on a machine vision algorithm to obtain feature points includes: Build machine vision algorithm models; Inputting the input image into the machine vision algorithm model to extract corner points and obtain corner points; The corner points are used to perform quantitative measurement to obtain feature points.
3. The method for machine vision fusion and splicing as claimed in claim 2, It is characterized in that The machine vision algorithm model includes a Harris corner point extraction model.
4. The method for machine vision fusion and splicing as claimed in claim 3, It is characterized in that The step of inputting the input image into the machine vision algorithm model to extract features and obtain corner points comprises: Inputting the input image into the Harris corner point extraction model; The Harris corner point extraction model calculates an autocorrelation matrix for each pixel point of an input image; performs Gaussian filtering on each pixel point of the input image to obtain a new autocorrelation matrix; calculates a corner point metric for each pixel point based on the autocorrelation matrix and the new autocorrelation matrix; selects a local maximum point from the corner point metric; and sets a threshold. If the local maximum point is higher than the threshold, it is a corner point.
5. The method for machine vision fusion and splicing as claimed in claim 4, It is characterized in that The algorithms used in calculating the homography matrix based on the geometric correspondence include an algorithm that directly uses pixel values of an image, an algorithm that processes in the frequency domain, an algorithm for low-level features, and an algorithm for high-level features.
6. The method for machine vision fusion and splicing as claimed in claim 5, It is characterized in that The algorithm directly using the pixel value of the image includes correlation methods; The algorithm for processing in the frequency domain includes a method based on fast Fourier transform; The algorithms for the low-level features include feature-based methods; The algorithms for the high-level features include graph theory methods.
7. The method for machine vision fusion and splicing as claimed in claim 6, It is characterized in that The step of performing image deformation and image fusion based on the homography matrix to obtain a spliced image includes: Reprojecting each input image based on the homography matrix and placing it on the canvas; The stitched image is obtained by changing the image grayscale at each input image boundary, removing the gaps, and creating a mixed image.
8. A machine vision fusion and splicing system, applied to the machine vision fusion and splicing method described in claim 1 , It is characterized in that It includes a feature extraction module, an image registration module, a calculation module and a deformation fusion module, wherein the feature extraction module, the image registration module, the calculation module and the deformation fusion module are connected in sequence; The feature extraction module is used to extract features from the input image to obtain feature points; The image registration module performs image registration based on the feature points to establish a geometric correspondence between images; The calculation module calculates a homography matrix based on the geometric correspondence; The deformation and fusion module performs image deformation and image fusion based on the homography matrix to obtain a spliced image.
