One-button panoramic image splicing method

Through the one-click panoramic image stitching method, pre-processing, fast matching feature points and multi-scale fusion technology are used to solve the time-consuming stitching problem caused by camera position changes, achieving fast and automatic panoramic image stitching, improving user experience and Validated in an airport environment.

CN118735775APending Publication Date: 2024-10-01NANJING LES ELECTRONICS EQUIP CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410816905.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-24
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

The existing technology requires manual adjustments or complex calculations when the camera position changes slightly, resulting in a long image stitching process and inconvenience to users.

Method used

A one-click panoramic image stitching method is adopted, including preprocessing images, constructing scale spaces, using the FLANN library to quickly match feature points, perspective transformation to calculate transformation matrices, and multi-scale fusion technology and skyline segmentation algorithms to improve stitching efficiency and accuracy.

Benefits of technology

It achieves fast and automatic panoramic image stitching, reduces the time consumption of the stitching process, and improves user experience. The method has been verified to be effective in multiple airport environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118735775A_ABST
    Figure CN118735775A_ABST
Patent Text Reader

Abstract

The invention discloses a one-button panoramic image splicing method. The method comprises the following steps: acquiring a group of to-be-spliced images with overlapped areas, and preprocessing the images; constructing a scale space and obtaining feature points; constructing an index structure by using a fast approximate nearest neighbor search library, and matching feature points; calculating a transformation matrix between adjacent images by using a perspective transformation method, and projecting the adjacent images into the same coordinate system to obtain a registered image; carrying out weighted average processing on the registered image by adopting a multi-scale fusion method to obtain a preliminary panorama; and straightening the initial panoramic image by using a skyline segmentation method to obtain a final panoramic image. According to the invention, the problem that when the position of the camera is slightly changed, the existing splicing technology usually needs to carry out manual splicing adjustment on the scene again or needs complex calculation to complete the splicing adjustment, and a lot of time needs to be consumed is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to an image stitching method, in particular to a one-key panoramic image stitching method. Background Art

[0002] This section merely provides background information related to the present disclosure and is not necessarily prior art.

[0003] With the continuous development of computer vision, the application of image stitching has become more and more extensive. In panoramic stitching, due to the camera's viewing angle and the optical characteristics of the lens, when the camera has a slight position change, the existing stitching technology usually requires manual re-stitching and adjustment of the scene, or requires complex calculations to complete, which takes a lot of time and is inconvenient for users.

[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention

[0005] Purpose of the invention: The technical problem to be solved by the present invention is to provide a one-click panoramic image stitching method in view of the deficiencies in the prior art.

[0006] In order to solve the above technical problems, the present invention discloses a one-key panoramic image stitching method.

[0007] Beneficial effects:

[0008] 1. The present invention discloses a method for one-click stitching of panoramic pictures, which solves the problem that when the camera has a slight position change, the existing stitching technology usually requires manual re-stitching and adjustment of the scene, or requires complex calculations to complete, which takes a lot of time.

[0009] 2. The present invention has been field-verified and performance-tested in multiple airport environments. The method has been put into use in multiple domestic airports, which fully verifies the effectiveness of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] The present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments, and the above and / or other advantages of the present invention will become more clear.

[0011] Figure 1 It is a schematic diagram of the overall process of the present invention.

[0012] Figure 2 is an original input image in an embodiment.

[0013] Figure 3An embodiment is provided for completing preliminary stitching of unstraightened images.

[0014] Figure 4 The figure is an image that is finally stitched and straightened in one embodiment. DETAILED DESCRIPTION

[0015] The present invention discloses a method for one-key stitching of panoramic images, comprising the following steps:

[0016] Step 1, first obtain a set of images with overlapping areas to be stitched, and preprocess the images;

[0017] Step 2: construct a scale space for the preprocessed image to detect features at different scales.

[0018] Step 3: For the feature points obtained in step 2, use FLANN (Fast Library for Approximate Nearest Neighbors) to build a fast search index structure for fast matching of image feature points.

[0019] Step 4, using perspective transformation to calculate the transformation matrix between adjacent images, and projecting the two images into the same coordinate system;

[0020] Step 5: Use multi-scale fusion technology to perform weighted averaging on the registered images to reduce stitching gaps and color differences;

[0021] Step 6: Use the skyline segmentation algorithm to straighten the panoramic image to obtain the final panoramic image.

