Linear array image adjacent sheet matching method
By downsampling and feature matching of images collected by the tunnel detection center array camera, combined with SURF and RANSAC algorithms, the deviation problem in image stitching is solved, the calculation efficiency and accuracy are improved, and efficient image matching and stitching is achieved.
Patent Information
- Application Number
- CN202411162815.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-23
- Publication Date
- 2024-11-01
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In tunnel detection, due to the slight deviation of the line array camera startup time, the image splicing has obvious splicing and displacement, which affects the accuracy of disease recognition and investigation. In addition, traditional feature extraction and matching algorithms have high requirements for computer performance and are prone to incorrect matching. As a result, the image fusion failed.
A linear array image adjacency image matching method is proposed. By downsampling, feature point detection and matching images collected by two adjacent cameras, error matching points are eliminated, SURF feature extraction algorithm and Euclidean distance matching are used, combined with RANSAC The algorithm calculates the relative position offset parameters and maps them to the original image.
It significantly reduces the computer performance requirements, reduces the impact of error matching, improves computing efficiency, obtains global optimal relative position offset parameters, and ensures the accuracy and efficiency of image stitching.
Smart Images

Figure CN118887432A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of image processing, and in particular to a method for matching adjacent image frames of linear array images. Background Art
[0002] In tunnel inspection tasks, ideally all linear array cameras should start collecting images at the same time when they receive a unified trigger signal. However, in actual operations, slight hardware differences or network fluctuations between industrial computers can cause slight deviations in camera startup time. Although the magnitude of this deviation is usually within 100 milliseconds, it will still produce obvious seams and displacements on the stitched images, thus affecting the accuracy of subsequent disease identification and investigation. Therefore, it is necessary to extract and match features from each pair of adjacent cameras to obtain the offsets in the horizontal and vertical directions.
[0003] Feature extraction aims to extract unique, invariant and distinctive feature descriptors from images, so that they can maintain stability under different viewing angles, lighting, scaling and other conditions. Feature extraction algorithms such as SIFT (Scale Invariant Feature Transform), SURF (Speeded Up Robust Features), and ORB (Oriented FAST and Rotated BRIEF) are often used to extract key points and their descriptors, and then calculate the similarity based on the distance between descriptors (Euclidean distance, Hamming distance, etc.). The Brute-Force Matching algorithm is a simple and effective feature matching method. For each feature descriptor in one image, the most similar feature descriptor is found in another image by traversal search, and they are matched as a matching pair.
[0004] Since the image resolution collected by the linear array camera is very high, directly using standard feature extraction and matching algorithms often puts great computing pressure on the computer, resulting in low efficiency or even inability to calculate. At the same time, in actual tunnel inspection operations, due to the single color and few texture details of the tunnel inner wall, traditional feature point detection and matching algorithms often produce a large number of erroneous matching results. This situation becomes more serious after the original image is downsampled. Incorrect feature matching will directly lead to the failure of subsequent image fusion and splicing, resulting in obvious dislocation and geometric distortion. Summary of the invention
[0005] Purpose of the invention: To propose a method for matching adjacent frames of linear array images to solve the above problems existing in the prior art.
[0006] The present invention proposes a method for matching adjacent image frames of linear array images, and the steps are as follows:
[0007] Obtain two original images captured by two adjacent line array cameras at the same time and perform downsampling operations on them to obtain two downsampled line array images;
[0008] Calculate feature points and descriptors in two downsampled line array images;
[0009] Match the feature points in the two downsampled linear array images to obtain a number of matching points;
[0010] Find the best matching point from a number of matching points, and calculate the relative position offset parameter according to the coordinate position of the best matching point;
[0011] The relative offset parameters are mapped from the downsampled linear array image to the original image to complete the adjacent image matching.
[0012] In a further embodiment, the process of calculating the feature points in the two downsampled line images specifically includes:
[0013] The feature points in the downsampled linear array image are detected by the Hessian matrix. The Hessian matrix is as follows:
[0014]
[0015] Where, L xx (x, y, σ) and L yy (x, y, σ) represent the second-order derivatives of the image along the x-axis and y-axis after applying the Gaussian filter; L xy (x, y, σ) is a mixed second-order derivative.
[0016] In a further embodiment, for the detected feature point position (x, y), the Haar wavelet responses in the horizontal and vertical directions in the surrounding area are summed to obtain a response value R:
[0017] Horizontal response R x =∑|dx|;
[0018] Vertical response R y =∑|dy|;
[0019] Where dx and dy are the response values in the x-direction and y-direction respectively; the direction of the feature point is obtained by calculating the maximum response in the main direction.
[0020] The descriptor is constructed by computing a local summary of the Haar wavelet response at the feature point location (x, y) and its neighborhood:
[0021] The area around the feature point is divided into 4×4 sub-blocks, and the horizontal and vertical Haar wavelet responses and the sum of their absolute values are calculated in each sub-block, and normalized to form the final SURF feature vector:
[0022] v=(∑dx,∑dy,∑|dx|,∑|dy|).
[0023] In a further embodiment, feature points in two downsampled linear images are matched to obtain a number of matching points, specifically including:
[0024] Suppose the feature points and descriptor sets of images A and B after SURF extraction are {D A1 , D A2 , ..., D Am}, {D B1 , D B2 , ..., D Bn};
[0025] Two descriptors D Ai and D Bj The Euclidean distance between them is expressed as:
[0026]
[0027] Where d is the dimension of the descriptor; D Ai,k and D Bj,k They are respectively the descriptors D Ai and D Bj The kth component of ;
[0028] Euclidean distance Dist(D Ai , D Bj ) is used to compare two descriptors D Ai and D Bj The similarities between.
[0029] In a further embodiment, the process of finding the best matching point from a plurality of matching points specifically includes:
[0030] For each feature descriptor D in image A Ai , calculate it and all feature descriptors D in image B Bj The Euclidean distance between them, and then find the descriptor D with the smallest Euclidean distance Bj , which is taken as the best matching point:
[0031] BestMatch(D Ai )=Min[Dist(D Ai , D Bj )]
[0032] Record every D Ai The best match D Bj and its corresponding distance.
[0033] In a further embodiment, after finding the feature descriptor D in image A Ai and feature descriptor D in image B Bj After the best matching pair, it also includes:
[0034] D Bj As a benchmark, find the feature descriptor D in image A Ak So that:
[0035] BestMatch(D Bj )=Min[Dist(D Bj , D Ai )]
[0036] When D Ak =D Ai When (D Ai , D Bj ) is a pair of valid matches, and the best matching point is output.
[0037] In a further embodiment, before calculating the relative position offset parameter, it also includes removing erroneous matching points, specifically including:
[0038] Calculate all horizontal offsets H i The mean μ H and variance
[0039]
[0040] According to the triple mean error principle, the threshold is set to p H ±3σ H ;
[0041] All offsets h that are not within the threshold range i Considered as gross error elimination:
[0042] Cleaned data = H i |p H -3σ H ≤H i ≤p H +3σ H .
[0043] In a further embodiment, the process of calculating the relative position offset parameter specifically includes:
[0044] Randomly select a subset h from the cleaned data i As a sample fitting model, take the offset parameter when calculating the mean
[0045] Evaluate all data points and for each data point hi, calculate its The deviation D(hi ,h temp ); if D(h i ,h temp )≤T, then the data point is considered as an interior point;
[0046] Repeat the above steps, record the sample fitting model with the largest number of inliers each time as the optimal model, and use these inliers to re-estimate the final offset parameters At this time, the obtained is the optimal horizontal offset parameter;
[0047] The optimal horizontal offset parameter is mapped from the downsampled linear array image to the original image to complete the adjacent image matching.
[0048] The present invention also proposes a computer-readable storage medium, which stores at least one executable instruction. When the executable instruction is executed on an electronic device, the electronic device executes the method for matching adjacent image frames of linear array images as described in the first aspect.
[0049] Beneficial effects: The method for matching adjacent images of linear array images proposed in the present invention greatly reduces the demand for computer performance and the impact of erroneous matching, improves calculation efficiency, and can obtain the globally optimal relative position offset parameters by downsampling, feature extraction and matching, and eliminating gross errors of multiple linear array images. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 This is a flow chart of the method for matching adjacent frames of linear array images proposed in this embodiment.
[0051] Figure 2 Result of matching 5 pairs of adjacent images in the embodiment of the present invention. DETAILED DESCRIPTION
[0052] In the following description, a large number of specific details are provided to provide a more thorough understanding of the present invention. However, it is apparent to those skilled in the art that the present invention can be implemented without one or more of these details. In other examples, in order to avoid confusion with the present invention, some technical features known in the art are not described.
[0053] Embodiment 1:
[0054] This embodiment discloses a specific process of a method for matching adjacent image frames of linear array images. Figure 1 .
[0055] First, a set of linear images needs to be downsampled based on factors such as image resolution and computer performance, and the results are stored in computer memory for subsequent processing.
[0056] Calculate the feature points and descriptors in the two images respectively, and match the feature points between the two images. i,j and P m,n is a pair of best matching points on two images collected by two cameras at the same time, then the relative position offset parameters can be calculated according to (mi,nj).
[0057] The above operation is performed on each set of images, and finally a series of relative position offset parameters are obtained.
[0058] In the same operation acquisition, the image acquisition interval and the relative position of the camera are unchanged. Therefore, for each set of circumferential linear array images acquired at different times, it can be considered that their relative position offset in the UV coordinate system is the same. According to this geometric constraint, the Random Sample Consensus (RANSAC) algorithm is used to estimate the translation transformation model between adjacent circumferential images, and based on this, the wrong matching points that do not conform to the model are eliminated. Finally, the refined relative offset parameters are mapped from the low-resolution image to the original image.
[0059] Figure 2 The results of matching 5 pairs of adjacent images are shown. It can be seen that in the tunnel environment, there are few feature points and they are very similar, which makes it very easy to make wrong matches. In order to obtain high-precision matching results, it is necessary to combine all matching data for comprehensive consideration.
[0060] Embodiment 2:
[0061] Based on Example 1, this example discloses a process for calculating feature points and descriptors in two images. This example uses the SURF (Speeded Up Robust Features) feature extraction algorithm to calculate feature points and descriptors in two images respectively. The following process is only regarded as a feasible solution and does not represent a limitation on the technical solution of this application.
[0062] SURF is a feature point detection and description operator used for object recognition and image registration. The following are the core calculation steps and formulas of the SURF feature extraction algorithm:
[0063] 1. Integral Image
[0064] To speed up the computation of the Haar wavelet response, SURF makes use of integral images, in which the value of each pixel in the image is the cumulative sum of the values of all the pixels above and to the left of it.
[0065]
[0066] Where I(i, j) is the pixel value of the original image, I Σ (x, y) are the values in the integral graph.
[0067] 2. Fast Hessian Matrix
[0068] SURF detects points of interest in scale space through the Hessian matrix. The form of the Hessian matrix is as follows:
[0069]
[0070] Where Lx x (x, y, σ) and L yy (x, y, σ) represent the second-order derivatives (along the x-axis and y-axis) of the image after applying the Gaussian filter, respectively. xy (x, y, σ) is a mixed second-order derivative.
[0071] 3. Haar Wavelet Responses Calculation
[0072] At the detected feature point location, SURF uses a simple Haar wavelet response to describe the direction of the feature point. For a feature point (x, y), the response value R is obtained by summing the horizontal and vertical responses in the surrounding area:
[0073] Horizontal Response:
[0074] R x =∑|dx|
[0075] Vertical response:
[0076] R y =∑|dy|
[0077] Where dx and dy are the response values in the x-direction and y-direction respectively. The direction of the feature point is obtained by calculating the maximum response in the main direction.
[0078] 4. Feature descriptor description
[0079] The SURF descriptor is constructed by calculating the local summary of the Haar wavelet response within the feature point and its neighborhood. The area around the feature point is divided into 4x4 sub-blocks, and the Haar wavelet response in the x-direction and y-direction and the sum of their absolute values are calculated in each sub-block:
[0080] v=(∑dx,∑dy,∑|dx|,∑|dy|)
[0081] Finally, these values are normalized to form the final SURF feature vector. Through the above steps, the SURF algorithm can efficiently and accurately calculate the feature points in the image and generate feature vectors for image matching and recognition.
[0082] Embodiment 3:
[0083] Based on Example 1, this example proposes to match the feature points between two images by brute force matching. Brute force matching is a simple and direct method for feature matching, which compares the descriptors of all feature points in two images one by one to find the best matching pair. Suppose the feature points and descriptor sets of image A and image B after SURF extraction are:
[0084] The feature descriptor set of image A: {D A1 , D A2 , ..., D Am}, where D Ai is the descriptor of the i-th feature point in image A.
[0085] The feature descriptor set of image B: {D B1 , D B2 , ..., D Bn}, where D Bj is the descriptor of the jth feature point in image B.
[0086] The following are the main steps and formulas for SURF feature matching using the brute force matching algorithm:
[0087] 1. Distance metric
[0088] Euclidean distance is often used to compare the similarity between two descriptors. Given two descriptors D Ai and D Bj , the Euclidean distance between them can be expressed as:
[0089]
[0090] Where d is the dimension of the descriptor, D Ai,k and D Bj,k They are respectively the descriptors D Ai and D Bj The kth component of .
[0091] 2. Find the best match
[0092] The core of brute force matching is to calculate the distance between all feature pairs and find the matching pair with the smallest distance. Ai , calculate it and all feature descriptors D in image B BjThe Euclidean distance between them, and then find the descriptor D with the smallest distance Bj ,Right now:
[0093] BestMatch(D Ai )=Min(Dist(D Ai , D Bj ))
[0094] Record every D Ai The best match D Bj and its corresponding distance.
[0095] 3. Bidirectional consistency check
[0096] In order to improve the matching accuracy, a bidirectional consistency check can be performed. That is, not only the best match of the feature descriptor in image A in image B should be found, but also the best match of the feature descriptor in image B in image A should be found. Only when the bidirectional matches are consistent, it is considered a valid match. The specific steps are as follows:
[0097] Find the feature descriptor D in image A Ai and feature descriptor D in image B Bj The best matching pair. Bj As a benchmark, find the feature descriptor D in image A Ak So that:
[0098] BestMatch(D Bj )=Min(Dist(D Bj , D Ai ))
[0099] Only when D Ak =D Ai When (D Ai , D Bj ) is a valid match.
[0100] Through the above steps, the brute force matching algorithm can find the best matching pair between the SURF feature sets of two images.
[0101] Embodiment 4:
[0102] In the same operation acquisition, the image acquisition interval and the relative position of the camera are unchanged. Therefore, for each set of circumferential linear array images acquired at different times, it can be considered that their relative position offset in the UV coordinate system is the same. According to this geometric constraint, the Random Sample Consensus (RANSAC) algorithm is used to estimate the translation transformation model between adjacent circumferential images, and based on this, the wrong matching points that do not conform to the model are eliminated. Finally, the refined relative offset parameters are mapped from the low-resolution image to the original image. The specific operations are as follows:
[0103] For a series of relative position offset parameters Pi, since the causes of horizontal and vertical offsets between images are different, it can be considered that their offsets are relatively independent. Therefore, the horizontal offset and vertical offset can be processed and calculated separately. Taking the horizontal offset H as an example, the specific operation steps are as follows:
[0104] 1. Data cleaning
[0105] Before calculating the offset parameters, the data needs to be cleaned to remove obvious outliers. This can be achieved by the Three-Sigma Rule. The specific steps are as follows:
[0106] Calculate the mean and variance: Calculate all horizontal shifts H i The mean μ H and variance
[0107]
[0108] Determine the threshold: According to the three-fold mean error principle, the threshold is set to p H ±3σ H .
[0109] Eliminate outliers: Filter the data and remove all outliers that are not within the threshold range. i It is considered as gross error and eliminated.
[0110] Cleaned data = H i |p H -3σ H ≤H i ≤μ H +3σ H
[0111] 2. Use the RANSAC method to calculate the optimal offset parameters
[0112] RANSAC (Random Sample Consensus) is an iterative algorithm for fitting models from data that contains a lot of noise.
[0113] The specific steps are as follows:
[0114] Randomly select samples to fit the model: Randomly select a subset h from the cleaned data i , the offset parameter when calculating the mean
[0115] Calculate the inliers: Evaluate all data points, for each data point h i , calculate its If the deviation is less than a certain defined threshold T (inlier threshold), the data point is considered to be an inlier.
[0116] D(h i ,h temp )≤T
[0117] Evaluate the model: record the number of inliers of the model. The model with more inliers is the better one.
[0118] Repeat the iteration: Repeat the above steps multiple times, and record the model with the most inliers each time. Usually, a maximum number of iterations N is set, and all iterations are completed in sequence.
[0119] Final model: The model with the most inliers is selected as the optimal model, and the final offset parameters are re-estimated using these inliers
[0120] After the above process, we get will be the optimal horizontal offset parameter, which can effectively represent the actual horizontal offset between images. On the same basis, similar processing can be performed on the vertical offset parameter to obtain a complete set of relative position offset parameters. The complete set of relative position offset parameters can be mapped from the low-resolution image to the original image to complete the adjacent image matching.
[0121] In practical applications, the operation logic of the linear array image adjacent image matching method disclosed in the above embodiment can be written into a set of executable instructions, and the executable instructions are written into a storage medium and run on an electronic device. More specific examples of the computer-readable storage medium mentioned in this embodiment may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. The computer-readable storage medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The readable signal medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, device, or device.
[0122] As described above, although the present invention has been shown and described with reference to specific preferred embodiments, it should not be construed as limiting the present invention itself. Various changes may be made to it in form and detail without departing from the spirit and scope of the present invention as defined in the appended claims.
Claims
1. A method for matching adjacent images of linear array images. It is characterized in that The steps include: Obtain two original images captured by two adjacent line array cameras at the same time and perform downsampling operations on them to obtain two downsampled line array images; Calculate feature points and descriptors in two downsampled line array images; Match the feature points in the two downsampled linear array images to obtain a number of matching points; Find the best matching point from a number of matching points, and calculate the relative position offset parameter according to the coordinate position of the best matching point; The relative offset parameters are mapped from the downsampled linear array image to the original image to complete the adjacent image matching.
2. According to the method for matching adjacent image frames of linear array images according to claim 1, It is characterized in that Calculate the feature points in two downsampled line array images, including: The feature points in the downsampled linear array image are detected by the Hessian matrix. The Hessian matrix is as follows: Where, L xx (x,y,σ) and L yy (x, y, σ) represent the second-order derivatives of the image along the x-axis and y-axis after applying the Gaussian filter; L xy (x,y,σ) is the mixed second-order derivative.
3. According to claim 2, the method for matching adjacent image frames of linear array images, Features: For the detected feature point position (x, y), the Haar wavelet response in the horizontal and vertical directions of the surrounding area is summed to obtain the response value R: Horizontal response R x =∑|dx|; Vertical response R y =∑|dy|; Where dx and dy are the response values in the x-direction and y-direction respectively; the direction of the feature point is obtained by calculating the maximum response in the main direction.
4. According to claim 3, the method for matching adjacent image frames of linear array images, It is characterized in that The descriptor is constructed by computing a local summary of the Haar wavelet response at the feature point location (x, y) and its neighborhood: The area around the feature point is divided into 4×4 sub-blocks, and the horizontal and vertical Haar wavelet responses and the sum of their absolute values are calculated in each sub-block, and normalized to form the final SURF feature vector: v=(Σdx,Σdy,Σ|dx|,Σ|dy|).
5. According to the method for matching adjacent image frames of linear array images according to claim 4, It is characterized in that Match the feature points in the two downsampled linear images to obtain several matching points, including: Suppose the feature points and descriptor sets of images A and B after SURF extraction are {D A1 ,D A2 ,...,D Am }, {D B1 ,D B2 ,...,D Bn }; Two descriptors D Ai and D Bj The Euclidean distance between them is expressed as: Where d is the dimension of the descriptor; D Ai,k and D Bj,k They are respectively the descriptors D Ai and D Bj The kth component of ; Euclidean distance Dist(D Ai ,D Bj ) is used to compare two descriptors D Ai and D Bj The similarities between.
6. The method for matching adjacent image frames of linear array images according to claim 5, It is characterized in that Find the best matching point from several matching points, including: For each feature descriptor D in image A Ai , calculate it and all feature descriptors D in image B Bj The Euclidean distance between them, and then find the descriptor D with the smallest Euclidean distance Bj , which is taken as the best matching point: BestMatch(D Ai )=Min[Dist(D Ai ,D Bj )] Record every D Ai The best match D Bj and its corresponding distance.
7. The method for matching adjacent image frames of linear array images according to claim 6, It is characterized in that Find the feature descriptor D in image A Ai and feature descriptor D in image B Bj After the best matching pair, it also includes: D Bj As a benchmark, find the feature descriptor D in image A Ak So that: BestMatch(D Bj )=Min[Dist(D Bj ,D Ai )] When D Ak =D Ai When 9D Ai ,D Bj ) is a pair of valid matches, and the best matching point is output.
8. The method for matching adjacent image frames of linear array images according to claim 1, It is characterized in that Before calculating the relative position offset parameters, the wrong matching points are also removed, including: Calculate all horizontal offsets H i The mean μ H and variance According to the triple mean error principle, the threshold is set to μ H ±3σ H ; All offsets h that are not within the threshold range i Considered as gross error elimination: Cleaned data = H i ∣μ H -3σ H ≤H i ≤μ H +3σ H .
9. The method for matching adjacent image frames of linear array images according to claim 8, It is characterized in that Calculate the relative position offset parameters, including: Randomly select a subset h from the cleaned data i As a sample fitting model, take the offset parameter when calculating the mean Evaluate all data points, for each data point h i , calculate its The deviation D(h i ,h temp ); if D(h i ,h temp )≤T, then the data point is considered as an interior point; Repeat the above steps, record the sample fitting model with the largest number of inliers each time as the optimal model, and use these inliers to re-estimate the final offset parameters At this time, the obtained is the optimal horizontal offset parameter; The optimal horizontal offset parameter is mapped from the downsampled linear array image to the original image to complete the adjacent image matching.
10. A computer-readable storage medium, It is characterized in that The storage medium stores at least one executable instruction. When the executable instruction is executed on the electronic device, the electronic device executes the method for matching adjacent image frames of linear array images as described in any one of claims 1 to 9.
