Image splicing method and device, electronic equipment and storage medium

By performing image registration and region segmentation on cell images, and combining improved energy functions and dynamic programming algorithms, the problems of cell breakage and duplication in cell image stitching were solved, achieving high-quality seamless stitching results.

CN121860849APending Publication Date: 2026-04-14APPLITECH BIOLOGICAL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-30
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

Traditional cell image stitching techniques are prone to cell breakage and duplication when cell samples are slightly displaced, resulting in poor stitching quality.

Method used

Image registration is performed on the cell images to be stitched to determine the overlapping regions. Within the overlapping regions, cell regions, dilated regions, and background regions are divided. The cumulative cost information of pixels is calculated using an improved energy function and dynamic programming algorithm to determine the associated pixels and the target stitching position for image stitching.

Benefits of technology

Seamless stitching of cell images was achieved, avoiding cell cutting and repetition, and improving stitching accuracy and quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121860849A_ABST
    Figure CN121860849A_ABST
Patent Text Reader

Abstract

The invention provides an image splicing method and device, electronic equipment and a storage medium, and relates to the technical field of microscopic imaging. Comprising the following steps: determining an overlapping region between a first cell image and a second cell image to be spliced; performing intra-region division on the overlapped region to obtain a target processing region; according to the target processing area, the pixel information of the first cell image and the pixel information of the second cell image, accumulated cost information of each pixel point in the target processing area is determined; determining associated pixel points corresponding to the pixel points according to the accumulated cost information of the effective neighborhood pixel points corresponding to the pixel points; and determining a target splicing position in the overlapping area according to the end point pixel point in the target processing area and the associated pixel points corresponding to the pixel points. Based on the method, a better splicing position can be determined, seamless splicing of the image is satisfied, cells are not cut, and the problem of repeated cells in the spliced image caused by cell movement is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of microscopic imaging technology, and more specifically, to an image stitching method, apparatus, electronic device, and storage medium. Background Technology

[0002] Image stitching technology is now widely used in the field of medical microscopy to achieve seamless stitching of multiple images, meeting the needs for panoramic observation and analysis in different scenarios.

[0003] In the field of microscopic imaging, traditional cell image stitching techniques involve directly fusing cell regions from adjacent images.

[0004] Because cell samples inevitably undergo slight displacement during collection, traditional methods result in cell breakage and duplication, leading to poor cell image stitching quality. Summary of the Invention

[0005] The purpose of this application is to address the shortcomings of the prior art by providing an image stitching method, apparatus, electronic device, and storage medium to determine a better stitching seam position, thereby achieving precise stitching of cell images in scenarios involving minute cell movements and improving stitching accuracy.

[0006] To achieve the above objectives, the technical solutions adopted in the embodiments of this application are as follows: In a first aspect, embodiments of this application provide a cell image stitching method, including: Image registration is performed on the first cell image and the second cell image to be stitched together to determine the overlapping area between the first cell image and the second cell image; Based on the overlapping region, a first cell region is determined from the first cell image, and a second cell region is determined from the second cell image; Based on the first cell region and the second cell region, the overlapping region is divided into regions to obtain the target processing region, which includes: cell region, dilated region and background region; Based on the target processing area, the pixel information of the first cell image, and the pixel information of the second cell image, the cumulative cost of each pixel in the target processing area is calculated to determine the cumulative cost information of each pixel. Based on the cumulative cost information of the effective neighboring pixels corresponding to each pixel, the associated pixels corresponding to each pixel are determined. Based on the endpoint pixel in the target processing area and the associated pixel corresponding to each pixel, the target stitching position in the overlapping area is determined, and the first cell image and the second cell image are stitched together according to the target stitching position to obtain the target stitched image.

[0007] Optionally, determining a first cell region from the first cell image and a second cell region from the second cell image based on the overlapping region includes: Image foreground segmentation is performed on the overlapping region in the first cell image to determine the first cell region; Image foreground segmentation is performed on the overlapping region in the second cell image to determine the second cell region.

[0008] Optionally, the step of dividing the overlapping region into regions based on the first cell region and the second cell region to obtain the target processing region includes: The first cell region and the second cell region are combined to obtain the cell region. The cell region is expanded according to a preset expansion size to obtain an expanded region; The region in the overlapping region other than the cell region and the swelling region is used as the background region. The cell region, the swollen region, and the background region are used as the target processing region.

[0009] Optionally, the step of calculating the cumulative cost of each pixel within the target processing area based on the target processing area, the pixel information of the first cell image, and the pixel information of the second cell image, and determining the cumulative cost information of each pixel, includes: Starting with the target vertex in the target processing area as the starting pixel, each pixel in the target processing area is traversed sequentially according to a preset traversal direction. For the current pixel that has been traversed, the energy cost information of the current pixel is determined based on the grayscale information of the current pixel in the first cell image, the grayscale information of the current pixel in the second cell image, and the constraint parameters corresponding to the current pixel. The cumulative cost information of the current pixel is determined based on the energy cost information of the current pixel and the cumulative cost information of the effective neighboring pixels corresponding to the current pixel.

[0010] Optionally, the constraint parameters corresponding to the current pixel are determined in the following manner: The first parameter value of the current pixel is determined based on the sub-region where the current pixel is located in the target processing area; Based on the grayscale information of each pixel within the cell region in the target processing area, the cell contrast is determined, and based on the cell contrast, the penalty parameter value is determined. The constraint parameters corresponding to the current pixel are determined based on the first parameter value of the current pixel, the penalty parameter value, and the preset weight coefficient.

[0011] Optionally, determining the first parameter value of the current pixel based on the sub-region where the current pixel is located in the target processing region includes: If the current pixel belongs to a cell region in the target processing area, then the first parameter value of the current pixel is determined to be a first value. If the current pixel belongs to the dilated region in the target processing area, then the first parameter value of the current pixel is determined to be the second value; If the current pixel belongs to the background region of the target processing region, then the first parameter value of the current pixel is determined to be the third value.

[0012] Optionally, determining the energy cost information of the current pixel based on the grayscale information of the current pixel in the first cell image, the grayscale information of the current pixel in the second cell image, and the constraint parameters corresponding to the current pixel includes: Based on the grayscale information of the current pixel in the first cell image and the grayscale information of the current pixel in the second cell image, determine the grayscale difference information of the current pixel; The energy cost information of the current pixel is determined based on the grayscale difference information of the current pixel and the constraint parameters corresponding to the current pixel.

[0013] Optionally, determining the cumulative cost information of the current pixel based on the energy cost information of the current pixel and the cumulative cost information of the effective neighboring pixels corresponding to the current pixel includes: Based on the traversal row where the current pixel is located, determine the previous traversal row corresponding to the current pixel; Based on the coordinate information of the current pixel, at least one effective neighboring pixel corresponding to the current pixel is determined from the previous traversal, and the cumulative cost information of each effective neighboring pixel is determined. Based on the cumulative cost information of each effective neighboring pixel, the effective neighboring pixel with the smallest cumulative cost information is determined as the target neighboring pixel corresponding to the current pixel. The cumulative cost information of the current pixel is determined based on the energy cost information of the current pixel and the cumulative cost information of the target neighboring pixels.

[0014] Optionally, determining the associated pixel corresponding to each pixel based on the cumulative cost information of the effective neighboring pixels corresponding to each pixel includes: The target neighboring pixels are used as the associated pixels corresponding to the current pixel.

[0015] Optionally, determining the target stitching position within the overlapping area based on the endpoint pixel within the target processing area and the associated pixels corresponding to each pixel includes: Based on the cumulative cost information of each pixel in the endpoint traversal row, the pixel with the smallest cumulative cost information in the endpoint traversal row is determined as the endpoint pixel in the target processing area. Starting from the endpoint pixel, based on the associated pixels corresponding to each pixel, traverse backwards to the starting traversal row, and determine the splicing pixels in each traversal row in turn. The target stitching position is obtained by arranging the stitched pixels in order according to the traversal rows.