[0022] Step 1 includes: using an improved SIFT algorithm (Scale-Invariant Feature Transform) combined with denoising and image enhancement to improve the stability of feature points;

[0023] Step 1-1: Use bilateral filtering to reduce the noise in a given image I;

[0024]

[0025] Among them G s (i, j) is the Gaussian kernel in the spatial domain, indicating the spatial distance weight; G r (I(x,y)-I(x+i,y+j)) is the grayscale domain Gaussian kernel, which represents the grayscale similarity weight; W p is the normalization coefficient; k represents the size of the filter window, and x and y represent the pixel coordinates;

[0026] Step 1-2: Adopt adaptive histogram equalization (CLAHE) to improve the contrast of the image;

[0027] I enhance (x,y)=CLAHE(I d (x,y)

[0028] Among them I enhance (x, y) represents the enhanced image, I d (x,y) represents the image after denoising;

[0029] Use Gaussian pyramid to perform multiple Gaussian blur and downsampling operations on the image obtained in step 1;

[0030] Step 2-1: I enhance (x, y) performs a series of Gaussian blur operations to smooth the image using Gaussian kernels of different scales;

[0031]

[0032] Where x and y represent the coordinates of the pixel in the image, and σ is the standard deviation of the Gaussian kernel;

[0033] Step 2-2: After each Gaussian blur, the image is sampled, that is, the image size is reduced according to a certain ratio to obtain the pyramid image of the next layer;

[0034] Step 2-3: Repeat the Gaussian blur and downsampling operations until the specified number of scale layers is reached or the image is reduced to a certain extent. Each Gaussian blur and downsampling operation will result in a new image layer, forming a pyramid structure.

[0035] Step 3 includes:

[0036] Step 3-1: Two sets of adjacent image feature point descriptors obtained in step 2, the feature point descriptor set of image 1 Feature point descriptor set for image 2 Each descriptor d is a high-dimensional vector.

[0037] Step 3-2: First, construct an index structure KMeans tree (reference: Duda, RO, Hart, PE, & Stork, DG (2000). Pattern Classification. Wiley-Interscience), and use the constructed index to search for the nearest neighbor of each feature point in image 1 in the feature descriptors of image 2. The goal of the nearest neighbor search is to find the minimum distance between descriptors;

[0038]

[0039] Step 3-3: Ratio test, Where dist1 is the distance of the nearest neighbor, and dist2 is the distance of the next nearest neighbor. When the ratio is less than a certain threshold, the match is considered valid. This can effectively filter out false matches, thereby improving the accuracy and effect of panoramic stitching.

[0040] Step 4 includes:

[0041] Step 4-1: The mathematical representation of perspective transformation is usually described using a monotropy matrix

[0042]

[0043] Among them, (x, y) represents the coordinates of the original image point, (x ’ ,y ’ ) represents the position coordinates after perspective transformation; H is a 3*3 homography matrix, which represents the mapping relationship from the original image to the transformed image;

[0044] Step 4-2: Express the relationship in step 4-1 above in matrix form:

[0045]

[0046] Where (x,y) and (x ’ ,y ’ ) represents each set of corresponding points, a total of n sets of matching corresponding points, and then the linear equations are solved by the least squares method to obtain the estimated value of the homography matrix H.

[0047] In the multi-scale fusion technology, the Laplacian pyramids (reference: Gonzalez, RC, & Woods, RE (2007). Digital Image Processing (3rd Edition). Prentice Hall. (Charpter on multiscale fusion image processing techniques)) of two images are weighted averaged at each scale to achieve seamless fusion;

[0048] Step 5-1: Construct a weight map for each input image (reference: Gonzalez, RC, & Woods, RE (2007). Digital Image Processing (3rd Edition). Prentice Hall. (Chartter on multiresolution image processing techniques));

[0049] Step 5-2: At each scale, perform weighted averaging of the Laplacian pyramids of the two images;

[0050] L blend,K =W A ·L A,K +W B ·L B,K

[0051] Among them, L blend,k is the Kth layer of the fused Laplacian pyramid, L A,K and L B,K are the Kth level Laplacian pyramids of images A and B, respectively, and W A and W B is the corresponding weight;

[0052] Step 5-3: Reconstruct image L from the fused Laplacian pyramid blend

[0053]

[0054] Straighten the stitched panorama:

[0055] Step 6-1: Preprocess the color-corrected panoramic image using morphological methods (Soille, P. (2003). Morphological Image Analysis: Principles and Applications. Springer.), and use the Canny edge detection algorithm to extract edge information of the preprocessed panoramic image, and then combine the local gradient and edge information to determine the skyline position (reference: Gonzalez, RC, & Woods, RE (2007). Digital Image Processing (3rd Edition). Prentice Hall. (Charpter on multriesolution image processing techniques));

[0056] Step 6-2: Use the least squares method to fit the skyline into a straight line according to the following formula;

[0057] y=mx+b

[0058]

[0059] In the formula, y=mx+b is the fitted straight line expression, m represents the slope of the fitted straight line, b represents the intercept of the fitted straight line, (x u ,y u ) is the coordinate of the u-th point on the skyline, and n is the total number of points on the skyline;

[0060] According to the fitted straight line, the skyline in the panoramic image is adjusted according to the following formula:

[0061] y u ′=y u -(mx u +b)

[0062] In the formula, y u ' is the y-axis coordinate of the u-th point on the adjusted skyline, so that the skyline point coordinate changes from (x u ,y u ) is adjusted to (x u ,y u '), complete the correction of the panoramic image.

