An image seamless splicing method, system, device and medium based on offset pre-alignment and Poisson fusion
By using offset pre-alignment and Poisson fusion, the problem of computational and storage burden in microscopic image stitching is solved, achieving efficient and low-complexity image stitching and improving stitching quality and speed.
Patent Information
- Application Number
- CN202611462569.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-20
- Publication Date
- 2026-11-06
AI Technical Summary
Existing technologies for microscopic image stitching suffer from high overhead in raw data storage and computation, leading to a heavy burden on hardware and high computational complexity of the Poisson algorithm, making it difficult to achieve stable operation under limited space and computing power.
A method based on offset pre-alignment and Poisson fusion is adopted. By clearly selecting overlapping lines, calculating structured data, setting a threshold for the fusion region, and fusing with the Poisson algorithm, the fusion region is reduced, and only a small amount of the original image is retained, thus achieving efficient stitching.
While ensuring the quality of fusion, it reduces the amount of computation and storage required, improves the convergence speed of numerical solutions, meets real-time requirements, and improves texture gradient and color continuity, eliminating splicing marks.
Smart Images

Figure CN123051675A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image data processing, and in particular to a method, system, apparatus and medium for seamless image stitching based on offset pre-alignment and Poisson fusion. Background Technology
[0002] The Poisson fusion method has limited applications in microscopic image stitching because it requires the original data. In typical microscopic image stitching hardware environments, storage space and computing power are usually limited. The cumulative storage of the original images and the computational overhead of the Poisson algorithm can easily lead to instability in the entire stitching system. Therefore, how to effectively reduce the size of the fusion region while retaining as little original data as possible, thereby reducing the burden on hardware and the computational complexity of the Poisson algorithm, has become a critical problem that urgently needs to be solved. Summary of the Invention
[0003] Based on this, a seamless image stitching method based on offset pre-alignment and Poisson fusion is proposed. This method retains only a small portion of the original image and a small fusion region, achieving efficient stitching with small space and low computational cost while ensuring fusion quality.
[0004] The specific plan is as follows: A seamless image stitching method based on offset pre-alignment and Poisson fusion includes: S100. Clarify the selection of overlapping lines. S200: Use an overlapping line detection algorithm to calculate the structured data of overlapping lines. S300, Preset fusion region threshold Usage S400, Calculate the fusion region based on the overlapping lines. S500: Stitch the current image block to the specified position. S600 uses the Poisson algorithm to fuse the original data onto the already stitched image. S700, Repeat steps S200 to S600 until all image blocks are stitched together.
[0005] In one embodiment, In step S100, the selection of the explicit overlapping lines specifically includes: the image blocks in the first column have one splicing line as the top line, or two splicing lines, namely the top line and the left line; the image blocks in the second column have two splicing lines, namely the left line and the top line or the left line and the bottom line, or the image blocks in the second column have three splicing lines, namely the top line, the bottom line and the left line.
[0006] In one embodiment, In step S200, the calculation of structured data of overlapping lines using the overlapping line detection algorithm specifically includes: identifying all overlapping lines between the current image block and adjacent image blocks in the upper, left, and lower directions, and finally obtaining a set of overlapping lines. Each overlapping line records its own spatial position and overlap width: line type Line_Type, start point Start_p, end point End_p, and overlap width Overlap_w.
[0007] In one embodiment, In step S300, the preset fusion region threshold Usage specifically includes: the fusion region threshold Usage is manifested as an upward and downward expansion centered on the overlapping line at the upper and lower limits. Each pixel, on the left line, is represented by an expansion to the left and right centered on the overlapping line. 1 pixel.
[0008] In one embodiment, In step S400, calculating the fusion region based on the overlapping lines specifically includes: S410. Traverse all overlapping lines and calculate the merging region: If the overlapping line is the upper line, the merging region extends upwards and downwards from the overlapping line as the center. A rectangular area of 1 pixel, If the overlapping line is the left line, the merging region expands to the left and right respectively, centered on the overlapping line. A rectangular area of 1 pixel, If the overlapping line is the bottom line, the merging region extends upwards and downwards from the overlapping line as the center. A rectangular area of 1 pixel, S420. Based on the fusion region calculated in S410, retain the original image data before stitching. gather.
[0009] In one embodiment, In step S500, stitching the current image block to the designated position specifically includes: treating the already stitched image as a whole, stitching the current image block to the designated position in a covering manner, at which time there is a stitching line in the fusion area.
[0010] In one embodiment, In step S600, the step of using the Poisson algorithm to fuse the original data onto the stitched image specifically includes: traversing each set of fusion regions constructed in step S400 and their associated original image data; for the current fusion region, locating the original image block participating in the fusion of the region according to its spatial location index; and using the Poisson algorithm to seamlessly fuse the original image block into the specified fusion region.
[0011] A seamless image stitching system based on offset pre-alignment and Poisson fusion includes: The image acquisition module is used to acquire image blocks to be stitched together. An image stitching module is used to stitch together various image blocks according to the seamless image stitching method described above.
[0012] A computer device includes a processor, a memory, a communication interface, and a communication bus. The processor, memory, and communication interface communicate with each other via the communication bus. The memory stores at least one executable instruction, which causes the processor to perform an operation corresponding to the image seamless stitching method based on offset pre-alignment and Poisson fusion.
[0013] A computer storage medium storing at least one executable instruction that causes a processor to perform the operation of the image seamless stitching method based on offset pre-alignment and Poisson fusion.
[0014] The beneficial effects of this application are as follows: The method in this application retains only a small portion of the original image and a small fusion area, achieving efficient stitching with small space and low computational cost while ensuring fusion quality.
[0015] The fusion region in this application is relatively small in spatial scale, and the solution domain of the Poisson equation is limited in size, resulting in a low-dimensional sparse matrix involved in the computation. This characteristic brings two significant advantages: First, the convergence speed of the numerical solution is significantly improved, enabling gradient field reconstruction of the region in milliseconds, meeting the real-time requirements of high-throughput stitching scenarios; second, the small-scale solution domain reduces the interference of boundary conditions on the fusion result, allowing the algorithm to more accurately maintain the texture gradient and color continuity of the original image, thereby achieving optimal local fusion quality while eliminating stitching artifacts. Attached Figure Description
[0016] Figure 1 This is a flowchart of the seamless image stitching method based on offset pre-alignment and Poisson fusion proposed in this application.
[0017] Figure 2 This is a schematic diagram of the seamless image stitching system based on offset pre-alignment and Poisson fusion according to this application.
[0018] Figure 3 This is a schematic diagram of stitching together a panoramic digital microscopic image.
[0019] Figure 4 This is a schematic diagram showing the stitching of the upper and lower image blocks of the first column of images.
[0020] Figure 5 This is a schematic diagram of the stitching of the second column of image blocks.
[0021] Figure 6 This is a schematic diagram showing the positional relationship between the current image patch and its neighboring image patches in the coordinate system.
[0022] Figure 7 This is a schematic diagram of the merged area. Detailed Implementation
[0023] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Many specific details are set forth in the following description to provide a thorough understanding of the present invention. However, the present invention can be practiced in many other ways different from those described herein, and those skilled in the art can make similar modifications without departing from the spirit of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0024] like Figure 1 As shown, the first embodiment of this application provides a seamless image stitching method based on offset pre-alignment and Poisson fusion, the method comprising: S100. Clarify the selection of overlapping lines, which are also known as overlapping boundary lines. S200: Use an overlapping line detection algorithm to calculate the structured data of overlapping lines. S300, Preset fusion region threshold Usage S400, Calculate the fusion region based on the overlapping lines. S500: Stitch the current image block to the specified position. S600 uses the Poisson algorithm to fuse the original data onto the already stitched image. S700, Repeat steps S200 to S600 until all image blocks are stitched together. This results in a seamless, large image.
[0025] It should be noted that all image blocks (fragments) in the method of this application have undergone pre-alignment for conflict resolution. Image block stitching is essentially the process of sequentially pasting images onto a region.
[0026] In one embodiment, step S100, the selection of the explicit overlapping line specifically includes: the image blocks in the first column have one splicing line as the top line, or two splicing lines, namely the top line and the left line; the image blocks in the second column have two splicing lines, namely the left line and the top line or the left line and the bottom line, or the image blocks in the second column have three splicing lines, namely the top line, the bottom line and the left line.
[0027] Specifically, in the process of microscopic scanning imaging, the scanning system typically uses a linear scan camera or an area scan camera to sequentially acquire a series of local images (i.e., "patterns") along a serpentine or progressive raster path "from left to right and from top to bottom" to stitch together a panoramic image. For each slice sample, its panoramic image is often composed of thousands or even tens of thousands of such local patches. Ideally, adjacent patches should be perfectly aligned end-to-end, such as... Figure 3 As shown on the left, the stitched image is complete and without redundancy. However, in practical engineering applications, due to factors such as mechanical motion precision, camera trigger delay, and optical distortion, if the image patches are only connected at the critical points, gaps or misalignments can easily occur at the stitching boundaries. Therefore, the system usually pre-sets a certain overlap area—that is, during acquisition, the image patches between adjacent rows or columns retain some overlapping pixels in both the horizontal and vertical directions, such as... Figure 3 As shown on the right. This overlapping design not only provides sufficient matching features for subsequent image registration and fusion, but also effectively eliminates stitching marks and compensates for motion errors, thereby ensuring the geometric continuity and visual consistency of the final panoramic image.
[0028] Before calculating the overlap lines between adjacent image patches, the selection of overlap lines needs to be determined. There are two cases of image patch overlap: for the first column of images, only vertically adjacent image patches need to be stitched together. From... Figure 4 It can be seen that stitching image blocks from top to bottom will leave two stitching marks: one on the top line and one on the right or left line. Because pre-alignment resolves conflicts, the stitching mark on the right line will inevitably be covered by the next image and can be ignored. Therefore, the first column of images will have one stitching line (top line) or two stitching lines (top and left lines); while the image blocks starting from the second column will have both top-bottom and left-right stitching marks, such as... Figure 5 As shown, from Figure 5 As can be seen from this, ignoring the right overlapping line will result in two splicing lines (left line and top line, or left line and bottom line) or three splicing lines (top line, bottom line and left line).
[0029] In one embodiment, step S200, which uses the overlapping line detection algorithm to calculate the structured data of the overlapping lines, specifically includes: identifying all overlapping lines between the current image block and adjacent image blocks in the upper, left, and lower directions, and finally obtaining a set of overlapping lines. Each overlapping line records its own spatial position and overlap width: line type Line_Type, start point Start_p, end point End_p, and overlap width Overlap_w.
[0030] Specifically, such as Figure 6 As shown, step S200 may include the following steps: S210. Obtain the actual coordinates and size information of the current image patch. Obtain the ideal original coordinates of the current image patch. and The coordinates of the top-left corner of the current image patch in the actual image are obtained by calculating the splicing offset. and and the width of the image block With height .
[0031] S220. Obtain the actual coordinates and size information of adjacent image blocks. When the current image is stitched together, there are only four types of adjacent image blocks that will overlap: top, left, bottom left, and top left. The types of adjacency and their coordinate systems are as follows: Figure 6 As shown. Similarly, based on the ideal original coordinates and the stitching offset, the position coordinates of the upper left corner of the adjacent image block in the actual image are calculated. The upper image block... and left image block and Top left image block and lower left image block and If a neighboring image patch does not exist or its coordinates are outside the valid range, the corresponding coordinate value is set to a preset invalid value of -9999. This step ensures that the positions of neighboring image patches used in subsequent overlap line calculations are all in the same actual coordinate system as the current image patch.
[0032] S230. Online Detection. The three adjacency scenarios for online status are shown below.
[0033] The first scenario: The left-side image patch does not exist, i.e. and The image block above exists, that is and ,and .
[0034] The second scenario: The image patch on the left exists, i.e. and The image block above exists, that is and .
[0035] The third scenario: The image patch on the left exists, i.e. and The image block above does not exist, that is and ,and .
[0036] For the first and second scenarios, the upper limit is calculated based on the upper image patch. The overlap width is calculated based on the bottom position of the upper image patch and the top position of the current image patch. .
[0037] In the third case, the upper limit is calculated based on the left image patch. The overlap width is calculated based on the bottom position of the overlapping left image patch and the top position of the current image patch. .
[0038] After the calculation is complete, a horizontal overlapping line (top line) is generated, and its line type is recorded. ,starting point ,end and overlap width Among them, those that went online , for , as follows: .
[0039] S240. Left line detection. A left line will only exist if a left-side image patch is present. The two adjacency scenarios for the left line are shown below.
[0040] The first scenario: The image patch on the left exists, i.e. and The lower left image patch either does not exist or exists but is not within the overlapping area, i.e. and or .
[0041] The second scenario: The image patch on the left exists, i.e. and The lower left image patch exists and is within the overlapping area, i.e. and and .
[0042] The third scenario: The image patch on the left does not exist, i.e. and The image block above exists, that is and .
[0043] In the first case, the overlap width refers to the horizontal overlap distance between the left side of the current image patch and the right side of the adjacent left image patch. .
[0044] In the second scenario, the overlap width should be the smaller of the overlap widths of the left and lower left image blocks, because the left line needs to be aligned with both adjacent blocks simultaneously. .
[0045] For the third case .
[0046] After the calculation is complete, a vertically overlapping line (left line) is generated, and its line type is recorded. ,starting point ,end and overlap width Among them, the left line , for , as follows: .
[0047] S250. Bottom line detection. The bottom line is the line that overlaps between the current image block and the image block to its left or lower left.
[0048] The first scenario: If the lower left image block exists, i.e. and And the bottom coordinates of the current image patch extend beyond the top of the bottom left image patch, i.e. .
[0049] The second scenario: If the lower left image block exists, i.e. and The bottom of the current image block is located between the top of the left image block and the top of the bottom left image block, i.e. and .
[0050] The third scenario: The lower left image block does not exist, i.e. and However, the image patch on the left exists, that is... and And the bottom of the current image block is higher than the top of the image block to the left, that is .
[0051] In the first case, the overlap width refers to the vertical overlap distance between the bottom edge of the current image block and the top edge of the adjacent bottom-left image block. .
[0052] For the second and third cases, the overlap width refers to the vertical overlap distance between the bottom edge of the current image block and the top edge of the adjacent image block to the left. .
[0053] After the calculation is complete, a horizontal overlapping line (bottom line) is generated, and its line type is recorded. ,starting point ,end and overlap width Among them, the offline , for , as follows: .
[0054] S260. Through three detection steps S230-S250, all overlapping boundary lines between the current image block and adjacent image blocks in the upper, left, and lower directions can be systematically identified, ultimately resulting in a set of overlapping lines. Each line records its spatial position and overlap width: line type. ,starting point ,end and overlap width This provides complete alignment information for subsequent image stitching.
[0055] In one embodiment, in step S300, a preset fusion region threshold Usage needs to be defined before calculating the fusion region. The preset fusion region threshold Usage specifically includes: the value of the threshold Usage is usually positively correlated with the preset overlapping region size, generally set as a fixed percentage of the overlapping region width (e.g., 50%), or directly expressed as the minimum effective overlapping distance in pixels. The fusion region threshold Usage is manifested as an upward and downward extension centered on the overlapping line at the upper and lower limits. Each pixel, on the left line, is represented by an expansion to the left and right centered on the overlapping line. 1 pixel.
[0056] In one embodiment, such as Figure 7 As shown, in step S400, calculating the fusion region based on the overlapping lines specifically includes: S410. Traverse all overlapping lines and calculate the merging region: If the overlapping line is the upper line, the merging region extends upwards and downwards from the overlapping line as the center. A rectangular area of 1 pixel,
[0057]
[0058] If the overlapping line is the left line, the merging region expands to the left and right respectively, centered on the overlapping line. A rectangular area of 1 pixel,
[0059]
[0060] If the overlapping line is the bottom line, the merging region extends upwards and downwards from the overlapping line as the center. A rectangular area of 1 pixel,
[0061]
[0062] S420. Collect the original image data before stitching. Based on the fusion region calculated in S410, retain the original image data before stitching. gather.
[0063] The final result is a set of fusion regions containing complete information from the original images. This set not only represents the overlap between image patches, but also aggregates the texture details and luminance features of each original image at the corresponding location. This provides accurate gradient field boundary conditions for Poisson fusion, effectively improving the accuracy and robustness of the fusion algorithm in eliminating stitching artifacts.
[0064] In one embodiment, step S500, stitching the current image block to the designated position, specifically includes: treating the already stitched image as a whole, stitching the current image block to the designated position in an overlapping manner, at which time the fusion area has a stitching line.
[0065] In one embodiment, step S600, which involves using the Poisson algorithm to fuse the original data onto the stitched image, specifically includes: traversing each set of fusion regions constructed in step S400 and their associated original image data; for the current fusion region, locating the original image block participating in the fusion of that region based on its spatial location index; and using the Poisson algorithm to seamlessly fuse the original image block into the specified fusion region.
[0066] Specifically, with Figure 7 The fusion region corresponding to the overlapping line on the left is shown as an example for illustration. Because this fusion region is relatively small in spatial scale, the solution domain of the Poisson equation is limited, resulting in a low-dimensional sparse matrix involved in the calculation. This characteristic brings two significant advantages: first, the convergence speed of the numerical solution is significantly improved, enabling gradient field reconstruction of this region in milliseconds, meeting the real-time requirements of high-throughput stitching scenarios; second, the small-scale solution domain reduces the interference of boundary conditions on the fusion result, allowing the algorithm to more accurately maintain the texture gradient and color continuity of the original image, thereby achieving optimal local fusion quality while eliminating stitching artifacts.
[0067] like Figure 2 As shown, a second embodiment of this application provides a seamless image stitching system based on offset pre-alignment and Poisson fusion, comprising: The image acquisition module is used to acquire image blocks to be stitched together. An image stitching module is used to stitch together various image blocks according to the seamless image stitching method described above.
[0068] A third embodiment of this application provides a computer device, including: a processor, a memory, a communication interface, and a communication bus. The processor, memory, and communication interface communicate with each other through the communication bus. The memory is used to store at least one executable instruction, which causes the processor to perform the operation corresponding to the image seamless stitching method based on offset pre-alignment and Poisson fusion.
[0069] A fourth embodiment of this application provides a computer storage medium storing at least one executable instruction that causes a processor to perform the operation of the image seamless stitching method based on offset pre-alignment and Poisson fusion.
[0070] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0071] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these all fall within the protection scope of the present invention. Therefore, the protection scope of this invention patent should be determined by the appended claims.
Claims
1. A seamless image stitching method based on offset pre-alignment and Poisson fusion, characterized in that, include: S100. Clarify the selection of overlapping lines. S200: Use an overlapping line detection algorithm to calculate the structured data of overlapping lines. S300, Preset fusion region threshold Usage S400, Calculate the fusion region based on the overlapping lines. S500: Stitch the current image block to the specified position. S600 uses the Poisson algorithm to fuse the original data onto the already stitched image. S700, Repeat steps S200 to S600 until all image blocks are stitched together.
2. The seamless image stitching method based on offset pre-alignment and Poisson fusion according to claim 1, characterized in that, In step S100, the selection of the explicit overlapping lines specifically includes: the image blocks in the first column have one splicing line as the top line, or two splicing lines, namely the top line and the left line; the image blocks in the second column have two splicing lines, namely the left line and the top line or the left line and the bottom line, or the image blocks in the second column have three splicing lines, namely the top line, the bottom line and the left line.
3. The seamless image stitching method based on offset pre-alignment and Poisson fusion according to claim 1, characterized in that, In step S200, the calculation of structured data of overlapping lines using the overlapping line detection algorithm specifically includes: identifying all overlapping lines between the current image block and adjacent image blocks in the upper, left, and lower directions, and finally obtaining a set of overlapping lines. Each overlapping line records its own spatial position and overlap width: line type Line_Type, start point Start_p, end point End_p, and overlap width Overlap_w.
4. The seamless image stitching method based on offset pre-alignment and Poisson fusion according to claim 1, characterized in that, In step S300, the preset fusion region threshold Usage specifically includes: the fusion region threshold Usage is manifested as an upward and downward expansion centered on the overlapping line at the upper and lower limits. Each pixel, on the left line, is represented by an expansion to the left and right centered on the overlapping line. 1 pixel.
5. The seamless image stitching method based on offset pre-alignment and Poisson fusion according to claim 1, characterized in that, In step S400, calculating the fusion region based on the overlapping lines specifically includes: S410. Traverse all overlapping lines and calculate the merging region: If the overlapping line is the upper line, the merging region extends upwards and downwards from the overlapping line as the center. A rectangular area of 1 pixel, If the overlapping line is the left line, the merging region expands to the left and right respectively, centered on the overlapping line. A rectangular area of 1 pixel, If the overlapping line is the bottom line, the merging region extends upwards and downwards from the overlapping line as the center. A rectangular area of 1 pixel, S420. Based on the fusion region calculated in S410, retain the original image data before stitching. gather.
6. The seamless image stitching method based on offset pre-alignment and Poisson fusion according to claim 1, characterized in that, In step S500, stitching the current image block to the designated position specifically includes: treating the already stitched image as a whole, stitching the current image block to the designated position in a covering manner, at which time there is a stitching line in the fusion area.
7. The seamless image stitching method based on offset pre-alignment and Poisson fusion according to claim 1, characterized in that, In step S600, the step of using the Poisson algorithm to fuse the original data onto the stitched image specifically includes: traversing each set of fusion regions constructed in step S400 and their associated original image data; for the current fusion region, locating the original image block participating in the fusion of the region according to its spatial location index; and using the Poisson algorithm to seamlessly fuse the original image block into the specified fusion region.
8. A seamless image stitching system based on offset pre-alignment and Poisson fusion, characterized in that, include: The image acquisition module is used to acquire image blocks to be stitched together. An image stitching module is used to stitch together individual image blocks according to the seamless image stitching method according to any one of claims 1 to 7.
9. A computer device, characterized in that, include: The processor, memory, communication interface, and communication bus are provided. The processor, memory, and communication interface communicate with each other through the communication bus. The memory is used to store at least one executable instruction, which causes the processor to perform the operation corresponding to the image seamless stitching method based on offset pre-alignment and Poisson fusion as described in any one of claims 1 to 7.
10. A computer storage medium, characterized in that, The computer storage medium stores at least one executable instruction that causes the processor to perform the operation of the image seamless stitching method based on offset pre-alignment and Poisson fusion as described in any one of claims 1 to 7.