[0016] Optionally, the step of stitching the first cell image and the second cell image together according to the target stitching position to obtain the target stitched image includes: Based on the coordinate information of each splicing pixel in the target splicing position and the preset transition size, the transition range of the row where each splicing pixel is located is determined. Based on the transition range of each stitched pixel in the row and the horizontal dimension of the stitched image to be generated, the stitched image to be generated is divided into multiple sub-processing regions; the multiple sub-processing regions include: a first region, a transition region, and a second region; the relative positional relationship between the first region and the second region is consistent with the relative positional relationship between the first cell image and the second cell image; Based on the sub-processing region to which each pixel to be calculated belongs in the stitched image to be generated, the image stitching strategy corresponding to each sub-processing region is adopted to determine the grayscale information corresponding to each pixel to be calculated. The target stitched image is generated based on the grayscale information corresponding to each pixel to be calculated.

[0017] Optionally, the step of determining the grayscale information corresponding to each pixel to be calculated based on the sub-processing region to which each pixel belongs in the stitched image to be generated, and adopting the image stitching strategy corresponding to each sub-processing region, includes: If the pixel to be calculated belongs to the first region, then the grayscale information of the pixel to be calculated in the first cell image is used as the grayscale information corresponding to the pixel to be calculated. If the pixel to be calculated belongs to the transition region, then the grayscale information corresponding to the pixel to be calculated is determined based on the grayscale information of the pixel to be calculated in the first cell image, the grayscale information of the pixel to be calculated in the second cell image, the fusion weight of the first cell image corresponding to the pixel to be calculated, and the fusion weight of the second cell image corresponding to the pixel to be calculated. If the pixel to be calculated belongs to the second region, then the grayscale information of the pixel to be calculated in the second cell image is used as the grayscale information corresponding to the pixel to be calculated.

[0018] Secondly, embodiments of this application also provide a cell image stitching device, including: a determining module, a processing module, and a stitching module; The determining module is used to perform image registration on the first cell image and the second cell image to be stitched together, and to determine the overlapping area between the first cell image and the second cell image. The determining module is configured to determine a first cell region from the first cell image and a second cell region from the second cell image based on the overlapping region. The processing module is used to divide the overlapping region into regions based on the first cell region and the second cell region to obtain a target processing region, wherein the target processing region includes: a cell region, an expanded region, and a background region; The processing module is used to calculate the cumulative cost of each pixel in the target processing area based on the pixel information of the target processing area, the first cell image, and the second cell image, and to determine the cumulative cost information of each pixel. The determining module is used to determine the associated pixel corresponding to each pixel based on the cumulative cost information of the effective neighboring pixels corresponding to each pixel. The stitching module is used to determine the target stitching position in the overlapping area based on the endpoint pixel in the target processing area and the associated pixel corresponding to each pixel, and to stitch the first cell image and the second cell image together based on the target stitching position to obtain the target stitched image.

[0019] Optionally, the determining module is specifically used to perform image foreground segmentation on the overlapping region in the first cell image to determine the first cell region; Image foreground segmentation is performed on the overlapping region in the second cell image to determine the second cell region.

[0020] Optionally, the processing module is specifically used to perform a union operation on the first cell region and the second cell region to obtain the cell region; The cell region is expanded according to a preset expansion size to obtain an expanded region; The region in the overlapping region other than the cell region and the swelling region is used as the background region. The cell region, the swollen region, and the background region are used as the target processing region.

[0021] Optionally, the processing module is specifically used to traverse each pixel in the target processing area sequentially, starting from the target vertex in the target processing area and following a preset traversal direction. For the current pixel that has been traversed, the energy cost information of the current pixel is determined based on the grayscale information of the current pixel in the first cell image, the grayscale information of the current pixel in the second cell image, and the constraint parameters corresponding to the current pixel. The cumulative cost information of the current pixel is determined based on the energy cost information of the current pixel and the cumulative cost information of the effective neighboring pixels corresponding to the current pixel.

[0022] Optionally, the processing module is specifically used to determine a first parameter value of the current pixel based on the sub-region where the current pixel is located in the target processing area; Based on the grayscale information of each pixel within the cell region in the target processing area, the cell contrast is determined, and based on the cell contrast, the penalty parameter value is determined. The constraint parameters corresponding to the current pixel are determined based on the first parameter value of the current pixel, the penalty parameter value, and the preset weight coefficient.

[0023] Optionally, the processing module is specifically configured to determine the first parameter value of the current pixel as a first value if the current pixel belongs to a cell region in the target processing region; If the current pixel belongs to the dilated region in the target processing area, then the first parameter value of the current pixel is determined to be the second value; If the current pixel belongs to the background region of the target processing region, then the first parameter value of the current pixel is determined to be the third value.

[0024] Optionally, the processing module is specifically used to determine the grayscale difference information of the current pixel based on the grayscale information of the current pixel in the first cell image and the grayscale information of the current pixel in the second cell image; The energy cost information of the current pixel is determined based on the grayscale difference information of the current pixel and the constraint parameters corresponding to the current pixel.

[0025] Optionally, the determining module is specifically used to determine the previous traversal row corresponding to the current pixel based on the traversal row where the current pixel is located; Based on the coordinate information of the current pixel, at least one effective neighboring pixel corresponding to the current pixel is determined from the previous traversal, and the cumulative cost information of each effective neighboring pixel is determined. Based on the cumulative cost information of each effective neighboring pixel, the effective neighboring pixel with the smallest cumulative cost information is determined as the target neighboring pixel corresponding to the current pixel. The cumulative cost information of the current pixel is determined based on the energy cost information of the current pixel and the cumulative cost information of the target neighboring pixels.

[0026] Optionally, the determining module is specifically used to regard the target neighboring pixels as the associated pixels corresponding to the current pixel.

[0027] Optionally, the splicing module is specifically used to determine the pixel with the smallest cumulative cost information in the endpoint traversal row as the endpoint pixel in the target processing area based on the cumulative cost information of each pixel in the endpoint traversal row. Starting from the endpoint pixel, based on the associated pixels corresponding to each pixel, traverse backwards to the starting traversal row, and determine the splicing pixels in each traversal row in turn. The target stitching position is obtained by arranging the stitched pixels in order according to the traversal rows.

[0028] Optionally, the splicing module is specifically used to determine the transition range of the row where each splicing pixel is located based on the coordinate information of each splicing pixel in the target splicing position and the preset transition size; Based on the transition range of each stitched pixel in the row and the horizontal dimension of the stitched image to be generated, the stitched image to be generated is divided into multiple sub-processing regions; the multiple sub-processing regions include: a first region, a transition region, and a second region; the relative positional relationship between the first region and the second region is consistent with the relative positional relationship between the first cell image and the second cell image; Based on the sub-processing region to which each pixel to be calculated belongs in the stitched image to be generated, the image stitching strategy corresponding to each sub-processing region is adopted to determine the grayscale information corresponding to each pixel to be calculated. The target stitched image is generated based on the grayscale information corresponding to each pixel to be calculated.

[0029] Optionally, the stitching module is specifically used to use the grayscale information of the pixel to be calculated in the first cell image as the grayscale information corresponding to the pixel to be calculated if the pixel to be calculated belongs to the first region. If the pixel to be calculated belongs to the transition region, then the grayscale information corresponding to the pixel to be calculated is determined based on the grayscale information of the pixel to be calculated in the first cell image, the grayscale information of the pixel to be calculated in the second cell image, the fusion weight of the first cell image corresponding to the pixel to be calculated, and the fusion weight of the second cell image corresponding to the pixel to be calculated. If the pixel to be calculated belongs to the second region, then the grayscale information of the pixel to be calculated in the second cell image is used as the grayscale information corresponding to the pixel to be calculated.

[0030] Thirdly, embodiments of this application provide an electronic device, including: a processor, a storage medium, and a bus. The storage medium stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to implement the cell image stitching method provided in the first aspect.

[0031] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, performs the cell image stitching method as provided in the first aspect.