[0063] Example:

[0064] According to the above technical solution, the above method is described in detail in a specific embodiment. Figure 1 As shown:

[0065] Step 1-1: Use bilateral filtering to reduce the given image I (such as Figure 2 As shown, it is the noise in the original input image);

[0066]

[0067] Among them G s (i, j) is the Gaussian kernel in the spatial domain, indicating the spatial distance weight; G r (I(x,y)-I(x+i,y+j)) is the grayscale domain Gaussian kernel, which represents the grayscale similarity weight; W p is the normalization coefficient; k represents the size of the filter window, and x and y represent the pixel coordinates;

[0068] Step 1-2: Adopt adaptive histogram equalization (CLAHE) to improve the contrast of the image;

[0069] I enhance (x,y)=CLAHE(I d (x,y)

[0070] Among them I enhance (x, y) represents the enhanced image, I d (x,y) represents the image after denoising;

[0071] Step 2-1: I enhance (x, y) performs a series of Gaussian blur operations to smooth the image using Gaussian kernels of different scales;

[0072]

[0073] Where x and y represent the coordinates of the pixel in the image, and σ is the standard deviation of the Gaussian kernel;

[0074] Step 2-2: After each Gaussian blur, the image is sampled, that is, the image size is reduced according to a certain ratio to obtain the pyramid image of the next layer;

[0075] Step 2-3: Repeat the Gaussian blur and downsampling operations until the specified number of scale layers is reached or the image is reduced to a certain extent. Each Gaussian blur and downsampling operation will result in a new image layer, forming a pyramid structure.

[0076] Step 3-1: Two sets of adjacent image feature point descriptors obtained in step 2, the feature point descriptor set of image 1 Feature point descriptor set for image 2 Each descriptor d is a high-dimensional vector.

[0077] Step 3-2: First, construct an index structure KMeans tree, and use the constructed index to search for the nearest neighbor of each feature point in image 1 in the feature descriptors of image 2. The goal of the nearest neighbor search is to find the minimum distance between descriptors.

[0078]

[0079] Step 3-3: Ratio test, Where dist1 is the distance of the nearest neighbor, and dist2 is the distance of the next nearest neighbor; when the ratio is less than a certain threshold, the match is considered valid; thereby, the wrong matches can be effectively filtered out, thereby improving the accuracy and effect of panoramic stitching; the ratio value of the present invention is set to 0.75;

[0080] Step 4-1: The mathematical representation of perspective transformation is usually described using a monotropy matrix

[0081]

[0082] Among them, (x, y) represents the coordinates of the original image point, (x ’ ,y ’ ) represents the position coordinates after perspective transformation; H is a 3*3 homography matrix, which represents the mapping relationship from the original image to the transformed image;

[0083] Step 4-2: Express the relationship in step 4-1 above in matrix form:

[0084]

[0085] Where (x,y) and (x ’ ,y’ ) represents each set of corresponding points, a total of n sets of matching corresponding points, and then the linear equations are solved by the least squares method to obtain the estimated value of the homography matrix H.

[0086] Step 5-1: Construct a weight map for each input image;

[0087] Step 5-2: At each scale, perform weighted averaging of the Laplacian pyramids of the two images;

[0088] L blend,k =W A ·L A,K +W B ·L B,K

[0089] Among them, L blend,k is the Kth layer of the fused Laplacian pyramid, L A,K and L B,K are the Kth level Laplacian pyramids of images A and B, respectively, and W A and W B is the corresponding weight;

[0090] Step 5-3: Reconstruct image L from the fused Laplacian pyramid blend

[0091]

[0092] The initial stitching of the image is completed (not straightened), and the result is as follows Figure 3 shown.

[0093] Step 6-1: preprocessing the color-corrected panoramic image using morphological methods, extracting edge information of the preprocessed panoramic image using a Canny edge detection algorithm, and then determining the skyline position by combining local gradient and edge information;

[0094] Step 6-2: Use the least squares method to fit the skyline into a straight line according to the following formula;

[0095] y=mx+b

[0096]

[0097] In the formula, y=mx+b is the fitted straight line expression, m represents the slope of the fitted straight line, b represents the intercept of the fitted straight line, (x u ,y u ) is the coordinate of the u-th point on the skyline, and n is the total number of points on the skyline;

[0098] According to the fitted straight line, the skyline in the panoramic image is adjusted according to the following formula:

[0099] y u ′=y u -(mx u +b)

[0100] In the formula, y u ' is the y-axis coordinate of the u-th point on the adjusted skyline, so that the skyline point coordinate changes from (x u ,y u ) is adjusted to (x u ,y u '), complete the correction of the panoramic image.

