Rapid image splicing method and system based on feather stitching
Through the feather stitching method, the weighted average fusion of images is achieved by using Boolean operation and Gaussian filtering processing of the rectangular information area, solving the calculation complexity and real-time problems of image stitching in the prior art, and being able to stitch images of any shape and reduce the number of images The seams are obvious.
Patent Information
- Application Number
- CN202310555800.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-15
- Publication Date
- 2024-11-26
AI Technical Summary
The existing image stitching method is complex in calculations and poor in real time. It requires more matching feature points and cannot splice images of any shape, resulting in obvious seams.
Using the fast image stitching method based on feather stitching, the image to be stitched and the stitching position are obtained, the binarization processing and Boolean operation of the rectangular image area are carried out, and the initial weight parameter diagram is constructed, and the final weight is obtained by using Gaussian filtering and regularized linear stretching. Parameter graph, weighted average fusion image.
The computational complexity of the image stitching process is reduced, real-time is improved, and smooth transitions can be generated without matching feature points, and images of any shape can be stitched.
Smart Images

Figure CN119027308A_ABST
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 rapid image splicing. Background Art
[0002] In recent years, the technology in the field of computer vision has been continuously developing. In order to meet the needs of comprehensive observation of the observation area, image stitching technology has received extensive attention and continuous in-depth research. It has been applied to many fields such as military reconnaissance, medical treatment, remote sensing mapping, etc. Therefore, a fast and smooth image stitching method is of great significance.
[0003] Image stitching is the process of fusing multiple images into one image after processing. The current steps of image stitching and fusion mainly include image acquisition, image preprocessing, feature point extraction, feature point matching and image fusion. The current feature point detection of image stitching is mainly based on SIFT and SURF methods. The algorithm calculation is complex, the CPU resource consumption is huge, and it brings real-time defects. Both require that there are more matching feature points in the overlapping areas of the images to be stitched. In the case where there are no matching feature points in the overlapping areas of the images to be stitched, the fused image cannot produce a smooth transition, resulting in obvious seams in the stitched image. In addition, the current existing image stitching is mainly for images of regular shapes, and the seams are also regular shapes.
[0004] The existing technology mainly has the following defects: first, the existing image stitching method based on SURF and SIFT has complex algorithm calculation and is difficult to meet the real-time requirements of image stitching; second, in the existing image stitching method, it is often required that the overlapping areas of the images to be stitched have more matching feature points. In the case of no matching feature points, the fused image cannot produce a smooth transition, resulting in obvious seams in the stitched image; third, the current existing image stitching is mainly aimed at images of regular shapes, and the seams are also regular shapes, which cannot meet the needs of stitching images of arbitrary shapes. Summary of the invention
[0005] In view of the above analysis, the present invention aims to provide a fast image stitching method to solve the problems of existing image stitching methods, such as complex calculation, poor real-time performance, requiring more matching feature points, and being unable to stitch images of arbitrary shapes.
[0006] The present invention provides a method for rapid image stitching based on feathering stitching, the method comprising the following steps:
[0007] Obtain the target image to be stitched, the source image and the stitching position;
[0008] Expand the source image to obtain a rectangular image area b, and obtain a rectangular image area a of the target image according to the rectangular image area b and the splicing position;
[0009] Binarization is performed on the rectangular image area a and the rectangular image area b to obtain corresponding rectangular information area A and rectangular information area B;
[0010] Performing Boolean operations on the rectangular information area A and the rectangular information area B, and constructing an initial weight parameter map according to the results of the Boolean operations;
[0011] The initial weight parameter map is feathered by using Gaussian filtering, and the A intersection B region after the feathering is subjected to regularized linear stretching to obtain a final weight parameter map;
[0012] Based on the final weight parameter map, the target image and the source image are fused by weighted averaging to obtain a spliced image.
[0013] Furthermore, the result of the Boolean operation includes:
[0014] The area where A intersects B, the area where A is combined with B, the area where A intersects B is removed from A, and the area where A intersects B is removed from B;
[0015] The constructing an initial weight parameter map according to the result of the Boolean operation comprises:
[0016] The weight value of the area in A except the intersection of A and B is set to 1.0, the weight value of the area in B except the intersection of A and B is set to 0.0, and the weight value of the area in A and B is set to 0.5 to obtain the initial weight parameter map.
[0017] Furthermore, a Gaussian filter with a Gaussian kernel of 11*11 and a sigma of 50 is used to perform feathering processing on the initial weight parameter map.
[0018] Furthermore, performing regularized linear stretching on the A-B region after the feathering process to obtain a final weight parameter map includes:
[0019] The A-B region after the feathering process is traversed to obtain its maximum weight Max and minimum weight Min, and then the A-B region is subjected to regularized linear stretching by the following formula:
[0020]
[0021] Where V(x,y) is the weight value after feathering at the coordinate (x,y), norm_V(x,y) is the weight value after regularized linear stretching at this position, and L and N are both custom constants;
[0022] Replace the corresponding part of the initial weight parameter map A with the weight value after regularized linear stretching of the A intersection region B to obtain the final weight parameter map of A; replace the corresponding part of the initial weight parameter map B with the reverse mapping of the weight value after regularized linear stretching of the A intersection region B to obtain the final weight parameter map of B.
[0023] Further, based on the final weight parameter map, the target image and the source image are fused by weighted averaging to obtain a spliced image, including:
[0024] Based on the final weight parameter map, all pixels are traversed and weighted using the following formula
[0025] On average, merge the target image and the source image to obtain a stitched image:
[0026] c(x,y)=a(x,y)*norm_V(x,y)+b(x,y)*(1-norm_V(x,y));
[0027] Where a(x,y) is the pixel value at the coordinate (x,y) position of the target image, b(x,y) is the pixel value at that position of the source image, and c(x,y) is the pixel value at that position of the stitched image.
[0028] Furthermore, the source image and the target image can be of arbitrary shapes.
[0029] Further, the step of expanding the source image to obtain a rectangular image area b includes:
[0030] The source image is expanded upward, downward, leftward and rightward with the center coordinate of the source image as the center to obtain a rectangular image area b; the length of the rectangular image area b is twice the maximum length of the source image, and its width is twice the maximum width of the source image; the pixel values of the extended area are filled with 0.
[0031] Furthermore, the obtaining of the rectangular image area a of the target image according to the rectangular image area b and the stitching position includes:
[0032] In the target image, the target image is intercepted with the stitching position as the center and the size of the rectangular image area b as the size to obtain the rectangular image area a.
[0033] Furthermore, the above regions are binarized by determining whether there are non-zero pixels in the rectangular image region a and the rectangular image region b:
[0034] If the pixel value at the (x, y) position is 0, the value of the corresponding position in the rectangular information area is set to 0; if the pixel value at the (x, y) position is not 0, the value of the corresponding position in the rectangular information area is set to 1.
[0035] Furthermore, the following modules are included:
[0036] An image acquisition module is used to acquire a target image to be stitched, a source image and a stitching position;
[0037] A rectangular information area processing module is used to expand the source image to obtain a rectangular image area b, and obtain a rectangular image area a of the target image according to the rectangular image area b and the splicing position; perform binarization processing on the rectangular image area a and the rectangular image area b to obtain corresponding rectangular information areas A and B;
[0038] An initial weight parameter map processing module, used for performing Boolean operations on the rectangular information area A and the rectangular information area B, and constructing an initial weight parameter map according to the results of the Boolean operations;
[0039] A final weight parameter map processing module is used to perform feathering processing on the initial weight parameter map using Gaussian filtering, and perform regularized linear stretching on the A intersection B region after the feathering processing to obtain a final weight parameter map;
[0040] The image stitching module is used to fuse the target image and the source image by weighted averaging based on the final weight parameter map to obtain a stitched image.
[0041] Compared with the prior art, the present invention can achieve at least one of the following beneficial effects:
[0042] 1. The present invention does not rely on the matching feature points of the spliced images and does not perform image mapping, which reduces the complexity of calculations in the image splicing process and greatly reduces the amount of calculations, thereby improving the real-time performance of image splicing;
[0043] 2. The present invention constructs an initial weight parameter map by performing Boolean operations on the rectangular information area, uses Gaussian filtering to feather the initial weight parameter map, and performs regularized linear stretching on the splicing overlapping area after feathering to obtain the final weight parameter map. Based on the final weight parameter map, image fusion is performed using weighted averaging. When there are no matching feature points in the splicing overlapping area, the fused image can produce a good smooth transition effect.
[0044] 3. The present invention performs image stitching based on the processing of the weight parameter map, and is therefore not limited to images of regular shapes, and can stitch images of any shape.
[0045] In the present invention, the above-mentioned technical solutions can also be combined with each other to achieve more preferred combination solutions. Other features and advantages of the present invention will be described in the subsequent description, and some advantages can become obvious from the description, or can be understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained through the contents particularly pointed out in the description and the drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] The drawings are only for the purpose of illustrating particular embodiments and are not to be considered limiting of the present invention. Like reference symbols denote like components throughout the drawings.
[0047] Figure 1 The figure is a flow chart of a method for rapid image stitching based on feathering stitching according to an embodiment of the present invention.
[0048] Figure 2 It is the target image of the embodiment of the present invention.
[0049] Figure 3 It is the source image of the embodiment of the present invention.
[0050] Figure 4 It is a rectangular information area of the source image in the embodiment of the present invention.
[0051] Figure 5 It is a rectangular information area of the target image in the embodiment of the present invention.
[0052] Figure 6 It is the result of Boolean operation in the embodiment of the present invention.
[0053] Figure 7 This is an initial weight parameter diagram of an embodiment of the present invention.
[0054] Figure 8 This is a weight parameter diagram after feathering processing in an embodiment of the present invention.
[0055] Fig. 9 This is a weight parameter diagram after regularized linear stretching of the overlapping area according to an embodiment of the present invention.
[0056] Fig.10 It is the final weight parameter map of the rectangular information area of the target image in the embodiment of the present invention.
[0057] Fig.11 It is the final weight parameter map of the rectangular information area of the source image in the embodiment of the present invention.
[0058] Fig.12 This is the image after stitching according to the embodiment of the present invention. DETAILED DESCRIPTION
[0059] The preferred embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. Figure 1 It constitutes a part of this application and is used to illustrate the principle of the present invention together with the embodiments of the present invention, but is not used to limit the scope of the present invention.
[0060] A specific embodiment of the present invention discloses a method for rapid image stitching. Figure 1 As shown, the method comprises the following steps:
[0061] Step S1, obtaining a target image to be stitched, a source image and a stitching position.
[0062] Step S2, obtaining a rectangular image area b of the source image and a rectangular image area a of the target image; performing binarization processing on a and b to obtain corresponding rectangular information area A and rectangular information area B.
[0063] Step S3: perform Boolean operation on the rectangular information area A and the rectangular information area B, and construct an initial weight parameter map according to the result of the Boolean operation.
[0064] Step S4: Use Gaussian filtering to perform feathering processing on the initial weight parameter map, and perform regularized linear stretching on the A intersection B region after the feathering processing to obtain a final weight parameter map.
[0065] Step S5: Based on the final weight parameter map, the target image and the source image are fused by weighted averaging to obtain a spliced image.
[0066] In step S1, the image that has completed the previous stitching is called the target image, such as Figure 2 As shown in , when there is no image area in the target image, the pixel value in the area is set to 0 by default; the image collected at the current moment is called the source image, such as Figure 3 As shown in the figure, the target image and the source image can be of any shape. The coordinates of the position to be stitched on the target image are called the stitching position. The stitching position should ensure that the target image and the source image have a certain image overlap area, and the area of the area should not be less than 10% of the source image size.
[0067] In step S2, the following process is executed to obtain a rectangular image area and a rectangular information area.
[0068] Step S2.1, obtain a rectangular image area b of the source image.
[0069] Specifically, the source image is expanded upward, downward, leftward and rightward with the center coordinate of the source image as the center to obtain a rectangular image area b; preferably, the length of the rectangular image area b is twice the maximum length of the source image, and its width is twice the maximum width of the source image; the pixel values of the extended area are filled with 0.
[0070] Step S2.2, obtaining a rectangular image area a of the target image.
[0071] Specifically, in the target image, the target image is intercepted with the stitching position as the center and the size of the rectangular image area b as the size to obtain the rectangular image area a.
[0072] Step S2.3, obtaining the rectangular information area A of the source image and the rectangular information area B of the target image.
[0073] Specifically, Figure 4 and 5As shown, the above regions are binarized by judging whether there are non-zero pixels in the rectangular image region a and the rectangular image region b:
[0074] If the pixel value at the (x, y) position is 0, the value of the corresponding position in the rectangular information area is set to 0; if the pixel value at the (x, y) position is not 0, the value of the corresponding position in the rectangular information area is set to 1.
[0075] In step S3, a Boolean operation is performed on the rectangular information area A and the rectangular information area B, and an initial weight parameter map is constructed according to the result of the Boolean operation.
[0076] Step S3.1: The result of the Boolean operation includes:
[0077] The area where A intersects B, the area where A is combined with B, the area where A intersects B is removed from A, and the area where A intersects B is removed from B, such as Figure 6 shown.
[0078] Step S3.2, constructing an initial weight parameter map according to the result of the Boolean operation, comprising:
[0079] The weight value of the area in A except the intersection of A and B is set to 1.0, the weight value of the area in B except the intersection of A and B is set to 0.0, and the weight value of the area in A and B is set to 0.5 to obtain the initial weight parameter map, as shown in Figure 7 shown.
[0080] Step S4, using Gaussian filtering to perform feathering processing on the initial weight parameter map, and performing regularized linear stretching on the A intersection B region after the feathering processing to obtain a final weight parameter map.
[0081] Step S4.1, using Gaussian filtering to feather the initial weight parameter map;
[0082] Preferably, a Gaussian filter with a Gaussian kernel of 11*11 and a sigma of 50 is used to perform feathering processing on the initial weight parameter map. The processed image is as follows: Figure 8 shown.
[0083] Step S4.2, performing regularized linear stretching on the A-B region after the feathering process.
[0084] Specifically, the A-B region after the feathering process is traversed to obtain its maximum weight Max and minimum weight Min, and then the A-B region is regularized and linearly stretched using the following formula:
[0085]
[0086] Where V(x,y) is the weight value after feathering at the coordinate (x,y), norm_V(x,y) is the weight value after regularized linear stretching at that position, L and N are both custom constants, L is generally greater than 1.0, and N is greater than 0.0; the weight parameter diagram of the A-B region after regularized linear stretching is as follows Fig. 9 shown.
[0087] Step S4.3, obtain the final weight parameter map.
[0088] Replace the corresponding part of the initial weight parameter map A with the weight value after regularized linear stretching of the A-B region to obtain the final weight parameter map of A, as shown in Fig.10 As shown; replace the corresponding part of the initial weight parameter map B with the reverse mapping of the weight value after regularized linear stretching of the A-B region to obtain the final weight parameter map of B, as shown Fig.11 shown.
[0089] Step S5, based on the final weight parameter map, the target image and the source image are fused by weighted averaging to obtain a spliced image.
[0090] Specifically, based on the final weight parameter map, all pixels are traversed, and weighted averaging is performed using the following formula to fuse the target image and the source image to obtain a spliced image:
[0091] c(x,y)=a(x,y)*norm_V(x,y)+b(x,y)*(1-norm_V(x,y));
[0092] Where a(x,y) is the pixel value at the coordinate (x,y) position of the target image, b(x,y) is the pixel value at that position of the source image, and c(x,y) is the pixel value at that position of the stitched image. The stitched image is as follows Fig.12 shown.
[0093] Compared with the prior art, the present invention provides a fast image stitching method based on feathering stitching. Firstly, the method does not rely on the matching feature points of the stitching images and does not perform image mapping, thereby reducing the complexity of calculations in the image stitching process and greatly reducing the amount of calculations, thereby improving the real-time performance of image stitching. Secondly, an initial weight parameter map is constructed by performing Boolean operations on rectangular information areas, and Gaussian filtering is used to feather the initial weight parameter map, and regularized linear stretching is performed on the stitching overlap area after the feathering process to obtain a final weight parameter map. Based on the final weight parameter map, image fusion is performed using weighted averaging. When there are no matching feature points in the stitching overlap area, the fused image can produce a good smooth transition effect. Finally, image stitching is performed based on the processing of the weight parameter map, so it is not limited to images of regular shapes, and images of any shape can be stitched.
[0094] Those skilled in the art will appreciate that all or part of the processes of the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium, wherein the computer-readable storage medium is a disk, an optical disk, a read-only storage memory, or a random access memory, etc.
[0095] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by any technician familiar with the technical field within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention.
Claims
1. A method for rapid image stitching based on feathering stitching, characterized in that: The method comprises the following steps: Obtain the target image to be stitched, the source image and the stitching position; Expand the source image to obtain a rectangular image area b, and obtain a rectangular image area a of the target image according to the rectangular image area b and the splicing position; Binarization is performed on the rectangular image area a and the rectangular image area b to obtain corresponding rectangular information area A and rectangular information area B; Performing Boolean operations on the rectangular information area A and the rectangular information area B, and constructing an initial weight parameter map according to the results of the Boolean operations; The initial weight parameter map is feathered by Gaussian filtering, and the A-B region after the feathering is subjected to regularized linear stretching to obtain a final weight parameter map; Based on the final weight parameter map, the target image and the source image are fused by weighted averaging to obtain a spliced image.
2. The method for rapid image stitching according to claim 1, characterized in that: The results of the Boolean operation include: The area where A intersects B, the area where A is combined with B, the area where A intersects B is removed from A, and the area where A intersects B is removed from B; The constructing an initial weight parameter map according to the result of the Boolean operation comprises: The weight value of the area in A except the intersection of A and B is set to 1.0, the weight value of the area in B except the intersection of A and B is set to 0.0, and the weight value of the area in A and B is set to 0.5 to obtain the initial weight parameter map.
3. The method for rapid image stitching according to claim 2, characterized in that: A Gaussian filter with a Gaussian kernel of 11*11 and a sigma of 50 is used to perform feathering processing on the initial weight parameter map.
4. The method for rapid image stitching according to claim 3, characterized in that: The step of performing regularized linear stretching on the A-B region after the feathering process to obtain a final weight parameter map comprises: The A-B region after the feathering process is traversed to obtain its maximum weight Max and minimum weight Min, and then the A-B region is regularized and linearly stretched using the following formula: Where V(x,y) is the weight value after feathering at the coordinate (x,y), norm_V(x,y) is the weight value after regularized linear stretching at this position, and L and N are both custom constants; Replace the corresponding part of the initial weight parameter map A with the weight value after regularized linear stretching of the A intersection region B to obtain the final weight parameter map of A; replace the corresponding part of the initial weight parameter map B with the reverse mapping of the weight value after regularized linear stretching of the A intersection region B to obtain the final weight parameter map of B.
5. The method for rapid image stitching according to claim 4, characterized in that: Based on the final weight parameter map, the target image and the source image are fused by weighted averaging to obtain a spliced image, including: Based on the final weight parameter map, all pixels are traversed, and weighted average is performed using the following formula to fuse the target image and the source image to obtain a spliced image: c(x,y)=a(x,y)*norm_V(x,y)+b(x,y)*(1-norm_V(x,y)); Where a(x,y) is the pixel value at the coordinate (x,y) position of the target image, b(x,y) is the pixel value at that position of the source image, and c(x,y) is the pixel value at that position of the stitched image.
6. The method for rapid image stitching according to claim 1, characterized in that: The source and target images can be of arbitrary shapes.
7. The method for rapid image stitching according to claim 1, characterized in that: The step of expanding the source image to obtain a rectangular image area b comprises: The source image is expanded upward, downward, leftward and rightward with the center coordinate of the source image as the center to obtain a rectangular image area b; the length of the rectangular image area b is twice the maximum length of the source image, and its width is twice the maximum width of the source image; the pixel values of the extended area are filled with 0.
8. The method for rapid image stitching according to claim 7, characterized in that: The step of obtaining the rectangular image area a of the target image according to the rectangular image area b and the splicing position includes: In the target image, the target image is intercepted with the stitching position as the center and the size of the rectangular image area b as the size to obtain the rectangular image area a.
9. The method for rapid image stitching according to claim 8, characterized in that: The above regions are binarized by judging whether there are non-zero pixels in rectangular image region a and rectangular image region b: If the pixel value at the (x, y) position is 0, the value of the corresponding position in the rectangular information area is set to 0; if the pixel value at the (x, y) position is not 0, the value of the corresponding position in the rectangular information area is set to 1.
10. A rapid image stitching system based on feathering stitching, characterized in that: Includes the following modules: An image acquisition module is used to acquire a target image to be stitched, a source image and a stitching position; A rectangular information area processing module is used to expand the source image to obtain a rectangular image area b, and obtain a rectangular image area a of the target image according to the rectangular image area b and the splicing position; perform binarization processing on the rectangular image area a and the rectangular image area b to obtain corresponding rectangular information areas A and B; An initial weight parameter map processing module, used for performing Boolean operations on the rectangular information area A and the rectangular information area B, and constructing an initial weight parameter map according to the results of the Boolean operations; A final weight parameter map processing module is used to perform feathering processing on the initial weight parameter map using Gaussian filtering, and perform regularized linear stretching on the A intersection B region after the feathering processing to obtain a final weight parameter map; The image stitching module is used to fuse the target image and the source image by weighted averaging based on the final weight parameter map to obtain a stitched image.
Citation Information
Cited By
Image splicing and fusion method and device based on two-dimensional mean filtering and server
CN121437284A