[0032] The beneficial effects of this application are: The image stitching method, apparatus, electronic device, and storage medium provided in this embodiment include: image registration of a first cell image and a second cell image to be stitched, determining the overlapping region between the first cell image and the second cell image; determining a first cell region from the first cell image and a second cell region from the second cell image based on the overlapping region; dividing the overlapping region into regions based on the first cell region and the second cell region to obtain a target processing region, the target processing region including: a cell region, a dilated region, and a background region; calculating the cumulative cost of each pixel in the target processing region based on the target processing region, the pixel information of the first cell image, and the pixel information of the second cell image, determining the cumulative cost information of each pixel; determining the associated pixels corresponding to each pixel based on the cumulative cost information of the effective neighboring pixels corresponding to each pixel; determining the target stitching position in the overlapping region based on the endpoint pixel in the target processing region and the associated pixels corresponding to each pixel, and stitching the first cell image and the second cell image together based on the target stitching position to obtain a target stitched image. This method divides the overlapping region between two cell images to be stitched into cell regions, dilated regions, and background regions. Then, combining an improved energy function and dynamic programming algorithm, it calculates the cumulative cost information of pixels within different regions of the overlapping area, thereby determining the associated pixels and thus the optimal target stitching position. When stitching images using the target stitching position determined by this method, it can simultaneously satisfy the problems of seamless image stitching, no cell cutting, and reduced cell duplication in the stitched image due to cell movement, effectively improving the accuracy and quality of cell image stitching results. Attached Figure Description

[0033] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0034] Figure 1 Flowchart of the cell image stitching method provided in the embodiments of this application Figure One ; Figure 2 This is a schematic diagram illustrating the overlapping area between cell images provided in an embodiment of this application; Figure 3 Flowchart of the cell image stitching method provided in the embodiments of this application Figure Two ; Figure 4This is a schematic diagram illustrating a target processing area provided in an embodiment of this application; Figure 5 Flowchart of the cell image stitching method provided in the embodiments of this application Figure Three ; Figure 6 Flowchart of the cell image stitching method provided in the embodiments of this application Figure Four ; Figure 7 Flowchart of the cell image stitching method provided in the embodiments of this application Figure Five ; Figure 8 Flowchart of the cell image stitching method provided in the embodiments of this application Figure Six ; Figure 9 Flowchart of the cell image stitching method provided in the embodiments of this application Figure Seven ; Figure 10 This application provides a schematic diagram illustrating a spliced ​​curve. Figure 11 Flowchart of the cell image stitching method provided in the embodiments of this application Figure Eight ; Figure 12 This is a schematic diagram illustrating a target stitched image provided in an embodiment of this application; Figure 13 This is a schematic diagram of a cell image stitching device provided in an embodiment of this application; Figure 14 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0035] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the accompanying drawings in this application are for illustrative and descriptive purposes only and are not intended to limit the scope of protection of this application. Furthermore, it should be understood that the schematic drawings are not drawn to scale. The flowcharts used in this application illustrate operations implemented according to some embodiments of this application. It should be understood that the operations in the flowcharts may not be implemented in sequence, and steps without logical contextual relationships may be reversed or implemented simultaneously. In addition, those skilled in the art, guided by the content of this application, may add one or more other operations to the flowcharts, or remove one or more operations from the flowcharts.

[0036] Furthermore, the described embodiments are merely some, not all, of the embodiments of this application. The components of the embodiments of this application described and illustrated herein can typically be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

[0037] It should be noted that the term "comprising" will be used in the embodiments of this application to indicate the presence of the features declared thereafter, but does not exclude the addition of other features.

[0038] Figure 1 Flowchart of the cell image stitching method provided in the embodiments of this application Figure One The subject executing this method can be a computer device, such as... Figure 1 As shown, the method includes: S101. Perform image registration on the first cell image and the second cell image to be stitched together to determine the overlapping area between the first cell image and the second cell image.

[0039] First, it's important to clarify that the purpose of image stitching is to achieve seamless stitching of multiple images, satisfying the need for panoramic observation and analysis in different scenarios. In the field of microscopic imaging, due to the limited field of view of imaging equipment, a single image capture may not be sufficient to obtain the required panoramic image. Therefore, multiple cell images captured in a single session can be stitched together to generate a stitched panoramic image.

[0040] In this scenario, the culture dish carrying the cell sample can be placed on the motor stage, and the cell sample is always in the culture medium of the culture dish. In one mode, the imaging device remains stationary, and the motor can move the culture dish within the field of view of the imaging device to capture multiple cell images. In another mode, the culture dish can remain stationary, and the motor can move the imaging device in fixed steps to capture multiple cell images.

[0041] In this process, the fields of view corresponding to multiple cell images may partially overlap. Therefore, there will be overlapping areas and non-overlapping areas between multiple images. By stitching together multiple cell images, a complete image with a panoramic view can be obtained.

[0042] The following embodiments of this scheme all take the stitching process of two adjacent cell images as an example, which are referred to as the first cell image and the second cell image, respectively.

[0043] Optionally, an image registration algorithm can be used to perform image registration processing on the first cell image and the second cell image to determine the vertex offset of the first cell image relative to the vertex offset of the second cell image, or the vertex offset of the second cell image relative to the vertex offset of the first cell image can be determined.

[0044] Based on the determined vertex offset, the overlapping area between the first cell image and the second cell image can be determined.

[0045] Figure 2 This is a schematic diagram illustrating the overlapping area between cell images provided in an embodiment of this application. Figure 2 As shown in a, with Figure 2 In the image 'a', the left image is the first cell image and the right image is the second cell image. By determining the offset of the top left vertex of the left image relative to the right image, the position of the top left vertex of the left image after the offset can be determined. Based on the offset position, the size of the overlapping area between the first cell image and the second cell image can be determined. Thus, based on the size of the overlapping area, the first overlapping area ROI1 can be determined from the first cell image and the second overlapping area ROI2 can be determined from the second cell image.

[0046] Based on the first overlapping region ROI1 of the first cell image and the second overlapping region ROI2 of the second cell image, the first cell image and the second cell image are fused and displayed to obtain the following: Figure 2 The fused image shown in b, where the overlapping area between the first cell image and the second cell image is also... Figure 2 The region enclosed by the dashed box indicated by b in the diagram. The overlapping region contains both the ROI1 image of the first cell image and the ROI2 image of the second cell image, and there may be overlap between the images within ROI1 and ROI2. For example, the cells in the second row of the overlapping region may overlap.

[0047] In some embodiments, if the ROI1 image of the first cell image and the ROI2 image of the second cell image have poor brightness uniformity and high noise level, then before merging the first cell image and the second cell image, the ROI1 image and the ROI2 image can be normalized (e.g., based on histogram equalization) and denoised (e.g., Gaussian filtering) can be performed on them respectively. By unifying the brightness contrast of the overlapping areas and suppressing noise interference, the differences in the images after subsequent stitching can be reduced.

[0048] If the ROI1 image of the first cell image and the ROI2 image of the second cell image have good brightness uniformity and low noise level, this processing step can be skipped.

[0049] S102. Based on the overlapping areas, determine the first cell region from the first cell image and the second cell region from the second cell image.

[0050] In some embodiments, foreground segmentation of the overlapping regions can be performed to determine the first cell region in the first cell image and the second cell region in the second cell image, respectively; the first cell region is the region in the first cell image where the cell located in the overlapping region is located; the second cell region is the region in the second cell image where the cell located in the overlapping region is located.

[0051] S103. Based on the first cell region and the second cell region, the overlapping region is divided into regions to obtain the target treatment region.

[0052] The target processing area includes: cellular region, swollen region, and background region.

[0053] In some embodiments, cell regions in overlapping regions can be determined based on a first cell region in a first cell image and a second cell region in a second cell image; dilated regions can be determined based on cell regions, which are obtained by dilating the cell regions.

[0054] The remaining regions, excluding the swelling region and the cellular region, are used as the background region, thereby dividing the overlapping region into different regions and obtaining the target processing region.

[0055] It is worth noting that the target processing area and the overlapping area refer to the same area, containing exactly the same pixels. However, for the sake of convenience in subsequent processing description, the overlapping area after the area division is called the target processing area.

[0056] S104. Based on the target processing area, the pixel information of the first cell image, and the pixel information of the second cell image, calculate the cumulative cost of each pixel in the target processing area to determine the cumulative cost information of each pixel.