[0101] After the above steps, the synthesized panoramic image is as follows Figure 4 shown.

[0102] In a specific implementation, the present application provides a computer storage medium and a corresponding data processing unit, wherein the computer storage medium can store a computer program, and when the computer program is executed by the data processing unit, the invention content of a one-key panoramic image stitching method provided by the present invention and some or all of the steps in each embodiment can be executed. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

[0103] Those skilled in the art can clearly understand that the technical solutions in the embodiments of the present invention can be implemented by means of computer programs and their corresponding general hardware platforms. Based on such an understanding, the technical solutions in the embodiments of the present invention can be essentially or partly contributed to the prior art in the form of computer programs, i.e., software products, which can be stored in a storage medium and include several instructions for enabling a device including a data processing unit (which can be a personal computer, a server, a single-chip microcomputer, an MCU or a network device, etc.) to execute the methods described in various embodiments of the present invention or certain parts of the embodiments.

[0104] The present invention provides a one-click panoramic image stitching method and method. There are many methods and ways to implement the technical solution. The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present invention, several improvements and modifications can be made, and these improvements and modifications should also be regarded as the protection scope of the present invention. All components not specified in this embodiment can be implemented by existing technologies.

Claims

1. A one-click panoramic image stitching method, characterized in that: The steps include: Step 1, obtaining a set of images with overlapping areas to be stitched, and preprocessing the images; Step 2, construct the scale space and obtain feature points; Step 3: Use the fast approximate nearest neighbor search library FLANN to build an index structure and match feature points; Step 4: Calculate the transformation matrix between adjacent images using the perspective transformation method, project the adjacent images into the same coordinate system, and obtain the registered images; Step 5: Using a multi-scale fusion method, weighted averaging is performed on the registered images to obtain a preliminary panoramic image. Step 6: Use the skyline segmentation method to straighten the preliminary panoramic image to obtain the final panoramic image, thereby completing the panoramic image stitching.

2. The one-click panoramic image stitching method according to claim 1, characterized in that: The image preprocessing described in step 1, i.e., using the improved scale-invariant feature transform (SIFT) method for denoising and image enhancement, specifically includes: Step 1-1, denoising the image using a bilateral filtering method; Step 1-2: Adaptive histogram equalization is used to enhance the bilaterally filtered image.

3. The one-click panoramic image stitching method according to claim 2, characterized in that: The bilateral filtering method described in step 1-1 is used for denoising, specifically including: Among them, I d (x, y) is the denoised image, I represents the image, G s (i, j) is the Gaussian kernel in the spatial domain, indicating the spatial distance weight; G r (I(x,y)-I(x+i,y+j)) is the grayscale domain Gaussian kernel, which represents the grayscale similarity weight; W p is the normalization coefficient; k represents the size of the filter window, and (x, y) represents the pixel coordinates of image I.

4. The one-click panoramic image stitching method according to claim 3, characterized in that: The enhancement using the adaptive histogram equalization method described in step 1-2 specifically includes: Yo enhance (x,y)=CLAHE(I d (x,y)) Among them, I enhance (x, y) represents the enhanced image, and CLAHE represents adaptive histogram equalization.