[0057] In some embodiments, an energy function can be constructed. For each pixel in the target processing region, the cumulative cost information of each pixel can be determined based on the pixel information of the first cell image and the pixel information of the second cell image, combined with a dynamic programming algorithm. The cumulative cost information is used to measure the grayscale difference between the first cell image and the second cell image at the pixel. The smaller the cumulative cost, the better the grayscale consistency between the first cell image and the second cell image. The less obvious the stitching seam, the better the stitching effect when the first cell image and the second cell image are stitched together at this pixel.

[0058] S105. Based on the cumulative cost information of the effective neighboring pixels corresponding to each pixel, determine the associated pixels corresponding to each pixel.

[0059] Optionally, the cumulative cost information of the effective neighboring pixels corresponding to a pixel can be calculated in the same way as described above. For each pixel, there can be multiple effective neighboring pixels. The associated pixels corresponding to the pixel can be determined from the cumulative cost information of the effective neighboring pixels.

[0060] S106. Based on the endpoint pixel in the target processing area and the associated pixel corresponding to each pixel, determine the target stitching position in the overlapping area, and stitch the first cell image and the second cell image according to the target stitching position to obtain the target stitched image.

[0061] Associated pixels are pixels on the preceding path of a pixel. Since each pixel corresponds to an associated pixel, the associated pixels can be traced from the endpoint pixel to form a complete path. This path can be used as the target stitching position within the overlapping area. The target stitching position refers to the location of the stitching seam when stitching the first cell image and the second cell image.

[0062] Based on the target stitching position, the first and second cell images can be precisely stitched together to obtain a stitched image that effectively preserves the integrity of cell morphology. This supports the accuracy of subsequent cell detection tasks and improves the accuracy of cell analysis.

[0063] In summary, the cell image stitching method provided in this embodiment includes: image registration of a first cell image and a second cell image to be stitched, determining the overlapping region between the first cell image and the second cell image; determining a first cell region from the first cell image and a second cell region from the second cell image based on the overlapping region; dividing the overlapping region into regions based on the first cell region and the second cell region to obtain a target processing region, which includes: a cell region, a dilated region, and a background region; calculating the cumulative cost of each pixel in the target processing region based on the target processing region, the pixel information of the first cell image, and the pixel information of the second cell image, determining the cumulative cost information of each pixel; determining the associated pixels corresponding to each pixel based on the cumulative cost information of the effective neighboring pixels corresponding to each pixel; determining the target stitching position in the overlapping region based on the endpoint pixel in the target processing region and the associated pixels corresponding to each pixel, and stitching the first cell image and the second cell image together based on the target stitching position to obtain a target stitched image. This method divides the overlapping region between two cell images to be stitched into cell regions, dilated regions, and background regions. Then, combining an improved energy function and dynamic programming algorithm, it calculates the cumulative cost information of pixels within different regions of the overlapping area, thereby determining the associated pixels and thus the optimal target stitching position. When stitching images using the target stitching position determined by this method, it can simultaneously satisfy the problems of seamless image stitching, no cell cutting, and reduced cell duplication in the stitched image due to cell movement, effectively improving the accuracy and quality of cell image stitching results.

[0064] Optionally, in step S102, determining the first cell region from the first cell image and the second cell region from the second cell image based on the overlapping regions includes: performing image foreground segmentation on the overlapping regions in the first cell image to determine the first cell region; and performing image foreground segmentation on the overlapping regions in the second cell image to determine the second cell region.

[0065] In some embodiments, a segmentation algorithm may be used to extract a first cell region fg1 from the overlapping region in the first cell image and a second cell region fg2 from the overlapping region in the second cell image.

[0066] Continue as Figure 2 As shown in b, the overlapping region contains two rows of cells. The cells enclosed by the first row of solid lines are the second cell region fg2, and the cells enclosed by the first row of dashed lines are the first cell region fg1. Similarly, the cells enclosed by the second row of solid lines are the second cell region fg2, and the cells enclosed by the second row of dashed lines are the first cell region fg1.

[0067] Figure 3 Flowchart of the cell image stitching method provided in the embodiments of this application Figure Two Optionally, in step S103, the overlapping region is divided into regions based on the first cell region and the second cell region to obtain the target processing region, including: S201. Perform a union operation on the first cell region and the second cell region to obtain the cell region.

[0068] In some embodiments, the extracted fg1 and fg2 are subjected to union processing to obtain the cell region fg = fg1∪fg2.

[0069] Figure 4 This is a schematic diagram illustrating a target processing area provided in an embodiment of this application, such as... Figure 4 As shown, the blue area marked is the cell region.

[0070] S202. The cell region is expanded according to the preset expansion size to obtain the expanded region.

[0071] Optionally, the cell region can be dilated to obtain an expanded region. The purpose of the dilation process is to fill the gaps caused by the minute movements of the cells, preventing the stitching position from passing through the cells during subsequent determination of the target stitching position, thus avoiding incorrect cell cutting. This allows cells from the first cell image and cells from the second cell image in the overlapping region to be connected into a complete foreground region, thereby fully incorporating regions that may belong to the same cell in the first and second cell images into the foreground.

[0072] like Figure 4 The red area marked in the middle is the determined expansion region.

[0073] The size of the expansion template during the expansion process can be set according to the actual gap size. In this embodiment, it can be set to 3. 3.

[0074] S203. The region in the overlapping area, excluding the cell region and the swelling region, is taken as the background region.

[0075] Continue as Figure 4 As shown, all remaining areas in the overlapping region, except for the cell areas in the blue area and the expanded areas in the red area, i.e., the blank areas, are used as the background area.

[0076] S204. The cell region, the swollen region, and the background region are taken as the target processing regions.

[0077] Therefore, the target processing area can be formed by the cell region, the swelling region, and the background region as defined above.

[0078] Figure 5 Flowchart of the cell image stitching method provided in the embodiments of this application Figure Three Optionally, in step S104, based on the target processing area, the pixel information of the first cell image, and the pixel information of the second cell image, the cumulative cost of each pixel within the target processing area is calculated to determine the cumulative cost information of each pixel, including: S301. Starting with the target vertex in the target processing area as the starting pixel, traverse each pixel in the target processing area in sequence according to the preset traversal direction.

[0079] Optionally, an energy function can be constructed and combined with a dynamic programming algorithm to globally optimize within the target processing region to determine the optimal target stitching position that only crosses the background region.

[0080] First, the basic energy function is constructed as follows:

[0081] in, For the first cell image in grayscale value at that location For the second cell image in The grayscale value at that location.

[0082] This scheme improves upon the basic energy function described above, and the improved energy function is shown below:

[0083] in, This represents the constraint parameter, also known as the dynamic constraint penalty term, which guides the subsequently determined target stitching position to avoid cell regions, thereby simultaneously satisfying the requirements of seamless image stitching, no cell cutting, and reduced problems caused by cell movement repetition.

[0084]

[0085] These are weighting coefficients used to balance the differences between the background and cells; This represents the maximum penalty, typically twice the cell contrast ratio.

[0086] For each pixel in the target processing area, a starting pixel and a traversal direction can be defined. Starting from the starting pixel, each pixel is traversed sequentially along the traversal direction. Based on the improved energy function described above, the cumulative cost information of each pixel is determined.

[0087] In some embodiments, combined with Figure 3As shown, the top left vertex of the target processing area can be defined as the starting pixel. The traversal can proceed from left to right horizontally and from top to bottom vertically, traversing all pixels in the target processing area row by row until the bottom right vertex of the target processing area is traversed, that is, the last pixel of the last row is traversed, and then the traversal ends.

[0088] S302. For the current pixel that has been traversed, determine the energy cost information of the current pixel based on the grayscale information of the current pixel in the first cell image, the grayscale information of the current pixel in the second cell image, and the constraint parameters corresponding to the current pixel.

[0089] Optionally, for the current pixel that has been traversed, the energy cost information of the current pixel can be determined first based on the improved energy function described above, combined with the grayscale information of the current pixel in the first cell image and the grayscale information of the current pixel in the second cell image. That is, the energy cost information of the current pixel itself can be determined. .

[0090] S303. Determine the cumulative cost information of the current pixel based on the energy cost information of the current pixel and the cumulative cost information of the effective neighboring pixels corresponding to the current pixel.