5. The one-click panoramic image stitching method according to claim 4, characterized in that: The construction of scale space and acquisition of feature points described in step 2 specifically include: Step 2-1, constructing a scale space to obtain a pyramid structure of a multi-scale image layer; Step 2-2, perform feature detection on image layers at different scales to obtain feature points and their descriptors.

6. The one-click panoramic image stitching method according to claim 5, characterized in that: The construction of the scale space described in step 2-1 specifically includes: Step 2-1-1, for the enhanced image I enhance (x, y) is Gaussian blurred and the image is smoothed using Gaussian kernels of different scales, as follows: Where σ is the standard deviation of the Gaussian kernel; Step 2-1-2, after each Gaussian blur operation, sampling is performed, that is, the image size is reduced according to a preset ratio to obtain the next layer of pyramid image; Step 2-1-3, repeat step 2-1-1 and step 2-1-2 until the set number of scale layers is reached or the image is reduced to a preset size, and all pyramid images form a pyramid structure.

7. The one-click panoramic image stitching method according to claim 6, characterized in that: The matching feature points described in step 3 specifically include: Step 3-1, construct feature point descriptor sets of adjacent images respectively, as follows: Assume that two adjacent images are the first image and the second image. According to the feature points and their descriptors obtained in step 2, the feature point descriptor set of the first image is divided into The feature point descriptor set of the second image Where n represents the number of feature points; Step 3-2, construct the index structure KMeans tree; Step 3-3, search for matches, that is, use the constructed index to search the nearest neighbor of the feature point descriptor in the second image in the feature point descriptor of the first image, that is, find the minimum distance dist(D1, D2) between the feature point descriptors, as follows: Step 3-4, performing a ratio test on the successfully matched nearest neighbor, as follows: Among them, ratio represents the ratio, dist1 is the distance of the nearest neighbor, and dist2 is the distance of the next nearest neighbor; when the ratio is less than the threshold, the match is considered valid.

8. The one-click panoramic image stitching method according to claim 7, characterized in that: The calculation of the transformation matrix between adjacent images described in step 4 specifically includes: Step 4-1, the mathematical representation of perspective transformation, is described using the homography matrix H as follows: Where (x, y) represents the coordinates of the original image point, (x', y') represents the position coordinates after perspective transformation; H is a 3*3 homography matrix, which represents the mapping relationship from the original image to the transformed image; Step 4-2, express the above relationship in matrix form as follows: Among them, (x, y) and (x', y') represent a set of matched and corresponding points in adjacent images, a total of n groups; Step 4-3, solve by least squares method to obtain the estimated value of the homography matrix H.

9. The one-click panoramic image stitching method according to claim 8, characterized in that: The multi-scale fusion method described in step 5 is to perform weighted averaging of the Laplacian pyramids of two adjacent images at each scale to achieve fusion, which specifically includes: Step 5-1, construct a weight map for each input image; Step 5-2, at each scale, the Laplacian pyramids of two adjacent images are weighted averaged as follows: L blend,k =W A ·L A,K +W B ·L B,K Among them, L blend,K is the Kth layer of the fused Laplacian pyramid, L A,K and L B,K are the first image and the second K-th layer Laplacian pyramid, W A and W B is the corresponding weight; Step 5-3, reconstruct image L from the fused Laplacian pyramid blend , as follows 10. The one-click panoramic image stitching method according to claim 9, characterized in that: The skyline segmentation method described in step 6 specifically includes: Step 6-1, preprocessing the preliminary panoramic image by using morphological means, extracting edge information of the preprocessed panoramic image by using the Canny edge detection method, and then determining the skyline position by combining the local gradient and edge information; Step 6-2, use the least squares method to fit the skyline into a straight line, as follows: Among them, q = mp + b is the fitted straight line expression, m represents the slope of the fitted straight line, b represents the intercept of the fitted straight line, (p u ,q u ) is the coordinate of the u-th point on the skyline, and s is the total number of points on the skyline; Step 6-3, according to the fitted straight line, adjust the skyline in the preliminary panoramic image as follows: q u’ =q u -(mp u +b) Among them, q u’ is the y-axis coordinate of the u-th point on the adjusted skyline, and the skyline point coordinate is changed from (p u ,q u ) is adjusted to (p u ,q u’ ), complete the correction of the panoramic image.