[0091] Simultaneously, it is necessary to determine the effective neighboring pixels corresponding to the current pixel. For each effective neighboring pixel, the cumulative cost information of each effective neighboring pixel needs to be determined. Then, the energy cost information of the current pixel itself is summed with the minimum cumulative cost information among the effective neighboring pixels corresponding to the current pixel to obtain the cumulative cost information of the current pixel.

[0092] It is worth noting that, for effective neighboring pixels, when calculating the cumulative cost information of effective neighboring pixels, the energy cost information of the effective neighboring pixel itself is summed with the minimum cumulative cost information among the effective neighboring pixels corresponding to the effective neighboring pixel.

[0093] In other words, for any given pixel, its cumulative cost information is calculated jointly from its own energy cost information and the cumulative cost information of its corresponding effective neighboring pixels. Furthermore, when an effective neighboring pixel is used as the current pixel, it also has corresponding effective neighboring pixels.

[0094] Figure 6 Flowchart of the cell image stitching method provided in the embodiments of this application Figure Four Optionally, in step S302, the constraint parameters corresponding to the current pixel are determined in the following manner: S401. Determine the first parameter value of the current pixel based on the sub-region where the current pixel is located in the target processing area.

[0095] In conjunction with the improved energy function described above, the first parameter value here corresponds to the parameter... For the current pixel, its corresponding sub-region can be determined based on the sub-region in which the current pixel is located. value.

[0096] Specifically, if the current pixel belongs to a cell region in the target processing area, the M value of the current pixel is determined to be 1; if the current pixel belongs to a dilated region in the target processing area, the M value of the current pixel is determined to be 0.5; if the current pixel belongs to the background region in the target processing area, the M value of the current pixel is determined to be 0.

[0097] S402. Determine the cell contrast based on the grayscale information of each pixel within the cell region of the target processing area, and determine the penalty parameter value based on the cell contrast.

[0098] The penalty parameter value corresponds to the parameter in the improved energy function. The value of , for any given pixel, when calculating the energy cost information using the improved energy function, is its corresponding... They are all the same; in this embodiment, The cell contrast can be taken as twice the value of the cell contrast. The cell contrast can be obtained by calculating the difference between the maximum and minimum gray values ​​in the cell region, or it can be calculated by taking the average gradient.

[0099] S403. Determine the constraint parameters corresponding to the current pixel based on the first parameter value, the penalty parameter value, and the preset weight coefficient.

[0100] From the first parameter value Values ​​of penalty parameters By determining the value of the value and the weight coefficient, the constraint parameters corresponding to the current pixel can be determined.

[0101] Figure 7 Flowchart of the cell image stitching method provided in the embodiments of this application Figure Five Optionally, in step S302, the energy cost information of the current pixel is determined based on the grayscale information of the current pixel in the first cell image, the grayscale information of the current pixel in the second cell image, and the constraint parameters corresponding to the current pixel, including: S501. Determine the grayscale difference information of the current pixel based on the grayscale information of the current pixel in the first cell image and the grayscale information of the current pixel in the second cell image.

[0102] For the current pixel, since it belongs to both the first and second cell images, its grayscale value in the first cell image and its grayscale value in the second cell image can be determined separately. That is, the grayscale values ​​of the current pixel in the first cell image and the second cell image can be determined separately. and .

[0103] S502. Determine the energy cost information of the current pixel based on the grayscale difference information of the current pixel and the constraint parameters corresponding to the current pixel.

[0104] Simultaneously, the constraint parameters corresponding to the current pixel can be calculated based on the improved energy function, where the constraint parameters corresponding to the current pixel are... The specific value is determined based on whether the current pixel belongs to a cellular region, an expanded region, or a background region.

[0105] In other words, by substituting the relevant values ​​of the current pixel into the improved energy function, the energy cost information of the current pixel can be calculated.

[0106] Figure 8 Flowchart of the cell image stitching method provided in the embodiments of this application Figure Six Optionally, in step S303, the cumulative cost information of the current pixel is determined based on the energy cost information of the current pixel and the cumulative cost information of the effective neighboring pixels corresponding to the current pixel, including: S601. Determine the previous traversal row corresponding to the current pixel based on the traversal row where the current pixel is located.

[0107] When determining the valid neighboring pixels of the current pixel, only the three pixels adjacent to the current pixel in the previous traversal can be considered. In some cases, some of the determined three adjacent pixels may exceed the boundary of the target processing area; these can be excluded, and the remaining pixels are considered valid neighboring pixels.

[0108] Therefore, we can first determine the traversal row of the current pixel, and then determine its corresponding previous traversal row.

[0109] S602. Based on the coordinate information of the current pixel, determine at least one valid neighboring pixel corresponding to the current pixel from the previous traversal, and determine the cumulative cost information of each valid neighboring pixel.

[0110] Assuming the current pixel is Then the three neighboring pixels corresponding to the current pixel can be respectively , , .

[0111] If a neighboring pixel exceeds the boundary of the target processing area, then that neighboring pixel is excluded, thus obtaining at least one valid neighboring pixel corresponding to the current pixel.

[0112] For each effective neighboring pixel, its own energy cost information can be calculated first based on the improved energy function. At the same time, the cumulative cost information of the effective neighboring pixel can be determined based on the cumulative cost information of its corresponding effective neighboring pixels.

[0113] It is worth noting that when the effective neighboring pixels belong to the dilated region, the cumulative cost information of the effective neighboring pixels is set to infinity to avoid obtaining the target stitching position that crosses the cell region.

[0114] S603. Based on the cumulative cost information of each effective neighboring pixel, determine the effective neighboring pixel with the smallest cumulative cost information as the target neighboring pixel corresponding to the current pixel.

[0115] In some embodiments, the effective neighboring pixel with the smallest cumulative cost information can be selected from all effective neighboring pixels of the current pixel as the target neighboring pixel corresponding to the current pixel.

[0116] S604. Determine the cumulative cost information of the current pixel based on the energy cost information of the current pixel and the cumulative cost information of the target neighboring pixels.

[0117] The cumulative cost information of the current pixel can be obtained by summing the energy cost information of the current pixel with the cumulative cost information of the determined energy cost information of the current pixel.

[0118] Optionally, in step S105, determining the associated pixel corresponding to each pixel based on the cumulative cost information of the effective neighboring pixels corresponding to each pixel includes: taking the target neighboring pixel as the associated pixel corresponding to the current pixel.

[0119] The effective neighboring pixel with the smallest cumulative cost corresponding to the current pixel, i.e. the target neighboring pixel mentioned above, can be used as the associated pixel corresponding to the current pixel and stored in the path backtracking table for subsequent reverse path tracing to find the target splicing position.

[0120] Figure 9 Flowchart of the cell image stitching method provided in the embodiments of this application Figure Seven Optionally, in step S106, determining the target stitching position within the overlapping area based on the endpoint pixel within the target processing area and the associated pixels corresponding to each pixel includes: S701. Based on the cumulative cost information of each pixel in the endpoint traversal row, determine the pixel with the smallest cumulative cost information in the endpoint traversal row as the endpoint pixel in the target processing area.

[0121] In some embodiments, for the endpoint traversal row, that is, the bottom row in the vertical direction of the target processing area, the pixel with the smallest cumulative cost information can be selected as the endpoint pixel in the target processing area by calculating the cumulative cost information of each pixel in the endpoint traversal row.

[0122] Of course, if the cumulative cost information of all pixels in the endpoint traversal row is infinite, then the middle column pixel in the endpoint traversal row is selected as the endpoint pixel by default.

[0123] In addition, for the starting pixel, if the starting pixel belongs to the dilated region, the cumulative cost information of the starting pixel is set to infinity, thereby forcing the starting point to be a pixel in the background region, thus avoiding deviation of the target stitching position.

[0124] S702. Starting from the endpoint pixel, based on the associated pixels corresponding to each pixel, traverse backwards to the starting traversal row, and determine the splicing pixels in each traversal row in turn.

[0125] In some embodiments, starting from the endpoint pixel, the process can be reversed back to the starting row by using the information of the associated pixels corresponding to each pixel recorded in the path backtracking table, and the stitching pixels in each row used to form the target stitching position can be determined in turn.

[0126] S703. Arrange the stitched pixels in order according to the traversal rows to obtain the target stitching position.

[0127] Arrange all the stitching pixels in order from the starting row to the ending row to form the target stitching position, which can be a stitching curve.

[0128] Assuming the endpoint pixel is pixel 1, the associated pixel corresponding to the endpoint pixel is pixel 2, the associated pixel corresponding to pixel 2 is pixel 3, the associated pixel corresponding to pixel 3 is pixel 4, and assuming pixel 4 is the pixel of the starting row, then pixels 4, 3, 2, and 1 can be arranged in sequence to form a complete vertical splicing curve, which is the desired target splicing position.

[0129] The splicing curve determined by this method can meet the following conditions: it is strictly located within the background area and the grayscale transition is natural (with minimal cumulative cost), while avoiding the separation area of ​​the same cell (no duplicate display).

[0130] Figure 10This application provides a schematic diagram illustrating a spliced ​​curve, as shown in the embodiment. Figure 10 As shown, based on the target splicing position determined by this method, the splicing curve is only located in the background area and will not pass through the cell, thus not causing cell cutting.

[0131] Figure 11 Flowchart of the cell image stitching method provided in the embodiments of this application Figure Eight Optionally, in step S106, the first cell image and the second cell image are stitched together according to the target stitching position to obtain the target stitched image, including: S801. Based on the coordinate information of each stitching pixel in the target stitching position and the preset transition size, determine the transition range of the row where each stitching pixel is located.

[0132] In some embodiments, the target splicing position can be used as the boundary, that is, with Figure 10 The splicing curve shown in the figure serves as the boundary, and a gradual transition region with a width of H is set in the horizontal direction; where H can generally be close to the cell diameter.

[0133] For each row in the target processing area, the transition range of that row can be determined as [xH, x+H], where x can represent the horizontal coordinate of the stitched pixel in that row.

[0134] That is, taking the stitched pixels of each row as the center, an area of ​​width H is extended to the left and right respectively. Since the horizontal coordinates of the stitched pixels in each row are different, the transition range of each row is different.

[0135] S802. Based on the transition range of the row where each stitching pixel is located and the horizontal dimension of the stitched image to be generated, divide the stitched image to be generated into multiple sub-processing regions.

[0136] The multiple sub-processing regions include: a first region, a transition region, and a second region; the relative positional relationship between the first region and the second region is consistent with the relative positional relationship between the first cell image and the second cell image.

[0137] Based on the transition range of each row, the generated stitched image can be divided into regions in the horizontal direction, and the division results include: a first region, a transition region, and a second region.

[0138] Among them, with Figure 2 Taking 'a' as an example, when the first cell image is located to the left of the second cell image, the first region can refer to the left region in the stitched image to be generated; the second region can refer to the right region in the stitched image to be generated; and the transition region is the middle region located between the left and right regions.

[0139] S803. Based on the sub-processing region to which each pixel to be calculated belongs in the stitched image to be generated, the image stitching strategy corresponding to each sub-processing region is adopted to determine the grayscale information corresponding to each pixel to be calculated.

[0140] Based on the above division results of the stitched image to be generated, the corresponding image stitching strategy can be executed according to the sub-processing region to which the pixel to be calculated belongs in the stitched image to be generated, based on the pixel grayscale information of the first cell image and / or the pixel grayscale information of the second cell image, so as to determine the grayscale information of each pixel to be calculated.

[0141] S804. Generate the target stitched image based on the grayscale information corresponding to each pixel to be calculated.

[0142] The grayscale information corresponding to each pixel to be calculated is filled into the corresponding pixel in the stitched image to be generated, and the target stitched image can be obtained.

[0143] Optionally, in step S803, based on the sub-processing region to which each pixel to be calculated belongs in the stitched image to be generated, the image stitching strategy corresponding to each sub-processing region is adopted to determine the grayscale information corresponding to each pixel to be calculated, including: if the pixel to be calculated belongs to the first region, then the grayscale information of the pixel to be calculated in the first cell image is used as the grayscale information corresponding to the pixel to be calculated.

[0144] Optionally, each pixel in the stitched image to be generated will be used as a pixel to be calculated, and its corresponding grayscale information will be calculated according to the above method.

[0145] In one case, when the x-coordinate of the pixel to be calculated... When -H is selected, the pixel to be calculated belongs to the first region. At this time, the pixel gray value of the pixel to be calculated in the first cell image can be obtained according to the coordinates of the pixel to be calculated, and used as the gray value information of the pixel to be calculated.

[0146] If the pixel to be calculated belongs to a transition region, the grayscale information corresponding to the pixel to be calculated is determined based on the grayscale information of the pixel to be calculated in the first cell image, the grayscale information of the pixel to be calculated in the second cell image, the fusion weight of the first cell image corresponding to the pixel to be calculated, and the fusion weight of the second cell image corresponding to the pixel to be calculated.

[0147] In another case, when the x-coordinate of the pixel to be calculated... When +H is applied, the pixel to be calculated belongs to the transition region. At this time, the smooth transition between the first cell image and the second cell image is achieved through weight allocation.

[0148] At this point, the grayscale information of the pixel to be calculated can be determined using the following formula:

[0149] in, Indicates the pixel to be calculated The fusion weights corresponding to the first cell image, Indicates the pixel to be calculated The corresponding fusion weights of the second cell image, This represents the grayscale information of the pixel to be calculated in the first cell image. This represents the grayscale information of the pixel to be calculated in the second cell image.

[0150] in, ,

[0151] This scheme uses a linear weighting function to set the fusion weights. The fusion weights of the first cell image vary with the horizontal position. The fusion weight of the second cell image decreases linearly from 1 to 0 as the horizontal position increases. The value increases linearly from 0 to 1.

[0152] Of course, Gaussian weighting, exponential weighting, or other methods can be used to replace the linear weighting function to set the fusion weights.

[0153] If the pixel to be calculated belongs to the second region, then the grayscale information of the pixel to be calculated in the second cell image is used as the grayscale information corresponding to the pixel to be calculated.

[0154] In another case, when the x-coordinate of the pixel to be calculated... When +H, the pixel to be calculated belongs to the second region. At this time, the pixel gray value of the pixel to be calculated in the second cell image can be obtained according to the coordinates of the pixel to be calculated, and used as the gray value information of the pixel to be calculated.

[0155] This can be understood as follows: when the pixel to be calculated is located in the first defined region, its grayscale value in the first cell image is directly taken as its grayscale information; when the pixel to be calculated is located in the second defined region, its grayscale value in the second cell image is directly taken as its grayscale information; when the pixel to be calculated is located in the transition region, its grayscale values ​​in the first cell image and the second cell image are taken respectively, and then calculated based on the fusion weights. and We perform weighted calculations to obtain the grayscale information of the pixels to be calculated.

[0156] Figure 12This is a schematic diagram illustrating a target stitched image provided in an embodiment of this application. After stitching the first cell image and the second cell image using the above method, the resulting target stitched image is as follows: Figure 12 As shown, after the cells in the overlapping area of ​​the first and second cell images are stitched together, only one complete cell is retained in each row. The cells in the first row are located to the left of the target stitching position, and the cells in the second row are located to the right of the target stitching position. The same cell in different images is effectively stitched together, avoiding repeated display and avoiding counting errors when counting cells later.

[0157] In summary, the cell image stitching method provided in this embodiment includes: image registration of a first cell image and a second cell image to be stitched, determining the overlapping region between the first cell image and the second cell image; determining a first cell region from the first cell image and a second cell region from the second cell image based on the overlapping region; dividing the overlapping region into regions based on the first cell region and the second cell region to obtain a target processing region, which includes: a cell region, a dilated region, and a background region; calculating the cumulative cost of each pixel in the target processing region based on the target processing region, the pixel information of the first cell image, and the pixel information of the second cell image, determining the cumulative cost information of each pixel; determining the associated pixels corresponding to each pixel based on the cumulative cost information of the effective neighboring pixels corresponding to each pixel; determining the target stitching position in the overlapping region based on the endpoint pixel in the target processing region and the associated pixels corresponding to each pixel, and stitching the first cell image and the second cell image together based on the target stitching position to obtain a target stitched image. This method divides the overlapping region between two cell images to be stitched into cell regions, dilated regions, and background regions. Then, combining an improved energy function and dynamic programming algorithm, it calculates the cumulative cost information of pixels within different regions of the overlapping area, thereby determining the associated pixels and thus the optimal target stitching position. When stitching images using the target stitching position determined by this method, it can simultaneously satisfy the problems of seamless image stitching, no cell cutting, and reduced cell duplication in the stitched image due to cell movement, effectively improving the accuracy and quality of cell image stitching results.

[0158] The following describes the apparatus, device, and storage medium used to implement the cell image stitching method provided in this application. The specific implementation process and technical effects are described above and will not be repeated below.

[0159] Figure 13This is a schematic diagram of a cell image stitching device provided in an embodiment of this application. The function implemented by this cell image stitching device corresponds to the steps performed by the above-described method. This device can be understood as the aforementioned server, or the server's processor, or as a component that implements the functions of this application under the control of the server, independent of the aforementioned server or processor. Figure 13 As shown, the device includes: a determining module 100, a processing module 200, and a splicing module 300; The determination module 100 is used to perform image registration on the first cell image and the second cell image to be stitched together, and to determine the overlapping area between the first cell image and the second cell image. The determining module 100 is used to determine a first cell region from a first cell image and a second cell region from a second cell image based on the overlapping region. The processing module 200 is used to divide the overlapping region into regions based on the first cell region and the second cell region to obtain the target processing region, which includes: cell region, dilated region and background region. The processing module 200 is used to calculate the cumulative cost of each pixel in the target processing area based on the pixel information of the target processing area, the first cell image, and the second cell image, and to determine the cumulative cost information of each pixel. The determination module 100 is used to determine the associated pixel corresponding to each pixel based on the cumulative cost information of the effective neighboring pixels corresponding to each pixel. The stitching module 300 is used to determine the target stitching position in the overlapping area based on the endpoint pixel in the target processing area and the associated pixel corresponding to each pixel, and to stitch the first cell image and the second cell image according to the target stitching position to obtain the target stitched image.

[0160] Optionally, the determining module 100 is specifically used to perform image foreground segmentation on the overlapping regions in the first cell image to determine the first cell region; Image foreground segmentation is performed on the overlapping regions in the second cell image to determine the second cell region.

[0161] Optionally, the processing module 200 is specifically used to perform a union operation on the first cell region and the second cell region to obtain the cell region; The cell region is expanded according to the preset expansion size to obtain the expanded region; The region in the overlapping area, excluding the cellular region and the swelling region, is used as the background region. The cellular region, the swollen region, and the background region are used as the target processing areas.

[0162] Optionally, the processing module 200 is specifically used to traverse each pixel in the target processing area sequentially according to a preset traversal direction, starting from the target vertex in the target processing area. For the current pixel that has been traversed, the energy cost information of the current pixel is determined based on the grayscale information of the current pixel in the first cell image, the grayscale information of the current pixel in the second cell image, and the constraint parameters corresponding to the current pixel. The cumulative cost information of the current pixel is determined based on the energy cost information of the current pixel and the cumulative cost information of the effective neighboring pixels corresponding to the current pixel.

[0163] Optionally, the processing module 200 is specifically used to determine the first parameter value of the current pixel based on the sub-region where the current pixel is located in the target processing area; Based on the grayscale information of each pixel within the cell region of the target processing area, the cell contrast is determined, and the penalty parameter value is determined based on the cell contrast. The constraint parameters corresponding to the current pixel are determined based on the first parameter value, the penalty parameter value, and the preset weight coefficient.

[0164] Optionally, the processing module 200 is specifically used to determine the first parameter value of the current pixel as a first value if the current pixel belongs to a cell region in the target processing region; If the current pixel belongs to the dilated region in the target processing area, then the first parameter value of the current pixel is determined to be the second value; If the current pixel belongs to the background area of ​​the target processing area, then the first parameter value of the current pixel is determined to be the third value.

[0165] Optionally, the processing module 200 is specifically used to determine the grayscale difference information of the current pixel based on the grayscale information of the current pixel in the first cell image and the grayscale information of the current pixel in the second cell image; Based on the grayscale difference information of the current pixel and the constraint parameters corresponding to the current pixel, determine the energy cost information of the current pixel.

[0166] Optionally, the determining module 100 is specifically used to determine the previous traversal row corresponding to the current pixel based on the traversal row where the current pixel is located; Based on the coordinate information of the current pixel, determine at least one valid neighboring pixel corresponding to the current pixel from the previous traversal, and determine the cumulative cost information of each valid neighboring pixel. Based on the cumulative cost information of each effective neighboring pixel, the effective neighboring pixel with the smallest cumulative cost information is determined as the target neighboring pixel corresponding to the current pixel. The cumulative cost information of the current pixel is determined based on the energy cost information of the current pixel and the cumulative cost information of the target neighboring pixels.

[0167] Optionally, the determining module 100 is specifically used to take the target neighboring pixels as the associated pixels corresponding to the current pixel.

[0168] Optionally, the splicing module 300 is specifically used to determine the pixel with the smallest cumulative cost information in the endpoint traversal row as the endpoint pixel in the target processing area based on the cumulative cost information of each pixel in the endpoint traversal row. Starting from the endpoint pixel, based on the associated pixels corresponding to each pixel, traverse backwards to the starting traversal row, and determine the splicing pixels in each traversal row in turn. Arrange the stitched pixels in order according to the traversal rows to obtain the target stitching position.

[0169] Optionally, the splicing module 300 is specifically used to determine the transition range of the row where each splicing pixel is located based on the coordinate information of each splicing pixel in the target splicing position and the preset transition size; Based on the transition range of each stitched pixel in the row and the horizontal dimension of the stitched image to be generated, the stitched image to be generated is divided into multiple sub-processing regions; the multiple sub-processing regions include: a first region, a transition region, and a second region; the relative positional relationship between the first region and the second region is consistent with the relative positional relationship between the first cell image and the second cell image; Based on the sub-processing region to which each pixel to be calculated belongs in the stitched image to be generated, the image stitching strategy corresponding to each sub-processing region is adopted to determine the grayscale information corresponding to each pixel to be calculated. The target stitched image is generated based on the grayscale information corresponding to each pixel to be calculated.

[0170] Optionally, the stitching module 300 is specifically used to use the grayscale information of the pixel to be calculated in the first cell image as the grayscale information corresponding to the pixel to be calculated if the pixel to be calculated belongs to the first region. If the pixel to be calculated belongs to the transition region, the gray information corresponding to the pixel to be calculated is determined based on the gray information of the pixel to be calculated in the first cell image, the gray information of the pixel to be calculated in the second cell image, the fusion weight of the first cell image corresponding to the pixel to be calculated, and the fusion weight of the second cell image corresponding to the pixel to be calculated. If the pixel to be calculated belongs to the second region, then the grayscale information of the pixel to be calculated in the second cell image is used as the grayscale information corresponding to the pixel to be calculated.

[0171] The above-described device is used to execute the method provided in the foregoing embodiments, and its implementation principle and technical effect are similar, so they will not be described again here.

[0172] These modules can be one or more integrated circuits configured to implement the above methods, such as one or more Application Specific Integrated Circuits (ASICs), one or more digital signal processors (DSPs), or one or more Field Programmable Gate Arrays (FPGAs). Alternatively, when a module is implemented using processing element scheduler code, the processing element can be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor capable of calling program code. Furthermore, these modules can be integrated together as a system-on-a-chip (SOC).

[0173] The modules described above can be connected or communicate with each other via wired or wireless connections. Wired connections can include metal cables, optical fibers, hybrid cables, or any combination thereof. Wireless connections can include connections via LAN, WAN, Bluetooth, ZigBee, or NFC, or any combination thereof. Two or more modules can be combined into a single module, and any module can be divided into two or more units. Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems and devices described above can be referred to the corresponding processes in the method embodiments, and will not be repeated here.

[0174] Figure 14 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. The device may be a computing device with data processing capabilities.

[0175] The device includes a processor 801, a storage medium 802, and a bus 803. The storage medium 802 stores program instructions that can be executed by the processor 801. When the electronic device is running, the processor 801 and the storage medium 802 communicate through the bus 803. The processor 801 executes the program instructions to implement the cell image stitching method as described in the embodiment.

[0176] The storage medium 802 stores program code, which, when executed by the processor 801, causes the processor 801 to perform various steps in the cell image stitching method according to various exemplary embodiments of this application as described in the "Exemplary Methods" section above.

[0177] The processor 801 can be a general-purpose processor, such as a central processing unit (CPU), digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.

[0178] Storage medium 802, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. The storage medium can include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type storage medium, random access memory (RAM), static random access memory (SRAM), programmable read-only memory (PROM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic storage medium, magnetic disk, optical disk, etc. The storage medium is any other medium capable of carrying or storing desired program code in the form of instructions or data structures that can be accessed by a computer, but is not limited thereto. In the embodiments of this application, storage medium 802 can also be a circuit or any other device capable of implementing storage functions for storing program instructions and / or data.

[0179] Optionally, this application also provides a program product, such as a computer-readable storage medium, including a program that, when executed by a processor, performs the above-described method embodiments.

[0180] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0181] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0182] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in a combination of hardware and software functional units.

[0183] The integrated units implemented as software functional units described above can be stored in a computer-readable storage medium. These software functional units, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

Claims

1. A method for stitching cell images, characterized in that, include: Image registration is performed on the first cell image and the second cell image to be stitched together to determine the overlapping area between the first cell image and the second cell image; Based on the overlapping region, a first cell region is determined from the first cell image, and a second cell region is determined from the second cell image; Based on the first cell region and the second cell region, the overlapping region is divided into regions to obtain the target processing region, which includes: cell region, dilated region and background region; Based on the target processing area, the pixel information of the first cell image, and the pixel information of the second cell image, the cumulative cost of each pixel in the target processing area is calculated to determine the cumulative cost information of each pixel. Based on the cumulative cost information of the effective neighboring pixels corresponding to each pixel, the associated pixels corresponding to each pixel are determined. Based on the endpoint pixel in the target processing area and the associated pixel corresponding to each pixel, the target stitching position in the overlapping area is determined, and the first cell image and the second cell image are stitched together according to the target stitching position to obtain the target stitched image.

2. The method according to claim 1, characterized in that, The step of calculating the cumulative cost of each pixel within the target processing area based on the pixel information of the target processing area, the first cell image, and the second cell image, and determining the cumulative cost information of each pixel, includes: Starting with the target vertex in the target processing area as the starting pixel, each pixel in the target processing area is traversed sequentially according to a preset traversal direction. For the current pixel that has been traversed, the energy cost information of the current pixel is determined based on the grayscale information of the current pixel in the first cell image, the grayscale information of the current pixel in the second cell image, and the constraint parameters corresponding to the current pixel. The cumulative cost information of the current pixel is determined based on the energy cost information of the current pixel and the cumulative cost information of the effective neighboring pixels corresponding to the current pixel.

3. The method according to claim 2, characterized in that, The constraint parameters corresponding to the current pixel are determined in the following way: The first parameter value of the current pixel is determined based on the sub-region where the current pixel is located in the target processing area; Based on the grayscale information of each pixel within the cell region in the target processing area, the cell contrast is determined, and based on the cell contrast, the penalty parameter value is determined. The constraint parameters corresponding to the current pixel are determined based on the first parameter value of the current pixel, the penalty parameter value, and the preset weight coefficient.

4. The method according to claim 2, characterized in that, The step of determining the cumulative cost information of the current pixel based on the energy cost information of the current pixel and the cumulative cost information of the effective neighboring pixels corresponding to the current pixel includes: Based on the traversal row where the current pixel is located, determine the previous traversal row corresponding to the current pixel; Based on the coordinate information of the current pixel, at least one effective neighboring pixel corresponding to the current pixel is determined from the previous traversal, and the cumulative cost information of each effective neighboring pixel is determined. Based on the cumulative cost information of each effective neighboring pixel, the effective neighboring pixel with the smallest cumulative cost information is determined as the target neighboring pixel corresponding to the current pixel. The cumulative cost information of the current pixel is determined based on the energy cost information of the current pixel and the cumulative cost information of the target neighboring pixels.

5. The method according to claim 1, characterized in that, Determining the target stitching position within the overlapping area based on the endpoint pixel within the target processing area and the associated pixels corresponding to each pixel includes: Based on the cumulative cost information of each pixel in the endpoint traversal row, the pixel with the smallest cumulative cost information in the endpoint traversal row is determined as the endpoint pixel in the target processing area. Starting from the endpoint pixel, based on the associated pixels corresponding to each pixel, traverse backwards to the starting traversal row, and determine the splicing pixels in each traversal row in turn. The target stitching position is obtained by arranging the stitched pixels in order according to the traversal rows.

6. The method according to claim 1, characterized in that, The step of stitching the first cell image and the second cell image together according to the target stitching position to obtain the target stitched image includes: Based on the coordinate information of each splicing pixel in the target splicing position and the preset transition size, the transition range of the row where each splicing pixel is located is determined. Based on the transition range of each stitched pixel in the row and the horizontal dimension of the stitched image to be generated, the stitched image to be generated is divided into multiple sub-processing regions; the multiple sub-processing regions include: a first region, a transition region, and a second region; the relative positional relationship between the first region and the second region is consistent with the relative positional relationship between the first cell image and the second cell image; Based on the sub-processing region to which each pixel to be calculated belongs in the stitched image to be generated, the image stitching strategy corresponding to each sub-processing region is adopted to determine the grayscale information corresponding to each pixel to be calculated. The target stitched image is generated based on the grayscale information corresponding to each pixel to be calculated.

7. The method according to claim 6, characterized in that, The step of determining the grayscale information corresponding to each pixel to be calculated based on the sub-processing region to which each pixel belongs in the stitched image to be generated, and using the image stitching strategy corresponding to each sub-processing region, includes: If the pixel to be calculated belongs to the first region, then the grayscale information of the pixel to be calculated in the first cell image is used as the grayscale information corresponding to the pixel to be calculated. If the pixel to be calculated belongs to the transition region, then the grayscale information corresponding to the pixel to be calculated is determined based on the grayscale information of the pixel to be calculated in the first cell image, the grayscale information of the pixel to be calculated in the second cell image, the fusion weight of the first cell image corresponding to the pixel to be calculated, and the fusion weight of the second cell image corresponding to the pixel to be calculated. If the pixel to be calculated belongs to the second region, then the grayscale information of the pixel to be calculated in the second cell image is used as the grayscale information corresponding to the pixel to be calculated.

8. A cell image stitching device, characterized in that, include: The module is defined as a component, which includes a processing module and a splicing module. The determining module is used to perform image registration on the first cell image and the second cell image to be stitched together, and to determine the overlapping area between the first cell image and the second cell image. The determining module is configured to determine a first cell region from the first cell image and a second cell region from the second cell image based on the overlapping region. The processing module is used to divide the overlapping region into regions based on the first cell region and the second cell region to obtain a target processing region, wherein the target processing region includes: a cell region, an expanded region, and a background region; The processing module is used to calculate the cumulative cost of each pixel in the target processing area based on the pixel information of the target processing area, the first cell image, and the second cell image, and to determine the cumulative cost information of each pixel. The determining module is used to determine the associated pixel corresponding to each pixel based on the cumulative cost information of the effective neighboring pixels corresponding to each pixel. The stitching module is used to determine the target stitching position in the overlapping area based on the endpoint pixel in the target processing area and the associated pixel corresponding to each pixel, and to stitch the first cell image and the second cell image together based on the target stitching position to obtain the target stitched image.

9. An electronic device, characterized in that, include: The device includes a processor, a storage medium, and a bus. The storage medium stores program instructions executable by the processor. When the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the program instructions to implement the cell image stitching method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The storage medium stores a computer program that is executed by a processor to implement the cell image stitching method as described in any one of claims 1 to 7.