WO2024000268A1 - Image processing method and apparatus, and device and medium - Google Patents

Image processing method and apparatus, and device and medium Download PDF

Info

Publication number
WO2024000268A1
WO2024000268A1 PCT/CN2022/102360 CN2022102360W WO2024000268A1 WO 2024000268 A1 WO2024000268 A1 WO 2024000268A1 CN 2022102360 W CN2022102360 W CN 2022102360W WO 2024000268 A1 WO2024000268 A1 WO 2024000268A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
trajectory
offset
point
trajectory point
Prior art date
Application number
PCT/CN2022/102360
Other languages
French (fr)
Chinese (zh)
Inventor
黄子睿
刘焕林
李美
陈必超
黎宇翔
Original Assignee
深圳华大生命科学研究院
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳华大生命科学研究院 filed Critical 深圳华大生命科学研究院
Priority to PCT/CN2022/102360 priority Critical patent/WO2024000268A1/en
Priority to PCT/CN2022/136698 priority patent/WO2024001051A1/en
Publication of WO2024000268A1 publication Critical patent/WO2024000268A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/30Determination of transform parameters for the alignment of images, i.e. image registration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/70Determining position or orientation of objects or cameras
    • G06T7/73Determining position or orientation of objects or cameras using feature-based methods

Definitions

  • the present application relates to the field of image processing technology, and in particular, to an image processing method, device, equipment and medium.
  • Gene expression refers to the process of synthesizing genetic information from genes into functional gene products.
  • the products of gene expression are usually proteins.
  • All known life forms use gene expression to synthesize macromolecules of life.
  • an image registration step is required to obtain accurate gene expression information.
  • Existing registration technology can perform rough position correspondence between microscope images and gene expression visualization images, where the gene expression visualization image is generated using a gene expression matrix containing spatial position information. Based on the characteristics of the image itself and supplemented by artificial visual adjustment, the spatial position of the image captured by the microscope and the gene expression visualization image can be matched.
  • existing registration technology can only achieve position matching in the relatively macroscopic dimension of biological samples, resulting in low registration accuracy and inability to support more refined gene expression analysis.
  • this application provides an image processing method, device, equipment and medium to improve the accuracy of image processing.
  • embodiments of the present application provide an image processing method, which method includes:
  • first image and a second image wherein the first image and the second image include a plurality of trajectory lines and/or a plurality of trajectory points, the trajectory points are formed by the intersection of the two trajectory lines , each of the plurality of trajectory lines has a corresponding index number;
  • the third image is moved based on the target offset.
  • enlarging or reducing the first image to obtain a third image includes:
  • the third trajectory line and the fourth trajectory line in the second image and determine the second distance based on the third trajectory line and the fourth trajectory line, wherein the index number of the third trajectory line is the same as the index number of the third trajectory line.
  • the index number of the first trajectory line is the same
  • the index number of the fourth trajectory line is the same as the index number of the second trajectory line;
  • a ratio value is determined based on the first distance and the second distance, and the first image is enlarged or reduced according to the ratio value to obtain a third image.
  • enlarging or reducing the first image to obtain a third image includes:
  • the fourth image is moved according to a preset period and a preset rotation angle to obtain the third image.
  • enlarging or reducing the first image to obtain a fourth image includes:
  • the fifth image is moved based on the gravity center offset to obtain the fourth image.
  • the moving the fourth image according to a preset period and a preset rotation angle to obtain the third image includes:
  • the sixth image corresponding to the first maximum similarity is determined to be the third image.
  • determining the target offset based on the second image and the third image includes:
  • the moving the third image based on the target offset includes:
  • the third image is moved based on the preset rotation angle corresponding to the third image and the target offset.
  • the moving the fourth image according to a preset period and a preset rotation angle to obtain the third image includes:
  • the fourth image is moved according to each period within the preset period to obtain a plurality of seventh images, and each seventh image in the plurality of seventh images is related to Each period within the preset period has a one-to-one correspondence;
  • the seventh image corresponding to the second maximum similarity is determined to be the third image.
  • determining the target offset based on the second image and the third image includes:
  • the moving the third image based on the target offset includes:
  • the third image is moved based on the preset rotation angle corresponding to the third image and the target offset.
  • determining the first offset based on the fourth image and the second image includes:
  • Each set of trajectory points in the multiple sets of trajectory point sets includes a first trajectory point and a second trajectory point.
  • the first trajectory point is located in the fourth image
  • the second trajectory point is located in the fourth image.
  • the point is located in the second image, and the first trajectory point and the second trajectory point have the same index identifier;
  • For any set of trajectory points determine a fourth offset based on the coordinates of the first trajectory point and the coordinates of the second trajectory point under the set of trajectory points;
  • the first offset is determined based on the fourth offset corresponding to the plurality of sets of trajectory points.
  • the trajectory line of each sub-image has the same index number, and the trajectory line based on the first trajectory point under the trajectory point set is The coordinates and the coordinates of the second trajectory point determine a fourth offset, including:
  • the fourth offset is determined based on the coordinates of the first trajectory point and the coordinates of the second trajectory point corresponding to the minimum Euclidean distance.
  • determining the first similarity between the sixth image and the second image includes:
  • Determining the first maximum similarity based on the plurality of preset rotation angles and the first similarity corresponding to each cycle includes:
  • the minimum Hamming distance is determined to be the first maximum similarity.
  • the step of moving the fourth image according to each period within the preset period to obtain a seventh image includes:
  • the fourth image is moved according to each period to obtain the seventh image.
  • determining a plurality of third offsets based on the second image and the third image includes:
  • each of the multiple sets of trajectory point sets includes a third trajectory point and a fourth trajectory point, the third trajectory point is located in the third image, and the fourth trajectory point The point is located in the second image, and the third trajectory point and the fourth trajectory point have the same index identifier;
  • a third offset is determined based on the coordinates of the third trajectory point and the coordinates of the fourth trajectory point under the set of trajectory points.
  • the method further includes:
  • each of the multiple sets of trajectory point sets includes a fifth trajectory point and a sixth trajectory point,
  • the fifth trajectory point is located in the third image after the movement, the sixth trajectory point is located in the second image, and the fifth trajectory point and the six trajectory points have the same index identifier;
  • the moved third image is moved based on the final offset.
  • obtaining the second image includes:
  • An eighth image is acquired, and convolution enhancement processing is performed on the eighth image to obtain the second image.
  • an image processing device which includes:
  • a first acquisition unit configured to acquire a first image and a second image, wherein the first image and the second image include a plurality of trajectory lines and/or a plurality of trajectory points, and the trajectory points are composed of two
  • the trajectory lines are formed by intersecting, and each trajectory line in the plurality of trajectory lines has a corresponding index number;
  • a second acquisition unit configured to acquire the first trajectory line in the first image, and rotate the first image based on the angle between the first trajectory line and the horizontal direction;
  • a first processing unit configured to enlarge or reduce the first image to obtain a third image, where the third image has the same proportion as the second image;
  • a second processing unit configured to determine a target offset based on the second image and the third image
  • a third processing unit configured to move the third image based on the target offset.
  • embodiments of the present application provide an electronic device, where the electronic device includes: a memory and a processor;
  • the memory is used to store instructions or computer programs
  • the processor is configured to execute the instructions or computer programs in the memory, so that the electronic device executes the image processing method described in any implementation of the first aspect.
  • embodiments of the present application provide a computer-readable storage medium.
  • the computer-readable storage medium is used to store a computer program.
  • the computer program is used to execute any of the implementation methods described in the first aspect. Image processing methods.
  • inventions of the present application provide a computer program product.
  • the computer program product includes a program.
  • the program When the program is run on a processor, it causes the computer or network device to execute any one of the implementation methods of the first aspect. The image processing method described.
  • the first image and the second image are first acquired.
  • the first image and the second image include multiple trajectory lines and multiple trajectory points.
  • the trajectory points are formed by the intersection of the two trajectory lines. , each trajectory line has a corresponding index number.
  • select the first trajectory line in the first image and rotate the first image based on the angle between the first trajectory line and the horizontal direction, that is, rotate the first image to the horizontal direction.
  • the initially obtained first image and the second image may have different scaling ratios, so the first image needs to be enlarged or reduced to obtain a third image, so that the third image has the same ratio as the second image.
  • the target offset is then determined based on the second image and the third image, and the third image is moved based on the target offset.
  • Figure 1 is a schematic flowchart of an image processing method provided by an embodiment of the present application.
  • Figure 2a is a schematic diagram of an image provided by an embodiment of the present application.
  • Figure 2b is another schematic diagram of an image provided by an embodiment of the present application.
  • Figure 3 is a schematic diagram of a first image provided by an embodiment of the present application.
  • Figure 4 is a schematic diagram of image rotation provided by an embodiment of the present application.
  • Figure 5a is a schematic diagram of a third image with multiple periods provided by an embodiment of the present application.
  • Figure 5b is a schematic diagram of a second image with multiple periods provided by an embodiment of the present application.
  • Figure 6 is a schematic diagram of a preset period provided by an embodiment of the present application.
  • Figure 7 is a schematic flow chart of another image processing method provided by an embodiment of the present application.
  • Figure 8 is a schematic structural diagram of an image processing device provided by an embodiment of the present application.
  • Figure 9 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • an image registration step is required to obtain accurate gene expression information.
  • Existing registration technology is mostly based on specific graphic marks on the space-time chip to obtain the microscope image of the biological sample, and then roughly corresponds the position of the microscope image and the gene expression visualization image based on the position of the mark on the microscope image. Based on the characteristics of the image itself and supplemented by artificial visual adjustment, the spatial position of the image captured by the microscope and the gene expression visualization image can be matched.
  • existing registration technology can only achieve position matching in the relatively macroscopic dimension of biological samples, resulting in low registration accuracy and inability to support more refined gene expression analysis.
  • the first image and the second image are first obtained, wherein the first image and the second image include multiple trajectory lines and multiple trajectory points.
  • the trajectory points are formed by the intersection of the two trajectory lines.
  • Each trajectory Lines have corresponding index numbers.
  • select the first trajectory line in the first image and rotate the first image based on the angle between the first trajectory line and the horizontal direction, that is, rotate the first image to the horizontal direction.
  • the initially obtained first image and the second image may have different scaling ratios, so the first image needs to be enlarged or reduced to obtain a third image, so that the third image has the same ratio as the second image.
  • the target offset is then determined based on the second image and the third image, and the third image is moved based on the target offset.
  • Figure 1 is a schematic flow chart of an image processing method provided by an embodiment of the present application.
  • the method specifically includes the following steps:
  • the first image and the second image include multiple trajectory lines and/or multiple trajectory points.
  • the trajectory points are formed by the intersection of two trajectory lines, and each trajectory line has a corresponding index number.
  • Each trajectory point is formed by the intersection of two trajectory lines, and each trajectory line has a corresponding index number.
  • Figure 2a and Figure 2b Figure 2a is a partial image schematic diagram of the first image
  • Figure 2b is a partial image schematic diagram of the second image.
  • the numerical labels in Figure 2a represent the index numbers of the trajectory lines in the first image
  • the black dots represents the trajectory point formed by the intersection of two trajectory lines.
  • the numerical label in Figure 2b represents the index number of the trajectory line in the second image, which corresponds to the trajectory line in the first image.
  • the gray dot represents the two trajectory lines. The trajectory points formed by the intersection.
  • the first image can be a microscope image
  • the second image can be a gene expression visualization image, a gene expression image or a gene image, that is, pixel-level registration of the microscope image and the gene expression visualization image can be achieved.
  • the microscope image is obtained by taking a biological sample on the spatio-temporal chip with a microscope
  • the gene expression visualization image is based on the same biological sample and generated using a gene expression matrix.
  • sites on the spatiotemporal chip for collecting genes of biological samples. Each site can capture the gene sequence of the biological sample. Through gene sequencing, the gene sequence or the number of bases at each site can be obtained, and then the gene sequence or the number of bases can be obtained.
  • the number of gene sequences of the site is used as the value of the element in the gene expression matrix, so that the elements of the gene expression matrix correspond to the sites of the spatiotemporal chip (for example, one element corresponds to one site, the first row and the first column of the gene expression matrix The elements correspond to the position in the upper left corner of the space-time chip) and so on to obtain the gene expression matrix, and then draw a gene expression visualization image based on the gene expression matrix.
  • the pixels in the gene expression visualization image correspond to the elements of the gene expression matrix, and the pixel values of the pixels correspond to the values of the elements. Therefore, the gene expression visualization image contains spatial information of the same biological sample.
  • Chips can include spatiotemporal chips, sequencing chips, etc.
  • S102 Obtain the first trajectory line in the first image, and rotate the first image based on the angle between the first trajectory line and the horizontal direction.
  • the first image is a microscope image
  • the trajectory lines in the microscope image are not necessarily in the horizontal and vertical directions, so the first trajectory line in the microscope image can be selected as the benchmark to calculate
  • the angle between the first trajectory line and the horizontal direction is located in the horizontal direction after the microscope image is rotated by the above-mentioned angle.
  • Figure 3 a schematic diagram of a first image is shown. It can be seen from Figure 3 that the first image is not located in the horizontal direction, and there is an angle between the first trajectory line and the horizontal direction. Therefore, the first image can be rotated to the horizontal direction after calculating the included angle.
  • the gene expression visualization image is generated by a gene expression matrix and appears as many discrete points, it has a weak ability to express aggregate features or edge features of biological samples.
  • tissue segmentation can be performed on the gene expression visualization image to obtain the biological sample outline displayed by gene expression, and convolution enhancement processing is performed on the approximate area where the sample outline is located to enhance the edge features of the gene expression visualization image. , to facilitate subsequent registration of microscope images and gene expression visualization images.
  • S103 Enlarge or reduce the first image to obtain a third image, where the third image has the same proportion as the second image.
  • the first image is an image captured by a microscope
  • the second image is a gene expression visualization image
  • it can be used as a reference image, and there may be a difference in the scaling ratio between the first image captured by the microscope and the second image.
  • it is necessary to enlarge or reduce the first image to obtain a third image that is the same size as the second image.
  • the scaling ratio of the first image can be determined based on the distance between the trajectory lines corresponding to the index numbers in the first image and the second image. Specifically, the second trajectory line in the first image is obtained, and the first distance is determined based on the first trajectory line and the second trajectory line of the first image; the third trajectory line and the fourth trajectory line in the second image are obtained, wherein , the index number of the third trajectory line is the same as the index number of the first trajectory line, the index number of the fourth trajectory line is the same as the index number of the second trajectory line, and the second distance is determined based on the third trajectory line and the fourth trajectory line.
  • a scaling ratio value between the first image and the second image is determined based on the first spacing and the second spacing, and the first image is enlarged or reduced according to the above scaling value to obtain a third image with the same ratio as the second image.
  • the first trajectory line and the second trajectory line are parallel; the third trajectory line and the fourth trajectory line are parallel.
  • the first distance When the first distance is determined based on the first trajectory line and the second trajectory line, it can be calculated using the trajectory points on the first trajectory line and the trajectory points on the second trajectory line.
  • the two trajectory points When coordinates are used, the difference between the corresponding ordinates or the abscissas can be used as the first spacing.
  • the second spacing between the third trajectory line and the fourth trajectory line can be determined based on the same principle. It should be noted that the method for calculating the scaling ratio of the first image and the second image provided in the above embodiments is only an exemplary description and is not limited to the above implementation.
  • S104 Determine the target offset based on the second image and the third image.
  • the target offset can be determined based on the second image and the third image. It can be seen from the above embodiment that after the original first image is rotated to the horizontal direction, there may be a 90-degree angle difference between the first image and the second image. In order to further improve the accuracy of image processing, the first image is scaled to After the third image has the same proportion as the second image, the third image can be rotated according to a preset rotation angle, and the corresponding target offset is determined at each rotation angle. The following will be explained with a specific application scenario.
  • S represents the third image
  • V represents the second image
  • the black point represents the center of gravity of the third image
  • the gray point represents the center of gravity of the second image.
  • the four areas in Figure 4 represent the original third image respectively. image and the image after rotating the third image clockwise by 90 degrees, 180 degrees, and 270 degrees. After the third image is rotated, the alignment can be performed based on the origin coordinates of the third image and the origin coordinates of the second image, and then the target offset is determined based on the aligned third image and the second image.
  • this embodiment provides an optimal implementation method, that is, first, the third image can be preliminarily processed according to the coordinates of the center of gravity of the third image and the second image. Position it to roughly the same position as the second image, and then calculate the target offset based on the moved third image to perform precise positioning.
  • the first image is enlarged or reduced to obtain a fifth image, where the fifth image has the same proportion as the second image.
  • the fourth image is the fourth image from which preliminary positioning is obtained.
  • a density centroid algorithm based on pixel gray values can be used, which is not limited in this embodiment.
  • the processing process can be implemented on the temporary image that copies the first image, that is, the first image is not moved and registered. After the calculation is completed, the final target offset is obtained. , and then move the first image all at once to register with the second image.
  • the target offset can be determined based on the fourth image and the second image.
  • the trajectory lines on the space-time chip may have multiple periods, so the microscope images and gene expression visualization images obtained based on the space-time chip may also have multiple periods, that is, the fourth image and the second image have multiple periods. cycle. There is a corresponding sub-image in each cycle, the number of trajectory lines and trajectory points in each sub-image is the same, and the index numbers of the trajectory lines between the sub-images correspond one to one.
  • Figures 5a and 5b Figure 5a shows a third image with multiple cycles
  • Figure 5b shows a second image with multiple cycles. In Figure 5a, only the sub-images of the first period and the second period are shown.
  • each period has the same number of index lines and index points, and each index line corresponds to an index number.
  • the sub-images corresponding to the first period and the second period are also shown in Figure 5b.
  • the schematic diagrams of the third image and the second image provided in the above embodiments are only one possible implementation manner, and do not limit the specific form of the images in any way. Therefore, when determining the target offset based on the fourth image and the second image, the influence of the period needs to be considered.
  • first the first offset can be determined based on the fourth image and the second image, where the first offset is the undetermined offset between the fourth image and the second image, and then the first offset can be used to determine the offset between the fourth image and the second image.
  • determine a plurality of second offsets corresponding to the first offset within the preset period that is, each period within the preset period corresponds to a second offset.
  • the first similarity corresponding to each cycle of .
  • the above determined similarity is obtained at any rotation angle, it is necessary to re-execute the above steps at other preset rotation angles to obtain multiple first similarities corresponding to each rotation angle.
  • a first maximum similarity is determined, and the sixth image corresponding to the first maximum similarity is determined as the third image. Then the second offset corresponding to the third image can be determined as the target offset.
  • one possible implementation is to first obtain multiple sets of trajectory point sets, where each set of trajectory point sets includes a first trajectory point and a second trajectory point. , the first trajectory point is located in the fourth image, the second trajectory point is located in the second image, and the first trajectory point and the second trajectory point have the same index identifier. Since a trajectory point is formed by two intersecting trajectory lines, and each trajectory line has an index number, the index identification of the trajectory point can be composed of the index numbers of the two intersecting trajectory lines of the trajectory point.
  • the fourth offset may be determined based on the coordinates of the first track point and the coordinates of the second track point, and then the first offset may be determined based on a plurality of fourth offsets. Shift amount.
  • the first trajectory point and the second trajectory point obtained with the same index identification may not belong to the corresponding cycle, so the determined first trajectory point There may be multiple trajectory points.
  • any first trajectory point in the fourth image can be first selected, and the index identification of the first trajectory point is determined to have the same identification.
  • multiple second trajectory points In order to obtain the second trajectory point corresponding to the first trajectory point, the Euclidean distance between the first trajectory point and each second trajectory point can be calculated separately. After calculating multiple Euclidean distances, obtain the Euclidean distance corresponding to the minimum Euclidean distance.
  • the second trajectory point is the second trajectory point corresponding to the first trajectory point.
  • the fourth offset is determined based on the coordinate difference between the second trajectory point corresponding to the minimum Euclidean distance and the first trajectory point. Since there are multiple trajectory points in the fourth image, that is, corresponding to multiple sets of trajectory points, it is necessary to traverse all the trajectory point sets, and determine the position corresponding to each set of trajectory points according to the above method of determining the basic offset. Fourth offset. In a possible implementation, among the plurality of determined fourth offsets, fourth offsets that exceed the preset range may be first excluded, and then the target offset is determined based on the remaining fourth offsets.
  • the median of multiple fourth offsets can be selected as the target offset, or the average of all fourth offsets can be calculated as the target offset to maximize the accuracy of determining the offset. sex. It should be noted that this embodiment does not limit the specific manner of determining the target offset based on the fourth offset.
  • FIG. 6 is a schematic diagram of a preset period determined with the first offset as the center.
  • the second image is used as the benchmark.
  • the middle gray area represents the period in which the second trajectory point is located.
  • this embodiment provides a possible implementation method, that is, perform frequency domain transformation on the sixth image to obtain the first frequency domain image, perform frequency domain transformation on the second image to obtain the second frequency domain image, and calculate the third frequency domain image.
  • the Hamming distance between the first frequency domain image and the second frequency domain image is used as the similarity. When the Hamming distance is smaller, it indicates that the similarity between the first frequency domain image and the second frequency domain image is greater. After determining the Hamming distances corresponding to all preset rotation angles and all preset periods, the minimum Hamming distance is used as the first maximum similarity.
  • discrete cosine transform can be used to obtain the frequency domain image, that is, discrete cosine transform is performed on the moved third image to obtain the first frequency domain image, and discrete cosine transform is performed on the second image to obtain the second frequency domain image, and then the first frequency domain image is obtained by discrete cosine transform.
  • the low-frequency frequency domain image is intercepted from the frequency domain image. Based on the low-frequency frequency domain image, the pixel mean of the low-frequency frequency domain image is calculated. In the low-frequency frequency domain image, the pixel value of the pixel point with a pixel value higher than the pixel mean is set to 1.
  • the fourth image can be initially moved and positioned according to the offset of the center of gravity from the second image.
  • the third image is not The four images are initially positioned, and for any preset rotation angle, the fourth image is moved according to each period within the preset period to obtain a seventh image corresponding to each period.
  • the third barycenter coordinate of the fourth image can be calculated first, and the fourth image can be moved according to each period within the preset period with the period where the third barycenter coordinate is located as the center to obtain the seventh image. Then the second similarity between the seventh image and the second image is calculated, thereby obtaining the second similarity corresponding to each period within the preset period.
  • the seventh image corresponding to the second maximum similarity is used as the third image, and then the target offset is determined based on the third image and the second image.
  • a plurality of third offsets may be determined based on the second image and the third image, and the target offset may be determined based on the plurality of third offsets.
  • the calculation principle of the third offset is the same as the calculation principle of the fourth offset in the above embodiment. That is, multiple groups of trajectory point sets are obtained, wherein each group of trajectory point sets includes a third trajectory point and a fourth trajectory point, the third trajectory point is located in the third image, the fourth trajectory point is located in the second image, and the third trajectory point It has the same index identifier as the fourth track point.
  • a third offset is determined based on the coordinates of the third trajectory point and the coordinates of the fourth trajectory point.
  • the third offsets that exceed the preset range can be first excluded, and then selected from a plurality of third offsets that meet the preset range.
  • the median is used as the target offset, or the average of multiple third offsets is calculated as the target offset to maximize the accuracy of determining the offset.
  • a preset rotation angle corresponding to the target offset is determined, and the third image is moved based on the preset rotation angle and the target offset.
  • the image movement in the intermediate process is a process implemented on the temporary image that copies the first image, that is, the first image is not moved and registered.
  • the final target offset is obtained. After that, the first image is moved once again to register with the second image.
  • the first image and the second image can be registered based on the image coordinates with pixel-level accuracy, thereby improving the accuracy of image processing and facilitating subsequent use of the registered images for research and development. analyze.
  • the image and the second image have multiple periods, since the offset corresponding to the preset period is inferred from the calculated offset using the theoretical period width, errors may exist in the actual image.
  • the image can be re-imaged. Use the third image and the second image to determine the correction offset as the final offset, and continue to move the third image based on the determined final offset, and register the third image with the second image to improve Registration accuracy.
  • each group of trajectory point sets includes a fifth trajectory point and a sixth trajectory point, and the fifth trajectory point is located in the third image, and the The sixth track point is located in the second image, and the fifth track point and the sixth track point have the same index identification.
  • a fifth offset is determined based on the coordinates of the fifth trajectory point and the coordinates of the sixth trajectory point.
  • the final offset is determined based on the plurality of fifth offsets. The implementation of determining the fifth offset and determining the final offset based on multiple fifth offsets may refer to the above embodiments and will not be described again here.
  • Figure 7 is a schematic flow chart of another image processing method provided by an embodiment of the present application.
  • the first image is a microscope image
  • the second image is a gene expression visualization image.
  • preprocess the image for example, rotate the microscope image to the horizontal direction and scale the microscope image to the same scale as the gene expression visualization image.
  • convolution enhancement processing can be performed on the gene expression visualization image to enhance the edge features of the image.
  • the microscope image can be rotated to four directions, namely the original horizontal direction, a clockwise rotation of 90 degrees, a clockwise rotation of 180 degrees, and a clockwise rotation of 270 degrees. The same process is performed in any direction.
  • Image processing steps That is, the center of gravity of the microscope image and the gene expression visualization image are calculated respectively, and the microscope image is initially positioned.
  • the basic offset is then determined using the coordinates of the trajectory points identified by the corresponding index in the microscope image and gene expression visualization image. Taking the basic offset as the center, traverse the basic offset corresponding to the preset period, calculate the image similarity under the corresponding period, perform the above steps for each rotation direction, and determine the corresponding direction of each rotation and each period. Image similarity, select the period with the highest similarity as the benchmark, determine the basic offset corresponding to the period as the target offset, and then move the microscope image based on the target offset to achieve image registration.
  • the device 800 includes:
  • the first acquisition unit 801 is used to acquire a first image and a second image, wherein the first image and the second image include a plurality of trajectory lines and/or a plurality of trajectory points, and the trajectory points are formed by Formed by the intersection of two of the trajectory lines, each of the plurality of trajectory lines has a corresponding index number;
  • the second acquisition unit 802 is used to acquire the first trajectory line in the first image, and rotate the first image based on the angle between the first trajectory line and the horizontal direction;
  • the first processing unit 803 is configured to enlarge or reduce the first image to obtain a third image, where the third image has the same proportion as the second image;
  • a second processing unit 804 configured to determine a target offset based on the second image and the third image
  • the third processing unit 805 is configured to move the third image based on the target offset.
  • the first processing unit 803 is specifically configured to obtain the second trajectory line in the first image, and determine the first distance based on the first trajectory line and the second trajectory line; Obtain the third trajectory line and the fourth trajectory line in the second image, and determine the second distance based on the third trajectory line and the fourth trajectory line, wherein the index number of the third trajectory line is the same as the index number of the third trajectory line.
  • the index number of the first trajectory line is the same, the index number of the fourth trajectory line is the same as the index number of the second trajectory line; the proportion value is determined based on the first spacing and the second spacing, and the The first image is enlarged or reduced according to the ratio value to obtain a third image.
  • the first processing unit 803 is specifically configured to enlarge or reduce the first image to obtain a fourth image, where the fourth image has the same proportion as the second image;
  • the fourth image moves according to a preset period and a preset rotation angle to obtain the third image.
  • the first processing unit 803 is specifically configured to enlarge or reduce the first image to obtain a fifth image, where the fifth image and the second image have the same proportion; respectively Calculate the first gravity center coordinate of the fifth image and the second gravity center coordinate of the second image; determine the gravity center offset based on the first gravity center coordinate and the second gravity center coordinate; based on the gravity center offset
  • the fifth image is moved to obtain the fourth image.
  • the first processing unit 803 is specifically configured to obtain the preset period and multiple preset rotation angles; for any preset rotation angle, based on the fourth image and the third
  • the second image determines a first offset; determines a plurality of second offsets corresponding to the first offset within the preset period, and each second offset in the plurality of second offsets is determined.
  • the offset corresponds to each period within the preset period; for any second offset, move the fourth image based on the second offset to obtain a sixth image; determine the a first similarity between the sixth image and the second image; determining a first maximum similarity based on the plurality of preset rotation angles and the first similarity corresponding to each period; determining the first similarity
  • the sixth image corresponding to a maximum similarity is the third image.
  • the second processing unit 804 is specifically configured to determine the second offset corresponding to the third image as the target offset
  • the third processing unit 805 is specifically configured to move the third image based on the preset rotation angle corresponding to the third image and the target offset.
  • the first processing unit 803 is specifically configured to obtain the preset period and the plurality of preset rotation angles; for any preset rotation angle, the fourth image is processed according to Each period within the preset period is moved to obtain a plurality of seventh images, and each seventh image in the plurality of seventh images corresponds to each period within the preset period; for any a seventh image, determining a second degree of similarity between the seventh image and the second image; determining a second degree of similarity based on the plurality of preset rotation angles and the second degree of similarity corresponding to each period. Maximum similarity; determine the seventh image corresponding to the second maximum similarity as the third image.
  • the second processing unit 804 is specifically configured to determine a plurality of third offsets based on the second image and the third image; determine a plurality of third offsets based on the plurality of third offsets.
  • the third processing unit 805 is specifically configured to move the third image based on the preset rotation angle corresponding to the third image and the target offset.
  • the first processing unit 803 is specifically configured to obtain multiple sets of trajectory point sets, each of the multiple sets of trajectory point sets including a first trajectory point and a second trajectory point, The first trajectory point is located in the fourth image, the second trajectory point is located in the second image, and the first trajectory point and the second trajectory point have the same index identifier; for any group of trajectories point set, determining a fourth offset based on the coordinates of the first track point and the coordinates of the second track point under the track point set; based on the fourth offset corresponding to the multiple groups of track point sets The amount determines the first offset.
  • the trajectory lines of each sub-image have the same index number
  • the first processing unit 803 is specifically used to perform tracking based on the first trajectory point.
  • the index identification determines the second trajectory point in each sub-image, and the first trajectory point and the second trajectory point have the same index identification; determines the first trajectory point and a plurality of the second trajectory points.
  • the coordinates of the corresponding second trajectory point determine the fourth offset amount.
  • the first processing unit 803 is specifically configured to perform frequency domain transformation on the sixth image to obtain a first frequency domain image; perform frequency domain transformation on the second image to obtain a second frequency domain image. image; calculate the Hamming distance between the first frequency domain image and the second frequency domain image as the first similarity; the first processing unit 803 is also configured to based on the plurality of preset rotation angles and the Describe the Hamming distance corresponding to each period, and determine the minimum Hamming distance as the first maximum similarity.
  • the first processing unit 803 is specifically configured to calculate the third barycenter coordinate of the fourth image; taking the period in which the third barycenter coordinate is located as the center, calculate the third barycenter coordinate according to each of the The fourth image is moved in cycles to obtain the seventh image.
  • the first processing unit 803 is specifically configured to obtain multiple sets of trajectory point sets, each of the multiple sets of trajectory point sets including a third trajectory point and a fourth trajectory point, The third trajectory point is located in the third image, the fourth trajectory point is located in the second image, and the third trajectory point and the fourth trajectory point have the same index identifier; for any group of trajectories Point set, determining a third offset based on the coordinates of the third trajectory point and the coordinates of the fourth trajectory point under the trajectory point set.
  • the device 800 is further configured to obtain multiple sets of trajectory point sets based on the moved third image and the second image.
  • Each set of trajectories in the multiple sets of trajectory point sets is The point set includes a fifth trajectory point and a sixth trajectory point.
  • the fifth trajectory point is located in the third image after the movement.
  • the sixth trajectory point is located in the second image.
  • the fifth trajectory point It has the same index identifier as the six track points; for any set of track points, the fifth offset is determined based on the coordinates of the fifth track point and the coordinates of the sixth track point under the set of track points. amount; determine the final offset amount based on the fifth offset amount corresponding to the plurality of sets of trajectory points; and move the moved third image based on the final offset amount.
  • the first acquisition unit 801 is specifically configured to acquire an eighth image, and perform convolution enhancement processing on the eighth image to obtain the second image.
  • the electronic device 900 includes: a memory 901 and a processor 902;
  • the memory 901 is used to store instructions or computer programs
  • the processor 902 is configured to execute the instructions or computer programs in the memory, so that the electronic device executes the image processing method described in the above method embodiment.
  • embodiments of the present application also provide a computer-readable storage medium, the computer-readable storage medium being used to store a computer program, and the computer program being used to execute the image processing method described in the above method embodiment.
  • Embodiments of the present application also provide a computer program product.
  • the computer program product includes a program.
  • the program When the program is run on a processor, the computer or network device causes the computer or network device to execute the image processing method described in the above method embodiment.
  • each embodiment in this specification is described in a progressive manner, and each embodiment focuses on its differences from other embodiments.
  • the same and similar parts between the various embodiments can be referred to each other.
  • the system or device embodiments are described simply because they are basically similar to the method embodiments.
  • the device embodiments described above are only illustrative, in which units or modules illustrated as separate components may or may not be physically separated, and components shown as units or modules may or may not be physical modules, that is, It can be located in one place, or it can also be distributed to multiple network units. Some or all of the units or modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. Persons of ordinary skill in the art can understand and implement the method without any creative effort.
  • At least one (item) refers to one or more, and “plurality” refers to two or more.
  • “And/or” is used to describe the relationship between associated objects, indicating that there can be three relationships. For example, “A and/or B” can mean: only A exists, only B exists, and A and B exist simultaneously. , where A and B can be singular or plural. The character “/” generally indicates that the related objects are in an "or” relationship. “At least one of the following” or similar expressions thereof refers to any combination of these items, including any combination of a single item (items) or a plurality of items (items).
  • At least one of a, b or c can mean: a, b, c, "a and b", “a and c", “b and c", or "a and b and c” ”, where a, b, c can be single or multiple.
  • RAM random access memory
  • ROM read-only memory
  • electrically programmable ROM electrically erasable programmable ROM
  • registers hard disks, removable disks, CD-ROMs, or anywhere in the field of technology. any other known form of storage media.

Abstract

The present application relates to an image processing method and apparatus, and a device and a medium. The method comprises: acquiring a first image and a second image, wherein the first image and the second image comprise a plurality of trajectory lines and a plurality of trajectory points; next, selecting a first trajectory line in the first image, and rotating the first image on the basis of an included angle between the first trajectory line and a horizontal direction, i.e., rotating the first image to the horizontal direction, wherein the first image and the second image, which are initially obtained, may differ in terms of zoom ratio, and therefore the first image needs to be zoomed in or zoomed out to obtain a third image, such that the third image has the same ratio as the second image; and then, determining a target offset on the basis of the second image and the third image, and moving the third image on the basis of the target offset. By means of the image processing method provided in the embodiments of the present application, a first image and a second image can be registered at a pixel-level precision, thereby improving the accuracy of image processing.

Description

一种图像处理方法、装置、设备及介质An image processing method, device, equipment and medium 技术领域Technical field
本申请涉及图像处理技术领域,尤其涉及一种图像处理方法、装置、设备及介质。The present application relates to the field of image processing technology, and in particular, to an image processing method, device, equipment and medium.
背景技术Background technique
基因表达(gene expression)是指将来自基因的遗传信息合成功能性基因产物的过程,基因表达的产物通常是蛋白质,所有已知的生命都利用基因表达来合成生命的大分子。在空间维度的基因表达分析中,为将基因表达图像与生物样本的实际空间位置相对应,需要进行图像配准步骤,以获取准确的基因表达信息。Gene expression refers to the process of synthesizing genetic information from genes into functional gene products. The products of gene expression are usually proteins. All known life forms use gene expression to synthesize macromolecules of life. In spatial dimension gene expression analysis, in order to correspond the gene expression image to the actual spatial position of the biological sample, an image registration step is required to obtain accurate gene expression information.
现有配准技术可以进行显微镜图像和基因表达可视化图像的粗略位置对应,其中,基因表达可视化图像是利用包含空间位置信息的基因表达矩阵生成的。配合图像本身的特征辅以人工视觉调整,实现匹配显微镜拍摄图像与基因表达可视化图像空间位置的对应。但是现有的配准技术只能在生物样本这一相对宏观的维度实现位置匹配,导致配准的准确性较低,无法支持更精细程度的基因表达分析。Existing registration technology can perform rough position correspondence between microscope images and gene expression visualization images, where the gene expression visualization image is generated using a gene expression matrix containing spatial position information. Based on the characteristics of the image itself and supplemented by artificial visual adjustment, the spatial position of the image captured by the microscope and the gene expression visualization image can be matched. However, existing registration technology can only achieve position matching in the relatively macroscopic dimension of biological samples, resulting in low registration accuracy and inability to support more refined gene expression analysis.
发明内容Contents of the invention
为了解决上述技术问题或者至少部分地解决上述技术问题,本申请提供了一种图像处理方法、装置、设备及介质,以便提高图像处理的准确性。In order to solve the above technical problems or at least partially solve the above technical problems, this application provides an image processing method, device, equipment and medium to improve the accuracy of image processing.
第一方面,本申请实施例提供了一种图像处理方法,所述方法包括:In a first aspect, embodiments of the present application provide an image processing method, which method includes:
获取第一图像和第二图像,其中,所述第一图像和所述第二图像包括多条轨迹线和/或多个轨迹点,所述轨迹点是由两条所述轨迹线相交形成的,所述多条轨迹线中的每条轨迹线具有对应的索引号;Obtaining a first image and a second image, wherein the first image and the second image include a plurality of trajectory lines and/or a plurality of trajectory points, the trajectory points are formed by the intersection of the two trajectory lines , each of the plurality of trajectory lines has a corresponding index number;
获取所述第一图像中的第一轨迹线,基于所述第一轨迹线与水平方向的夹角旋转所述第一图像;Obtain the first trajectory line in the first image, and rotate the first image based on the angle between the first trajectory line and the horizontal direction;
将所述第一图像进行放大或缩小得到第三图像,所述第三图像与所述第二图像具有相同的比例;Enlarging or reducing the first image to obtain a third image, the third image having the same proportion as the second image;
基于所述第二图像和所述第三图像确定目标偏移量;determining a target offset based on the second image and the third image;
基于所述目标偏移量移动所述第三图像。The third image is moved based on the target offset.
在一种可能的实现方式中,所述将所述第一图像进行放大或缩小得到第三图像,包括:In a possible implementation, enlarging or reducing the first image to obtain a third image includes:
获取所述第一图像中的第二轨迹线,基于所述第一轨迹线和所述第二轨迹线确定第一间距;Obtain a second trajectory line in the first image, and determine a first distance based on the first trajectory line and the second trajectory line;
获取所述第二图像中的第三轨迹线和第四轨迹线,基于所述第三轨迹线和所述第四轨迹线确定第二间距,其中,所述第三轨迹线的索引号与所述第一轨迹线的索引号相同,所述第四轨迹线的索引号与所述第二轨迹线的索引号相同;Obtain the third trajectory line and the fourth trajectory line in the second image, and determine the second distance based on the third trajectory line and the fourth trajectory line, wherein the index number of the third trajectory line is the same as the index number of the third trajectory line. The index number of the first trajectory line is the same, the index number of the fourth trajectory line is the same as the index number of the second trajectory line;
基于所述第一间距和所述第二间距确定比例值,将所述第一图像按照所述比例值进行放大或缩小得到第三图像。A ratio value is determined based on the first distance and the second distance, and the first image is enlarged or reduced according to the ratio value to obtain a third image.
在一种可能的实现方式中,所述将所述第一图像进行放大或缩小得到第三图像,包括:In a possible implementation, enlarging or reducing the first image to obtain a third image includes:
将所述第一图像进行放大或缩小得到第四图像,所述第四图像与所述第二图像具有相同的比例;Enlarging or reducing the first image to obtain a fourth image, the fourth image having the same proportion as the second image;
将所述第四图像按照预设周期和预设旋转角度移动,得到所述第三图像。The fourth image is moved according to a preset period and a preset rotation angle to obtain the third image.
在一种可能的实现方式中,所述将所述第一图像进行放大或缩小得到第四图像,包括:In a possible implementation, enlarging or reducing the first image to obtain a fourth image includes:
将所述第一图像进行放大或缩小得到第五图像,所述第五图像与所述第二图像具有相同的比例;Enlarging or reducing the first image to obtain a fifth image, where the fifth image has the same proportion as the second image;
分别计算所述第五图像的第一重心坐标和所述第二图像的第二重心坐标;Calculate the first barycenter coordinates of the fifth image and the second barycenter coordinates of the second image respectively;
基于所述第一重心坐标和所述第二重心坐标确定重心偏移量;Determine a center of gravity offset based on the first center of gravity coordinates and the second center of gravity coordinates;
基于所述重心偏移量移动所述第五图像,得到所述第四图像。The fifth image is moved based on the gravity center offset to obtain the fourth image.
在一种可能的实现方式中,所述将所述第四图像按照预设周期和预设旋转角度移动,得到所述第三图像,包括:In a possible implementation, the moving the fourth image according to a preset period and a preset rotation angle to obtain the third image includes:
获取所述预设周期和多个预设旋转角度;Obtain the preset period and multiple preset rotation angles;
针对任一预设旋转角度,基于所述第四图像和所述第二图像确定第一偏移量;For any preset rotation angle, determine a first offset based on the fourth image and the second image;
确定所述第一偏移量在所述预设周期内所对应的多个第二偏移量,所述多个第二偏移量中的每个第二偏移量与所述预设周期内的每个周期一一对应;Determine a plurality of second offsets corresponding to the first offset within the preset period, and each second offset in the plurality of second offsets is consistent with the preset period. Each cycle within has a one-to-one correspondence;
针对任一第二偏移量,基于所述第二偏移量移动所述第四图像,得到第六图像;For any second offset, move the fourth image based on the second offset to obtain a sixth image;
确定所述第六图像与所述第二图像之间的第一相似度;determining a first degree of similarity between the sixth image and the second image;
基于所述多个预设旋转角度和所述每个周期所对应的第一相似度确定第一最大相似度;Determine a first maximum similarity based on the plurality of preset rotation angles and the first similarity corresponding to each cycle;
确定所述第一最大相似度所对应的第六图像为所述第三图像。The sixth image corresponding to the first maximum similarity is determined to be the third image.
在一种可能的实现方式中,所述基于所述第二图像和所述第三图像确定目标偏移量,包括:In a possible implementation, determining the target offset based on the second image and the third image includes:
确定所述第三图像所对应的第二偏移量为所述目标偏移量;Determine the second offset corresponding to the third image as the target offset;
所述基于所述目标偏移量移动所述第三图像,包括:The moving the third image based on the target offset includes:
基于所述第三图像所对应的预设旋转角度和所述目标偏移量移动所述第三图像。The third image is moved based on the preset rotation angle corresponding to the third image and the target offset.
在一种可能的实现方式中,所述将所述第四图像按照预设周期和预设旋转角度移动,得到所述第三图像,包括:In a possible implementation, the moving the fourth image according to a preset period and a preset rotation angle to obtain the third image includes:
获取所述预设周期和所述多个预设旋转角度;Obtain the preset period and the plurality of preset rotation angles;
针对任一预设旋转角度,将所述第四图像分别按照所述预设周期内的每个周期移动,得到多个第七图像,所述多个第七图像中的每个第七图像与所述预设周期内的每个周期一一对应;For any preset rotation angle, the fourth image is moved according to each period within the preset period to obtain a plurality of seventh images, and each seventh image in the plurality of seventh images is related to Each period within the preset period has a one-to-one correspondence;
针对任一第七图像,确定所述第七图像与所述第二图像之间的第二相似度;For any seventh image, determine a second degree of similarity between the seventh image and the second image;
基于所述多个预设旋转角度和所述每个周期所对应的第二相似度确定第二最大相似度;Determine a second maximum similarity based on the plurality of preset rotation angles and the second similarity corresponding to each cycle;
确定所述第二最大相似度所对应的第七图像为所述第三图像。The seventh image corresponding to the second maximum similarity is determined to be the third image.
在一种可能的实现方式中,所述基于所述第二图像和所述第三图像确定目标偏移量,包括:In a possible implementation, determining the target offset based on the second image and the third image includes:
基于所述第二图像和所述第三图像确定多个第三偏移量;determining a plurality of third offsets based on the second image and the third image;
基于所述多个第三偏移量确定所述目标偏移量;determining the target offset based on the plurality of third offsets;
所述基于所述目标偏移量移动所述第三图像,包括:The moving the third image based on the target offset includes:
基于所述第三图像所对应的预设旋转角度和所述目标偏移量移动所述第三图像。The third image is moved based on the preset rotation angle corresponding to the third image and the target offset.
在一种可能的实现方式中,所述基于所述第四图像和所述第二图像确定第一偏移量,包括:In a possible implementation, determining the first offset based on the fourth image and the second image includes:
获取多组轨迹点集合,所述多组轨迹点集合中的每组轨迹点集合包括第一轨迹点和第二轨迹点,所述第一轨迹点位于所述第四图像,所述第二轨迹点位于所述第二图像,所述第一轨迹点与所述第二轨迹点具有相同的索引标识;Acquire multiple sets of trajectory point sets. Each set of trajectory points in the multiple sets of trajectory point sets includes a first trajectory point and a second trajectory point. The first trajectory point is located in the fourth image, and the second trajectory point is located in the fourth image. The point is located in the second image, and the first trajectory point and the second trajectory point have the same index identifier;
针对任一组轨迹点集合,基于所述轨迹点集合下的所述第一轨迹点的坐标和所述第二轨迹点的坐标确定第四偏移量;For any set of trajectory points, determine a fourth offset based on the coordinates of the first trajectory point and the coordinates of the second trajectory point under the set of trajectory points;
基于所述多组轨迹点集合所对应的第四偏移量确定所述第一偏移量。The first offset is determined based on the fourth offset corresponding to the plurality of sets of trajectory points.
在一种可能的实现方式中,当所述第二图像具有多个子图像时,每个子图像的轨迹线具有相同的索引号,所述基于所述轨迹点集合下的所述第一轨迹点的坐标和所述第二轨迹点的坐标确定第四偏移量,包括:In a possible implementation, when the second image has multiple sub-images, the trajectory line of each sub-image has the same index number, and the trajectory line based on the first trajectory point under the trajectory point set is The coordinates and the coordinates of the second trajectory point determine a fourth offset, including:
基于所述第一轨迹点的索引标识确定所述每个子图像中的所述第二轨迹点,所述第一轨迹点与所述第二轨迹点具有相同的索引标识;Determine the second trajectory point in each sub-image based on the index identification of the first trajectory point, where the first trajectory point and the second trajectory point have the same index identification;
确定所述第一轨迹点和多个所述第二轨迹点中任一第二轨迹点之间的欧式距离;Determine the Euclidean distance between the first trajectory point and any second trajectory point among the plurality of second trajectory points;
确定多个所述欧式距离中的最小欧式距离所对应的第二轨迹点;Determine the second trajectory point corresponding to the minimum Euclidean distance among the plurality of Euclidean distances;
基于所述第一轨迹点的坐标和所述最小欧式距离所对应的第二轨迹点的坐标确定第四偏移量。The fourth offset is determined based on the coordinates of the first trajectory point and the coordinates of the second trajectory point corresponding to the minimum Euclidean distance.
在一种可能的实现方式中,所述确定所述第六图像与所述第二图像之间的第一相似度,包括:In a possible implementation, determining the first similarity between the sixth image and the second image includes:
对所述第六图像进行频域变换得到第一频域图像;Perform frequency domain transformation on the sixth image to obtain a first frequency domain image;
对所述第二图像进行频域变换得到第二频域图像;Perform frequency domain transformation on the second image to obtain a second frequency domain image;
计算所述第一频域图像与所述第二频域图像之间的汉明距离作为第一相似度;Calculate the Hamming distance between the first frequency domain image and the second frequency domain image as the first similarity;
所述基于所述多个预设旋转角度和所述每个周期所对应的第一相似度确定第一最大相似度,包括:Determining the first maximum similarity based on the plurality of preset rotation angles and the first similarity corresponding to each cycle includes:
基于所述多个预设旋转角度和所述每个周期所对应的汉明距离,确定最小汉明距离为第一最大相似度。Based on the plurality of preset rotation angles and the Hamming distance corresponding to each period, the minimum Hamming distance is determined to be the first maximum similarity.
在一种可能的实现方式中,所述将所述第四图像分别按照所述预设周期内的每个周期移动,得到第七图像,包括:In a possible implementation, the step of moving the fourth image according to each period within the preset period to obtain a seventh image includes:
计算所述第四图像的第三重心坐标;Calculate the coordinates of the third center of gravity of the fourth image;
以所述第三重心坐标所在的周期为中心,分别按照所述每个周期移动所述第四图像,得到所述第七图像。Taking the period where the third barycenter coordinate is located as the center, the fourth image is moved according to each period to obtain the seventh image.
在一种可能的实现方式中,所述基于所述第二图像和所述第三图像确定多个第三偏移量,包括:In a possible implementation, determining a plurality of third offsets based on the second image and the third image includes:
获取多组轨迹点集合,所述多组轨迹点集合中的每组轨迹点集合包括第三轨迹点和第四轨迹点,所述第三轨迹点位于所述第三图像,所述第四轨迹点位于所述第二图像,所述 第三轨迹点与所述第四轨迹点具有相同的索引标识;Acquire multiple sets of trajectory point sets, each of the multiple sets of trajectory point sets includes a third trajectory point and a fourth trajectory point, the third trajectory point is located in the third image, and the fourth trajectory point The point is located in the second image, and the third trajectory point and the fourth trajectory point have the same index identifier;
针对任一组轨迹点集合,基于所述轨迹点集合下的所述第三轨迹点的坐标和所述第四轨迹点的坐标确定第三偏移量。For any set of trajectory points, a third offset is determined based on the coordinates of the third trajectory point and the coordinates of the fourth trajectory point under the set of trajectory points.
在一种可能的实现方式中,在基于所述目标偏移量移动所述第三图像之后,所述方法还包括:In a possible implementation, after moving the third image based on the target offset, the method further includes:
基于移动后的所述第三图像以及所述第二图像,获取多组轨迹点集合,所述多组轨迹点集合中的每组轨迹点集合包括第五轨迹点和第六轨迹点,所述第五轨迹点位于所述移动后的所述第三图像,所述第六轨迹点位于所述第二图像,所述第五轨迹点与所述六轨迹点具有相同的索引标识;Based on the moved third image and the second image, multiple sets of trajectory point sets are obtained, each of the multiple sets of trajectory point sets includes a fifth trajectory point and a sixth trajectory point, The fifth trajectory point is located in the third image after the movement, the sixth trajectory point is located in the second image, and the fifth trajectory point and the six trajectory points have the same index identifier;
针对任一组轨迹点集合,基于所述轨迹点集合下的所述第五轨迹点的坐标和所述第六轨迹点的坐标确定第五偏移量;For any group of trajectory point sets, determine a fifth offset based on the coordinates of the fifth trajectory point and the coordinates of the sixth trajectory point under the trajectory point set;
基于所述多组轨迹点集合所对应的第五偏移量确定最终偏移量;Determine the final offset based on the fifth offset corresponding to the multiple sets of trajectory points;
基于所述最终偏移量移动所述移动后的所述第三图像。The moved third image is moved based on the final offset.
在一种可能的实现方式中,所述获取第二图像包括:In a possible implementation, obtaining the second image includes:
获取第八图像,对所述第八图像进行卷积增强处理得到所述第二图像。An eighth image is acquired, and convolution enhancement processing is performed on the eighth image to obtain the second image.
第二方面,本申请实施例提供了一种图像处理装置,所述装置包括:In a second aspect, embodiments of the present application provide an image processing device, which includes:
第一获取单元,用于获取第一图像和第二图像,其中,所述第一图像和所述第二图像包括多条轨迹线和/或多个轨迹点,所述轨迹点是由两条所述轨迹线相交形成的,所述多条轨迹线中的每条轨迹线具有对应的索引号;A first acquisition unit, configured to acquire a first image and a second image, wherein the first image and the second image include a plurality of trajectory lines and/or a plurality of trajectory points, and the trajectory points are composed of two The trajectory lines are formed by intersecting, and each trajectory line in the plurality of trajectory lines has a corresponding index number;
第二获取单元,用于获取所述第一图像中的第一轨迹线,基于所述第一轨迹线与水平方向的夹角旋转所述第一图像;a second acquisition unit, configured to acquire the first trajectory line in the first image, and rotate the first image based on the angle between the first trajectory line and the horizontal direction;
第一处理单元,用于将所述第一图像进行放大或缩小得到第三图像,所述第三图像与所述第二图像具有相同的比例;A first processing unit configured to enlarge or reduce the first image to obtain a third image, where the third image has the same proportion as the second image;
第二处理单元,用于基于所述第二图像和所述第三图像确定目标偏移量;a second processing unit configured to determine a target offset based on the second image and the third image;
第三处理单元,用于基于所述目标偏移量移动所述第三图像。A third processing unit configured to move the third image based on the target offset.
第三方面,本申请实施例提供了一种电子设备,所述电子设备包括:存储器以及处理器;In a third aspect, embodiments of the present application provide an electronic device, where the electronic device includes: a memory and a processor;
所述存储器,用于存储指令或计算机程序;The memory is used to store instructions or computer programs;
所述处理器,用于执行所述存储器中的所述指令或计算机程序,以使得所述电子设备执行上述第一方面任意一种实现方式所述的图像处理方法。The processor is configured to execute the instructions or computer programs in the memory, so that the electronic device executes the image processing method described in any implementation of the first aspect.
第四方面,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质用于存储计算机程序,所述计算机程序用于执行上述第一方面任意一种实现方式所述的图像处理方法。In the fourth aspect, embodiments of the present application provide a computer-readable storage medium. The computer-readable storage medium is used to store a computer program. The computer program is used to execute any of the implementation methods described in the first aspect. Image processing methods.
第五方面,本申请实施例提供了一种计算机程序产品,所述计算机程序产品包含程序,当所述程序在处理器上运行时,使得计算机或网络设备执行上述第一方面任意一种实现方式所述的图像处理方法。In a fifth aspect, embodiments of the present application provide a computer program product. The computer program product includes a program. When the program is run on a processor, it causes the computer or network device to execute any one of the implementation methods of the first aspect. The image processing method described.
本申请实施例提供的技术方案与现有技术相比具有如下优点:Compared with the existing technology, the technical solution provided by the embodiment of the present application has the following advantages:
本实施例在处理图像时,首先获取第一图像和第二图像,其中,第一图像和第二图像中包括多条轨迹线和多个轨迹点,轨迹点是由两条轨迹线相交形成的,每条轨迹线都具有对应的索引号。然后选取第一图像中的第一轨迹线,基于第一轨迹线与水平方向的夹角旋转第一图像,即将第一图像旋转至水平方向。初始获得的第一图像与第二图像的缩放比例可能不同,所以需要将第一图像进行放大或缩小后得到第三图像,使第三图像与第二图像具有相同的比例。然后基于第二图像和第三图像确定目标偏移量,并基于目标偏移量移动第三图像。通过本申请实施例提供的图像处理方法,可以在像素级精度配准第一图像与第二图像,提高图像处理的准确性。When processing images in this embodiment, the first image and the second image are first acquired. The first image and the second image include multiple trajectory lines and multiple trajectory points. The trajectory points are formed by the intersection of the two trajectory lines. , each trajectory line has a corresponding index number. Then select the first trajectory line in the first image, and rotate the first image based on the angle between the first trajectory line and the horizontal direction, that is, rotate the first image to the horizontal direction. The initially obtained first image and the second image may have different scaling ratios, so the first image needs to be enlarged or reduced to obtain a third image, so that the third image has the same ratio as the second image. The target offset is then determined based on the second image and the third image, and the third image is moved based on the target offset. Through the image processing method provided by the embodiment of the present application, the first image and the second image can be registered with pixel-level precision, thereby improving the accuracy of image processing.
附图说明Description of drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见,下面描述中的附图仅仅是本申请中提供的一些实施例,对于本领域普通技术人员来讲,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some of the embodiments provided in the present application. , for those of ordinary skill in the art, other drawings can also be obtained based on these drawings.
图1为本申请实施例提供的一种图像处理方法的流程示意图;Figure 1 is a schematic flowchart of an image processing method provided by an embodiment of the present application;
图2a为本申请实施例提供的一种图像示意图;Figure 2a is a schematic diagram of an image provided by an embodiment of the present application;
图2b为本申请实施例提供的另一种图像示意图;Figure 2b is another schematic diagram of an image provided by an embodiment of the present application;
图3为本申请实施例提供的一种第一图像的示意图;Figure 3 is a schematic diagram of a first image provided by an embodiment of the present application;
图4为本申请实施例提供的一种图像旋转的示意图;Figure 4 is a schematic diagram of image rotation provided by an embodiment of the present application;
图5a为本申请实施例提供的一种具有多个周期的第三图像的示意图;Figure 5a is a schematic diagram of a third image with multiple periods provided by an embodiment of the present application;
图5b为本申请实施例提供的一种具有多个周期的第二图像的示意图;Figure 5b is a schematic diagram of a second image with multiple periods provided by an embodiment of the present application;
图6为本申请实施例提供的一种预设周期的示意图;Figure 6 is a schematic diagram of a preset period provided by an embodiment of the present application;
图7为本申请实施例提供的另一种图像处理方法的流程示意图;Figure 7 is a schematic flow chart of another image processing method provided by an embodiment of the present application;
图8为本申请实施例提供的一种图像处理装置的结构示意图;Figure 8 is a schematic structural diagram of an image processing device provided by an embodiment of the present application;
图9为本申请实施例提供的一种电子设备的结构示意图。Figure 9 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整的描述,所描述的实施例仅为本申请示例性的实施方式,并非全部实现方式。本领域技术人员可以结合本申请的实施例,在不进行创造性劳动的情况下,获得其他的实施例,而这些实施例也在本申请的保护范围之内。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. The described embodiments are only exemplary implementations of the present application and are not all implementations. Those skilled in the art can combine the embodiments of the present application to obtain other embodiments without performing creative work, and these embodiments are also within the protection scope of the present application.
为了便于理解本申请所提供的技术方案,下面将对本申请所涉及的技术背景进行介绍。In order to facilitate understanding of the technical solutions provided by this application, the technical background involved in this application will be introduced below.
在空间维度的基因表达分析中,为将基因表达图像与生物样本的实际空间位置相对应,需要进行图像配准步骤,以获取准确的基因表达信息。现有配准技术多基于时空芯片上自带的特定图形标志,得到生物样本的显微镜拍摄图像,然后根据显微镜拍摄图像上标志的位置进行显微镜图像和基因表达可视化图像的粗略位置对应。配合图像本身的特征辅以人工视觉调整,实现匹配显微镜拍摄图像与基因表达可视化图像空间位置的对应。但是现有的配准技术只能在生物样本这一相对宏观的维度实现位置匹配,导致配准的准确性较低,无法支持更精细程度的基因表达分析。In spatial dimension gene expression analysis, in order to correspond the gene expression image to the actual spatial position of the biological sample, an image registration step is required to obtain accurate gene expression information. Existing registration technology is mostly based on specific graphic marks on the space-time chip to obtain the microscope image of the biological sample, and then roughly corresponds the position of the microscope image and the gene expression visualization image based on the position of the mark on the microscope image. Based on the characteristics of the image itself and supplemented by artificial visual adjustment, the spatial position of the image captured by the microscope and the gene expression visualization image can be matched. However, existing registration technology can only achieve position matching in the relatively macroscopic dimension of biological samples, resulting in low registration accuracy and inability to support more refined gene expression analysis.
基于此,本申请实施例提供了一种图像处理方法,以便提高图像处理的准确性。具体 实现时,首先获取第一图像和第二图像,其中,第一图像和第二图像中包括多条轨迹线和多个轨迹点,轨迹点是由两条轨迹线相交形成的,每条轨迹线都具有对应的索引号。然后选取第一图像中的第一轨迹线,基于第一轨迹线与水平方向的夹角旋转第一图像,即将第一图像旋转至水平方向。初始获得的第一图像与第二图像的缩放比例可能不同,所以需要将第一图像进行放大或缩小后得到第三图像,使第三图像与第二图像具有相同的比例。然后基于第二图像和第三图像确定目标偏移量,并基于目标偏移量移动第三图像。通过本申请实施例提供的图像处理方法,可以在像素级精度配准第一图像与第二图像,提高图像处理的准确性。Based on this, embodiments of the present application provide an image processing method to improve the accuracy of image processing. During specific implementation, the first image and the second image are first obtained, wherein the first image and the second image include multiple trajectory lines and multiple trajectory points. The trajectory points are formed by the intersection of the two trajectory lines. Each trajectory Lines have corresponding index numbers. Then select the first trajectory line in the first image, and rotate the first image based on the angle between the first trajectory line and the horizontal direction, that is, rotate the first image to the horizontal direction. The initially obtained first image and the second image may have different scaling ratios, so the first image needs to be enlarged or reduced to obtain a third image, so that the third image has the same ratio as the second image. The target offset is then determined based on the second image and the third image, and the third image is moved based on the target offset. Through the image processing method provided by the embodiment of the present application, the first image and the second image can be registered with pixel-level precision, thereby improving the accuracy of image processing.
下面将结合附图对本申请实施例所提供的图像处理方法进行介绍。The image processing method provided by the embodiment of the present application will be introduced below with reference to the accompanying drawings.
参见图1,图1为本申请实施例提供的一种图像处理方法的流程示意图。Referring to Figure 1, Figure 1 is a schematic flow chart of an image processing method provided by an embodiment of the present application.
该方法具体包括以下步骤:The method specifically includes the following steps:
S101:获取第一图像和第二图像;S101: Obtain the first image and the second image;
其中,第一图像和第二图像中包括多条轨迹线和/或多个轨迹点,轨迹点是由两条轨迹线相交形成的,每条轨迹线具有对应的索引号。The first image and the second image include multiple trajectory lines and/or multiple trajectory points. The trajectory points are formed by the intersection of two trajectory lines, and each trajectory line has a corresponding index number.
在对图像进行处理之前,首先获取第一图像和第二图像,在第一图像中具有多条轨迹线和轨迹点,每个轨迹点是由两条轨迹线相交形成的,并且每条轨迹线具有对应的索引号。在第二图像中也具有多条轨迹线和轨迹点,且轨迹线的索引号与第一图像中轨迹线的索引号一一对应。如图2a和图2b所示,图2a为第一图像的部分图像示意图,图2b为第二图像的部分图像示意图,图2a中的数字标号代表第一图像中轨迹线的索引号,黑色点代表两条轨迹线相交形成的轨迹点,同理,图2b中的数字标号代表第二图像中轨迹线的索引号,与第一图像中的轨迹线一一对应,灰色点代表两条轨迹线相交形成的轨迹点。Before processing the image, first obtain the first image and the second image. There are multiple trajectory lines and trajectory points in the first image. Each trajectory point is formed by the intersection of two trajectory lines, and each trajectory line has a corresponding index number. There are also multiple trajectory lines and trajectory points in the second image, and the index numbers of the trajectory lines correspond to the index numbers of the trajectory lines in the first image. As shown in Figure 2a and Figure 2b, Figure 2a is a partial image schematic diagram of the first image, and Figure 2b is a partial image schematic diagram of the second image. The numerical labels in Figure 2a represent the index numbers of the trajectory lines in the first image, and the black dots represents the trajectory point formed by the intersection of two trajectory lines. Similarly, the numerical label in Figure 2b represents the index number of the trajectory line in the second image, which corresponds to the trajectory line in the first image. The gray dot represents the two trajectory lines. The trajectory points formed by the intersection.
需要说明的是,上述实施例所提供的第一图像和第二图像的示意图仅为一种可能的实现方式,并非对图像的具体形式做任何限定。It should be noted that the schematic diagrams of the first image and the second image provided in the above embodiments are only one possible implementation manner, and do not limit the specific form of the images in any way.
在一种可能的实现方式中,第一图像可以为显微镜图像,第二图像可以为基因表达可视化图像、基因表达图像或基因图像,即可以实现显微镜图像与基因表达可视化图像的像素级配准。其中,显微镜图像是由显微镜拍摄时空芯片上的生物样本而得到的,基因表达可视化图像是基于同一生物样本,并利用基因表达矩阵生成的。时空芯片上有用于采集生物样本基因的规则排列的位点,每个位点可以捕获生物样本的基因序列,通过基因测序可以获得每个位点的基因序列或碱基的数量,然后可以将该位点的基因序列的数量作为基因表达矩阵中元素的值,从而使基因表达矩阵的元素与时空芯片的位点相对应(如一个元素对应一个位点,基因表达矩阵的第一行第一列的元素对应时空芯片左上角的位点)依次类推就可以得到基因表达矩阵,然后根据基因表达矩阵绘制基因表达可视化图像。其中,基因表达可视化图像中的像素点对应基因表达矩阵的元素,像素点的像素值对应元素的值,所以基因表达可视化图像包含同一生物样本的空间信息。芯片可以包括时空芯片、测序芯片等。In a possible implementation, the first image can be a microscope image, and the second image can be a gene expression visualization image, a gene expression image or a gene image, that is, pixel-level registration of the microscope image and the gene expression visualization image can be achieved. Among them, the microscope image is obtained by taking a biological sample on the spatio-temporal chip with a microscope, and the gene expression visualization image is based on the same biological sample and generated using a gene expression matrix. There are regularly arranged sites on the spatiotemporal chip for collecting genes of biological samples. Each site can capture the gene sequence of the biological sample. Through gene sequencing, the gene sequence or the number of bases at each site can be obtained, and then the gene sequence or the number of bases can be obtained. The number of gene sequences of the site is used as the value of the element in the gene expression matrix, so that the elements of the gene expression matrix correspond to the sites of the spatiotemporal chip (for example, one element corresponds to one site, the first row and the first column of the gene expression matrix The elements correspond to the position in the upper left corner of the space-time chip) and so on to obtain the gene expression matrix, and then draw a gene expression visualization image based on the gene expression matrix. Among them, the pixels in the gene expression visualization image correspond to the elements of the gene expression matrix, and the pixel values of the pixels correspond to the values of the elements. Therefore, the gene expression visualization image contains spatial information of the same biological sample. Chips can include spatiotemporal chips, sequencing chips, etc.
S102:获取第一图像中的第一轨迹线,基于第一轨迹线与水平方向的夹角旋转第一图像。S102: Obtain the first trajectory line in the first image, and rotate the first image based on the angle between the first trajectory line and the horizontal direction.
当第一图像为显微镜图像时,由于显微镜图像是由拍摄得到的,所以显微镜图像中的轨迹线并不一定处于水平方向和垂直方向,所以可以选取显微镜图像中的第一轨迹线作为基准,计算第一轨迹线与水平方向的夹角,将显微镜图像旋转上述夹角后位于水平方向。参见图3,展示了一种第一图像的示意图。由图3可知,第一图像没有位于水平方向,第一轨迹线与水平方向存在一个夹角。所以可以计算出所述夹角后将第一图像旋转至水平方向。When the first image is a microscope image, since the microscope image is obtained by shooting, the trajectory lines in the microscope image are not necessarily in the horizontal and vertical directions, so the first trajectory line in the microscope image can be selected as the benchmark to calculate The angle between the first trajectory line and the horizontal direction is located in the horizontal direction after the microscope image is rotated by the above-mentioned angle. Referring to Figure 3, a schematic diagram of a first image is shown. It can be seen from Figure 3 that the first image is not located in the horizontal direction, and there is an angle between the first trajectory line and the horizontal direction. Therefore, the first image can be rotated to the horizontal direction after calculating the included angle.
当第二图像为基因表达可视化图像时,由于基因表达可视化图像是由基因表达矩阵生成的,表现为许多离散的点,对表达聚集特征或生物样本的边缘特征的能力较弱。在一种优选的实现方式中,可以对基因表达可视化图像进行组织分割以获取基因表达展现出的生物样本轮廓,对样本轮廓所在的大致区域进行卷积增强处理,增强基因表达可视化图像的边缘特征,方便后续将显微镜图像与基因表达可视化图像进行配准。When the second image is a gene expression visualization image, since the gene expression visualization image is generated by a gene expression matrix and appears as many discrete points, it has a weak ability to express aggregate features or edge features of biological samples. In a preferred implementation, tissue segmentation can be performed on the gene expression visualization image to obtain the biological sample outline displayed by gene expression, and convolution enhancement processing is performed on the approximate area where the sample outline is located to enhance the edge features of the gene expression visualization image. , to facilitate subsequent registration of microscope images and gene expression visualization images.
S103:将第一图像进行放大或缩小得到第三图像,其中,第三图像与第二图像具有相同的比例。S103: Enlarge or reduce the first image to obtain a third image, where the third image has the same proportion as the second image.
当第一图像是由显微镜拍摄的图像时,由于第二图像是基因表达可视化图像,即可以作为基准图像,而显微镜拍摄的第一图像与第二图像的缩放比例可能存在差异。为了实现将第一图像与第二图像的配准,所以需要将第一图像进行放大或缩小后得到与第二图像大小相同的第三图像。When the first image is an image captured by a microscope, since the second image is a gene expression visualization image, it can be used as a reference image, and there may be a difference in the scaling ratio between the first image captured by the microscope and the second image. In order to achieve registration of the first image and the second image, it is necessary to enlarge or reduce the first image to obtain a third image that is the same size as the second image.
在一种可能的实现方式中,可以根据第一图像与第二图像中对应索引号的轨迹线之间的间距确定第一图像的缩放比例。具体地,获取第一图像中的第二轨迹线,基于第一图像的第一轨迹线和第二轨迹线确定第一间距;获取第二图像中的第三轨迹线和第四轨迹线,其中,第三轨迹线的索引号与第一轨迹线的索引号相同,第四轨迹线的索引号与第二轨迹线的索引号相同,基于第三轨迹线和第四轨迹线确定第二间距。然后基于第一间距和第二间距确定第一图像和第二图像之间的缩放比例值,将第一图像按照上述比例值进行放大或缩小,得到与第二图像相同比例的第三图像。其中,第一轨迹线和第二轨迹线平行;第三轨迹线和第四轨迹线平行。In a possible implementation, the scaling ratio of the first image can be determined based on the distance between the trajectory lines corresponding to the index numbers in the first image and the second image. Specifically, the second trajectory line in the first image is obtained, and the first distance is determined based on the first trajectory line and the second trajectory line of the first image; the third trajectory line and the fourth trajectory line in the second image are obtained, wherein , the index number of the third trajectory line is the same as the index number of the first trajectory line, the index number of the fourth trajectory line is the same as the index number of the second trajectory line, and the second distance is determined based on the third trajectory line and the fourth trajectory line. Then, a scaling ratio value between the first image and the second image is determined based on the first spacing and the second spacing, and the first image is enlarged or reduced according to the above scaling value to obtain a third image with the same ratio as the second image. The first trajectory line and the second trajectory line are parallel; the third trajectory line and the fourth trajectory line are parallel.
当基于第一轨迹线和第二轨迹线确定第一间距时,可以利用第一轨迹线上的轨迹点与第二轨迹线上的轨迹点计算,当两个轨迹点具有相同的横坐标或者纵坐标时,对应的纵坐标的差值或者横坐标的差值即可作为第一间距。同理,可以基于相同的原理确定第三轨迹线和第四轨迹线之间的第二间距。需要说明的是,上述实施例所提供的计算第一图像和第二图像的缩放比例的方法仅为示例性的说明,并非仅限于上述实现方式。When the first distance is determined based on the first trajectory line and the second trajectory line, it can be calculated using the trajectory points on the first trajectory line and the trajectory points on the second trajectory line. When the two trajectory points have the same abscissa or vertical coordinate, When coordinates are used, the difference between the corresponding ordinates or the abscissas can be used as the first spacing. Similarly, the second spacing between the third trajectory line and the fourth trajectory line can be determined based on the same principle. It should be noted that the method for calculating the scaling ratio of the first image and the second image provided in the above embodiments is only an exemplary description and is not limited to the above implementation.
S104:基于第二图像和第三图像确定目标偏移量。S104: Determine the target offset based on the second image and the third image.
当第一图像缩放至第三图像,具有与第二图像相同的比例后,后续即可以根据第二图像和第三图像确定目标偏移量。通过上述实施例可知,将原始第一图像旋转至水平方向后,第一图像与第二图像之间可能存在90度倍角的差异,为了进一步提高图像处理的准确性,在将第一图像缩放至与第二图像相同比例的第三图像后,可以将第三图像按照预设旋转角度进行旋转,在每个旋转角度下确定对应的目标偏移量。下面将结合一种具体应用场景进行说明。When the first image is scaled to the third image and has the same proportion as the second image, the target offset can be determined based on the second image and the third image. It can be seen from the above embodiment that after the original first image is rotated to the horizontal direction, there may be a 90-degree angle difference between the first image and the second image. In order to further improve the accuracy of image processing, the first image is scaled to After the third image has the same proportion as the second image, the third image can be rotated according to a preset rotation angle, and the corresponding target offset is determined at each rotation angle. The following will be explained with a specific application scenario.
如图4所示,S表示第三图像,V表示第二图像,黑色点表示第三图像的重心,灰色点表示第二图像的重心,图4中四个区域的图分别表示了原始第三图像以及将第三图像顺时针旋转90度、180度、270度后的图像。在将第三图像进行旋转后,可以根据第三图像的原点坐标和第二图像的原点坐标进行对齐,然后根据原点对齐后的第三图像和第二图像确定目标偏移量。As shown in Figure 4, S represents the third image, V represents the second image, the black point represents the center of gravity of the third image, and the gray point represents the center of gravity of the second image. The four areas in Figure 4 represent the original third image respectively. image and the image after rotating the third image clockwise by 90 degrees, 180 degrees, and 270 degrees. After the third image is rotated, the alignment can be performed based on the origin coordinates of the third image and the origin coordinates of the second image, and then the target offset is determined based on the aligned third image and the second image.
针对任一预设旋转角度,为了更方便、更准确地处理图像,本实施例提供一种优选的实现方式,即首先可以根据第三图像与第二图像的重心坐标,将第三图像进行初步定位到与第二图像大致相同的位置,然后再根据移动后的第三图像计算目标偏移量,进行精准定位。具体实现时,将第一图像进行放大或缩小得到第五图像,其中第五图像与第二图像具有相同的比例。然后分别计算第五图像的第一重心坐标和第二图像的第二重心坐标,基于第一重心坐标和第二重心坐标确定重心偏移量,并基于该重心偏移量移动第五图像,得到第四图像,即得到初步定位的第四图像。其中,在计算第五图像和第二图像的重心坐标时,可以利用基于像素灰度值的密度质心算法实现,本实施例对此并不做限定。For any preset rotation angle, in order to process the image more conveniently and accurately, this embodiment provides an optimal implementation method, that is, first, the third image can be preliminarily processed according to the coordinates of the center of gravity of the third image and the second image. Position it to roughly the same position as the second image, and then calculate the target offset based on the moved third image to perform precise positioning. In specific implementation, the first image is enlarged or reduced to obtain a fifth image, where the fifth image has the same proportion as the second image. Then calculate the first gravity center coordinates of the fifth image and the second gravity center coordinates of the second image respectively, determine the gravity center offset based on the first gravity center coordinates and the second gravity center coordinates, and move the fifth image based on the gravity center offset, and get The fourth image is the fourth image from which preliminary positioning is obtained. When calculating the centroid coordinates of the fifth image and the second image, a density centroid algorithm based on pixel gray values can be used, which is not limited in this embodiment.
需要说明的是,关于中间过程中的图像移动,可以在复制第一图像的临时图像上实现的处理过程,即并非将第一图像进行移动配准,当计算完成得到最终的目标偏移量之后,再一次性移动第一图像,与第二图像进行配准。It should be noted that regarding the image movement in the intermediate process, the processing process can be implemented on the temporary image that copies the first image, that is, the first image is not moved and registered. After the calculation is completed, the final target offset is obtained. , and then move the first image all at once to register with the second image.
在得到初步定为的第四图像后,可以根据第四图像和第二图像确定目标偏移量。在实际应用中,时空芯片上自带的轨迹线可能具有多个周期,因此基于时空芯片得到的显微镜图像和基因表达可视化图像也可能具有多个周期,即第四图像和第二图像具有多个周期。每个周期内具有一个对应的子图像,每个子图像中的轨迹线和轨迹点数目相同,并且子图像之间轨迹线的索引号一一对应。如图5a和图5b所示,图5a展示了具有多个周期的第三图像,图5b展示了多个周期的第二图像。在图5a中,仅表示了第一周期和第二周期的子图像,可以得知每个周期的子图像中,具有相同数目的索引线和索引点,每条索引线均对应一个索引号。图5b中也表示了第一周期和第二周期对应的子图像。上述实施例所提供的第三图像和第二图像的示意图仅为一种可能的实现方式,并非对图像的具体形式做任何限定。所以基于第四图像和第二图像确定目标偏移量时,需要考虑周期的影响。After the initially determined fourth image is obtained, the target offset can be determined based on the fourth image and the second image. In practical applications, the trajectory lines on the space-time chip may have multiple periods, so the microscope images and gene expression visualization images obtained based on the space-time chip may also have multiple periods, that is, the fourth image and the second image have multiple periods. cycle. There is a corresponding sub-image in each cycle, the number of trajectory lines and trajectory points in each sub-image is the same, and the index numbers of the trajectory lines between the sub-images correspond one to one. As shown in Figures 5a and 5b, Figure 5a shows a third image with multiple cycles, and Figure 5b shows a second image with multiple cycles. In Figure 5a, only the sub-images of the first period and the second period are shown. It can be seen that the sub-images of each period have the same number of index lines and index points, and each index line corresponds to an index number. The sub-images corresponding to the first period and the second period are also shown in Figure 5b. The schematic diagrams of the third image and the second image provided in the above embodiments are only one possible implementation manner, and do not limit the specific form of the images in any way. Therefore, when determining the target offset based on the fourth image and the second image, the influence of the period needs to be considered.
具体实现时,首先可以根据第四图像和第二图像确定第一偏移量,该第一偏移量为第四图像与第二图像之间的待定偏移量,然后以第一偏移量为中心,确定第一偏移量在预设周期内所对应的多个第二偏移量,即在预设周期内的每个周期对应一个第二偏移量。针对任意一个第二偏移量,基于该第二偏移量移动第四图像,得到第六图像,然后计算第六图像与第二图像之间的第一相似度,从而得到在预设周期内的每个周期所对应的第一相似度。由于上述确定相似度是在任意一个旋转角度下所得到的,所以需要在其他预设旋转角度下,重新执行上述步骤,得到每个旋转角度下所对应的多个第一相似度。基于所有旋转角度和所有周期所确定的多个第一相似度,确定第一最大相似度,将该第一最大相似度所对应的第六图像确定为第三图像。然后可以确定第三图像所对应的第二偏移量为目标偏移量。During specific implementation, first the first offset can be determined based on the fourth image and the second image, where the first offset is the undetermined offset between the fourth image and the second image, and then the first offset can be used to determine the offset between the fourth image and the second image. As the center, determine a plurality of second offsets corresponding to the first offset within the preset period, that is, each period within the preset period corresponds to a second offset. For any second offset, move the fourth image based on the second offset to obtain the sixth image, and then calculate the first similarity between the sixth image and the second image, thereby obtaining the result within the preset period. The first similarity corresponding to each cycle of . Since the above determined similarity is obtained at any rotation angle, it is necessary to re-execute the above steps at other preset rotation angles to obtain multiple first similarities corresponding to each rotation angle. Based on the plurality of first similarities determined by all rotation angles and all cycles, a first maximum similarity is determined, and the sixth image corresponding to the first maximum similarity is determined as the third image. Then the second offset corresponding to the third image can be determined as the target offset.
其中,根据第四图像和第二图像确定第一偏移量时,一种可能的实现方式为,首先获取多组轨迹点集合,其中每组轨迹点集合包括第一轨迹点和第二轨迹点,第一轨迹点位于 第四图像,第二轨迹点位于第二图像,第一轨迹点与第二轨迹点具有相同的索引标识。由于轨迹点是由两条相交的轨迹线形成的,每条轨迹线都具有索引号,所以轨迹点的索引标识可以由该轨迹点的两条相交轨迹线的索引号组成。在本实施例中,由于在第四图像和第二图像中均具有多个轨迹点,所以需要获取具有对应关系的轨迹点才可以作为一组轨迹点集合,即相同索引号的轨迹点。针对多组轨迹点集合中的任一组轨迹点集合,可以根据第一轨迹点的坐标和第二轨迹点的坐标确定第四偏移量,然后基于多个第四偏移量确定第一偏移量。When determining the first offset based on the fourth image and the second image, one possible implementation is to first obtain multiple sets of trajectory point sets, where each set of trajectory point sets includes a first trajectory point and a second trajectory point. , the first trajectory point is located in the fourth image, the second trajectory point is located in the second image, and the first trajectory point and the second trajectory point have the same index identifier. Since a trajectory point is formed by two intersecting trajectory lines, and each trajectory line has an index number, the index identification of the trajectory point can be composed of the index numbers of the two intersecting trajectory lines of the trajectory point. In this embodiment, since there are multiple trajectory points in both the fourth image and the second image, it is necessary to obtain trajectory points with corresponding relationships before they can be used as a set of trajectory points, that is, trajectory points with the same index number. For any set of track points among the multiple sets of track points, the fourth offset may be determined based on the coordinates of the first track point and the coordinates of the second track point, and then the first offset may be determined based on a plurality of fourth offsets. Shift amount.
为便于更清楚地理解本方案,在介绍第三偏移量的实现方式之前,首先对第四偏移量的实现方式进行说明。In order to facilitate a clearer understanding of this solution, before introducing the implementation method of the third offset, the implementation method of the fourth offset is first described.
具体实现时,由于第二图像存在多个周期,即具有多个子图像,由此所获取的具有相同索引标识的第一轨迹点和第二轨迹点可能不属于对应的周期,所以所确定的第二轨迹点可能有多个。在基于第一轨迹点的坐标和第二轨迹点的坐标确定第四偏移量时,可以首先选取第四图像中的任一第一轨迹点,根据第一轨迹点的索引标识确定具有相同标识的多个第二轨迹点。为了获取与第一轨迹点相对应的第二轨迹点,可以分别计算第一轨迹点与每一个第二轨迹点的欧式距离,在计算得到多个欧式距离后,获取欧式距离最小时所对应的第二轨迹点,即为与第一轨迹点相对应的第二轨迹点。然后根据最小欧式距离所对应的第二轨迹点以及第一轨迹点的坐标差值确定为第四偏移量。由于在第四图像中具有多个轨迹点,即对应多组轨迹点集合,所以需要遍历所有的轨迹点集合,按照上述确定基本偏移量的方法,确定与每一组轨迹点集合相对应的第四偏移量。在一种可能的实现方式中,在确定的多个第四偏移量中,可以首先排除超出预设范围的第四偏移量,然后根据剩余的第四偏移量确定目标偏移量。例如,可以选择多个第四偏移量中的中位数作为目标偏移量,或者计算所有第四偏移量的平均值作为目标偏移量,以尽可能地提高确定偏移量的准确性。需要说明的是,本实施例对根据第四偏移量确定目标偏移量的具体方式不做限定。During specific implementation, since the second image has multiple cycles, that is, multiple sub-images, the first trajectory point and the second trajectory point obtained with the same index identification may not belong to the corresponding cycle, so the determined first trajectory point There may be multiple trajectory points. When determining the fourth offset based on the coordinates of the first trajectory point and the coordinates of the second trajectory point, any first trajectory point in the fourth image can be first selected, and the index identification of the first trajectory point is determined to have the same identification. multiple second trajectory points. In order to obtain the second trajectory point corresponding to the first trajectory point, the Euclidean distance between the first trajectory point and each second trajectory point can be calculated separately. After calculating multiple Euclidean distances, obtain the Euclidean distance corresponding to the minimum Euclidean distance. The second trajectory point is the second trajectory point corresponding to the first trajectory point. Then, the fourth offset is determined based on the coordinate difference between the second trajectory point corresponding to the minimum Euclidean distance and the first trajectory point. Since there are multiple trajectory points in the fourth image, that is, corresponding to multiple sets of trajectory points, it is necessary to traverse all the trajectory point sets, and determine the position corresponding to each set of trajectory points according to the above method of determining the basic offset. Fourth offset. In a possible implementation, among the plurality of determined fourth offsets, fourth offsets that exceed the preset range may be first excluded, and then the target offset is determined based on the remaining fourth offsets. For example, the median of multiple fourth offsets can be selected as the target offset, or the average of all fourth offsets can be calculated as the target offset to maximize the accuracy of determining the offset. sex. It should be noted that this embodiment does not limit the specific manner of determining the target offset based on the fourth offset.
下面将结合一种具体应用场景对预设周期内的图像移动进行说明。The image movement within the preset period will be described below based on a specific application scenario.
参见图6,图6为以第一偏移量为中心所确定的预设周期的示意图。Referring to FIG. 6 , FIG. 6 is a schematic diagram of a preset period determined with the first offset as the center.
在一种可能的实现方式,以第二图像作为基准,由图6可知,中间灰色区域表示第二轨迹点所在的周期,根据第一轨迹点和第二轨迹点确定第一偏移量后,以该第一偏移量(对应的第二轨迹点所属的周期)为中心选择附近5*5个周期,确定每个周期所对应的第二偏移量,相邻周期所对应的第二偏移量的差值为子图像的宽度,以此类推,可以确定每个周期所对应的第二偏移量。In one possible implementation, the second image is used as the benchmark. As shown in Figure 6, the middle gray area represents the period in which the second trajectory point is located. After determining the first offset based on the first trajectory point and the second trajectory point, Taking the first offset (the period to which the corresponding second trajectory point belongs) as the center, select nearby 5*5 cycles to determine the second offset corresponding to each cycle, and the second offset corresponding to the adjacent cycle. The difference in shift amount is the width of the sub-image, and by analogy, the second offset corresponding to each cycle can be determined.
然后可以针对任一周期所对应的第二偏移量移动第四图像得到第六图像,并计算第六图像与第二图像之间的相似度。在计算相似度时,本实施例提供一种可能的实现方式,即对第六图像进行频域变换得到第一频域图像,对第二图像进行频域变换得到第二频域图像,计算第一频域图像和第二频域图像之间的汉明距离作为相似度。当汉明距离越小时,表明第一频域图像与第二频域图像的相似度越大。在确定所有的预设旋转角度和所有预设周期所对应的汉明距离之后,将最小汉明距离作为第一最大相似度。Then the fourth image can be moved according to the second offset corresponding to any period to obtain a sixth image, and the similarity between the sixth image and the second image can be calculated. When calculating the similarity, this embodiment provides a possible implementation method, that is, perform frequency domain transformation on the sixth image to obtain the first frequency domain image, perform frequency domain transformation on the second image to obtain the second frequency domain image, and calculate the third frequency domain image. The Hamming distance between the first frequency domain image and the second frequency domain image is used as the similarity. When the Hamming distance is smaller, it indicates that the similarity between the first frequency domain image and the second frequency domain image is greater. After determining the Hamming distances corresponding to all preset rotation angles and all preset periods, the minimum Hamming distance is used as the first maximum similarity.
其中,可以利用离散余弦变换获取频域图像,即对移动后的第三图像进行离散余弦变 换得到第一频域图像,对第二图像进行离散余弦变换得到第二频域图像,然后从第一频域图像中截取低频频域图像,以低频频域图像为基准,计算低频频域图像的像素均值,在低频频域图像中将像素值高于像素均值的像素点的像素值置为1,将像素值低于像素均值的像素点的像素值置为0,将像素值等于像素均值的像素点的像素值置为0或1,然后根据重新置值后的低频频域图像获取哈希指纹。按照同样的执行步骤,获取第二频域图像的哈希指纹。然后基于第一频域图像的哈希指纹和第二频域图像的哈希指纹确定两个哈希指纹对比有多少位不同的值,即作为第一频域图像和第二频域图像的汉明距离。需要说明的是,上述实施例中计算相似度的方法仅为示例性的实现方式,并非仅限于上述实现方式,其他可实现的计算图像相似度的方法也在本申请的保护范围内。Among them, discrete cosine transform can be used to obtain the frequency domain image, that is, discrete cosine transform is performed on the moved third image to obtain the first frequency domain image, and discrete cosine transform is performed on the second image to obtain the second frequency domain image, and then the first frequency domain image is obtained by discrete cosine transform. The low-frequency frequency domain image is intercepted from the frequency domain image. Based on the low-frequency frequency domain image, the pixel mean of the low-frequency frequency domain image is calculated. In the low-frequency frequency domain image, the pixel value of the pixel point with a pixel value higher than the pixel mean is set to 1. Set the pixel value of the pixel point whose pixel value is lower than the pixel mean value to 0, set the pixel value of the pixel point equal to the pixel mean value to 0 or 1, and then obtain the hash fingerprint based on the reset low-frequency frequency domain image. . Follow the same execution steps to obtain the hash fingerprint of the second frequency domain image. Then based on the hash fingerprint of the first frequency domain image and the hash fingerprint of the second frequency domain image, it is determined how many different values there are in the comparison of the two hash fingerprints, that is, as the Han of the first frequency domain image and the second frequency domain image. clear distance. It should be noted that the method of calculating similarity in the above embodiment is only an exemplary implementation, and is not limited to the above implementation. Other implementable methods of calculating image similarity are also within the protection scope of this application.
在本申请的上述实施例中,可以首先将第四图像按照与第二图像的重心偏移量进行初步移动定位,在另一种可能的实现方式中,在确定第三图像时,并不对第四图像进行初定位,针对任一预设旋转角度,将第四图像分别按照预设周期内的每个周期进行移动,得到每个周期所对应的第七图像。例如,可以先计算第四图像的第三重心坐标,以第三重心坐标所在的周期为中心,分别按照预设周期内的每个周期移动第四图像,得到第七图像。然后计算第七图像与第二图像之间的第二相似度,从而得到预设周期内每个周期所对应的第二相似度。然后根据其他的预设旋转角度,重复执行上述步骤,获取在每个预设旋转角度以及每个周期内所对应的第二相似度,并基于上述多个第二相似度确定第二最大相似度。将第二最大相似度所对应的第七图像作为第三图像,然后基于该第三图像和第二图像确定目标偏移量。In the above-mentioned embodiment of the present application, the fourth image can be initially moved and positioned according to the offset of the center of gravity from the second image. In another possible implementation, when determining the third image, the third image is not The four images are initially positioned, and for any preset rotation angle, the fourth image is moved according to each period within the preset period to obtain a seventh image corresponding to each period. For example, the third barycenter coordinate of the fourth image can be calculated first, and the fourth image can be moved according to each period within the preset period with the period where the third barycenter coordinate is located as the center to obtain the seventh image. Then the second similarity between the seventh image and the second image is calculated, thereby obtaining the second similarity corresponding to each period within the preset period. Then repeat the above steps according to other preset rotation angles to obtain the second similarity corresponding to each preset rotation angle and each period, and determine the second maximum similarity based on the plurality of second similarities. . The seventh image corresponding to the second maximum similarity is used as the third image, and then the target offset is determined based on the third image and the second image.
具体地,首先可以根据第二图像和第三图像确定多个第三偏移量,基于该多个第三偏移量确定目标偏移量。其中,该第三偏移量的计算原理与上述实施例中计算第四偏移量的原理相同。即,获取多组轨迹点集合,其中,每组轨迹点集合包括第三轨迹点和第四轨迹点,第三轨迹点位于第三图像,第四轨迹点位于第二图像,并且第三轨迹点与第四轨迹点具有相同的索引标识。针对任一组轨迹点集合,基于第三轨迹点的坐标和第四轨迹点的坐标确定第三偏移量。其中,基于第三轨迹点的坐标和第四轨迹点的坐标确定第三偏移量的具体实现方式可以参见基于第一轨迹点的坐标和第二轨迹点的坐标确定第四偏移量的具体实现方式,在此不再赘述。Specifically, first, a plurality of third offsets may be determined based on the second image and the third image, and the target offset may be determined based on the plurality of third offsets. The calculation principle of the third offset is the same as the calculation principle of the fourth offset in the above embodiment. That is, multiple groups of trajectory point sets are obtained, wherein each group of trajectory point sets includes a third trajectory point and a fourth trajectory point, the third trajectory point is located in the third image, the fourth trajectory point is located in the second image, and the third trajectory point It has the same index identifier as the fourth track point. For any set of trajectory points, a third offset is determined based on the coordinates of the third trajectory point and the coordinates of the fourth trajectory point. For a specific implementation method of determining the third offset based on the coordinates of the third trajectory point and the coordinates of the fourth trajectory point, please refer to the specific implementation of determining the fourth offset based on the coordinates of the first trajectory point and the coordinates of the second trajectory point. The implementation method will not be described again here.
同样地,在确定多组轨迹点集合所对应的第三偏移量之后,可以首先排除超出预设范围的第三偏移量,然后在满足预设范围的多个第三偏移量中选择中位数作为目标偏移量,或者计算多个第三偏移量的平均值作为目标偏移量,以尽可能地提高确定偏移量的准确性。Similarly, after determining the third offsets corresponding to the multiple sets of trajectory points, the third offsets that exceed the preset range can be first excluded, and then selected from a plurality of third offsets that meet the preset range. The median is used as the target offset, or the average of multiple third offsets is calculated as the target offset to maximize the accuracy of determining the offset.
S105:基于目标偏移量移动第三图像。S105: Move the third image based on the target offset.
基于上述实施例提供的方法确定目标偏移量之后,确定该目标偏移量所对应的预设旋转角度,基于该预设旋转角度和目标偏移量移动第三图像。After the target offset is determined based on the method provided by the above embodiment, a preset rotation angle corresponding to the target offset is determined, and the third image is moved based on the preset rotation angle and the target offset.
需要说明的是,关于中间过程中的图像移动,均为在复制第一图像的临时图像上实现的处理过程,即并非将第一图像进行移动配准,当计算完成得到最终的目标偏移量之后,再一次性移动第一图像,与第二图像进行配准。It should be noted that the image movement in the intermediate process is a process implemented on the temporary image that copies the first image, that is, the first image is not moved and registered. When the calculation is completed, the final target offset is obtained. After that, the first image is moved once again to register with the second image.
本申请实施例所提供的图像处理方法中,可以基于像素级精度的图像坐标,将第一图 像与第二图像进行配准,提高图像处理的准确性,便于后续利用配准的图像进行研发和分析。In the image processing method provided by the embodiments of the present application, the first image and the second image can be registered based on the image coordinates with pixel-level accuracy, thereby improving the accuracy of image processing and facilitating subsequent use of the registered images for research and development. analyze.
当第三图像和第二图像具有多个周期时,由于预设周期对应的偏移量是由计算得到的偏移量利用理论周期宽度推理得到的,在实际图像中可能存在误差。为了修正理论推理的误差,进一步提高图像处理的准确性,在一种优选的实现方式中,当基于目标偏移量移动第三图像之后,基于移动后的第三图像以及第二图像,可以重新利用该第三图像和第二图像确定修正偏移量作为最终偏移量,并基于所确定的最终偏移量继续移动该第三图像,将该第三图像与第二图像进行配准,提高配准的准确性。例如,基于移动后的第三图像以及第二图像,获取多组轨迹点集合,其中,每组轨迹点集合包括第五轨迹点和第六轨迹点,第五轨迹点位于该第三图像,第六轨迹点位于第二图像,并且第五轨迹点与六轨迹点具有相同的索引标识。针对任一组轨迹点集合,基于第五轨迹点的坐标和第六轨迹点的坐标确定第五偏移量。在确定多组轨迹点集合中每组轨迹点集合所对应的第五偏移量之后,基于多个第五偏移量确定最终偏移量。其中,确定第五偏移量以及基于多个第五偏移量确定最终偏移量的实现方式可以参见上述实施例,在此不再赘述。When the third image and the second image have multiple periods, since the offset corresponding to the preset period is inferred from the calculated offset using the theoretical period width, errors may exist in the actual image. In order to correct errors in theoretical reasoning and further improve the accuracy of image processing, in a preferred implementation, after moving the third image based on the target offset, based on the moved third image and the second image, the image can be re-imaged. Use the third image and the second image to determine the correction offset as the final offset, and continue to move the third image based on the determined final offset, and register the third image with the second image to improve Registration accuracy. For example, based on the moved third image and the second image, multiple groups of trajectory point sets are obtained, wherein each group of trajectory point sets includes a fifth trajectory point and a sixth trajectory point, and the fifth trajectory point is located in the third image, and the The sixth track point is located in the second image, and the fifth track point and the sixth track point have the same index identification. For any set of trajectory points, a fifth offset is determined based on the coordinates of the fifth trajectory point and the coordinates of the sixth trajectory point. After determining the fifth offset corresponding to each set of track points in the plurality of sets of track points, the final offset is determined based on the plurality of fifth offsets. The implementation of determining the fifth offset and determining the final offset based on multiple fifth offsets may refer to the above embodiments and will not be described again here.
下面将结合一种应用场景介绍本申请实施例所提供的图像处理方法。参见图7,图7为本申请实施例提供的另一种图像处理方法的流程示意图。The image processing method provided by the embodiment of the present application will be introduced below in conjunction with an application scenario. Referring to Figure 7, Figure 7 is a schematic flow chart of another image processing method provided by an embodiment of the present application.
在该应用场景中,第一图像为显微镜图像,第二图像为基因表达可视化图像。当获取显微镜图像和基因表达可视化图像后,对图像进行预处理,例如,将显微镜图像旋转至水平方向,并将显微镜图像缩放至与基因表达可视化图像相同比例。另外,还可以对基因表达可视化图像进行卷积增强处理,增强图像的边缘特征。在本实施例中,可以将显微镜图像分别旋转至四个方向,分别为原始水平方向、顺时针旋转90度、顺时针旋转180度以及顺时针旋转270度,针对任一方向下均执行相同的图像处理步骤。即分别计算显微镜图像和基因表达可视化图像的重心,对显微镜图像进行初定位。然后在显微镜图像和基因表达可视化图像中利用对应索引标识的轨迹点坐标,确定基本偏移量。以基本偏移量为中心,遍历预设周期所对应的基本偏移量,计算对应周期下的图像相似度,针对每个旋转方向执行上述步骤,确定每个旋转方向以及每个周期所对应的图像相似度,选取相似度最高的周期作为基准,确定该周期对应的基本偏移量为目标偏移量,然后基于该目标偏移量移动显微镜图像,实现图像配准。In this application scenario, the first image is a microscope image, and the second image is a gene expression visualization image. After acquiring the microscope image and the gene expression visualization image, preprocess the image, for example, rotate the microscope image to the horizontal direction and scale the microscope image to the same scale as the gene expression visualization image. In addition, convolution enhancement processing can be performed on the gene expression visualization image to enhance the edge features of the image. In this embodiment, the microscope image can be rotated to four directions, namely the original horizontal direction, a clockwise rotation of 90 degrees, a clockwise rotation of 180 degrees, and a clockwise rotation of 270 degrees. The same process is performed in any direction. Image processing steps. That is, the center of gravity of the microscope image and the gene expression visualization image are calculated respectively, and the microscope image is initially positioned. The basic offset is then determined using the coordinates of the trajectory points identified by the corresponding index in the microscope image and gene expression visualization image. Taking the basic offset as the center, traverse the basic offset corresponding to the preset period, calculate the image similarity under the corresponding period, perform the above steps for each rotation direction, and determine the corresponding direction of each rotation and each period. Image similarity, select the period with the highest similarity as the benchmark, determine the basic offset corresponding to the period as the target offset, and then move the microscope image based on the target offset to achieve image registration.
本实施例提供的图像处理方法所具有的有益效果参数上述方法实施例,在此不再赘述。The beneficial effect parameters of the image processing method provided by this embodiment are not described in detail here.
基于上述方法实施例,本申请实施例还提供一种图像处理装置。参见图8,该装置800包括:Based on the above method embodiments, embodiments of the present application also provide an image processing device. Referring to Figure 8, the device 800 includes:
第一获取单元801,用于获取第一图像和第二图像,其中,所述第一图像和所述第二图像中包括多条轨迹线和/或多个轨迹点,所述轨迹点是由两条所述轨迹线相交形成的,所述多条轨迹线中的每条轨迹线具有对应的索引号;The first acquisition unit 801 is used to acquire a first image and a second image, wherein the first image and the second image include a plurality of trajectory lines and/or a plurality of trajectory points, and the trajectory points are formed by Formed by the intersection of two of the trajectory lines, each of the plurality of trajectory lines has a corresponding index number;
第二获取单元802,用于获取所述第一图像中的第一轨迹线,基于所述第一轨迹线与水平方向的夹角旋转所述第一图像;The second acquisition unit 802 is used to acquire the first trajectory line in the first image, and rotate the first image based on the angle between the first trajectory line and the horizontal direction;
第一处理单元803,用于将所述第一图像进行放大或缩小得到第三图像,所述第三图 像与所述第二图像具有相同的比例;The first processing unit 803 is configured to enlarge or reduce the first image to obtain a third image, where the third image has the same proportion as the second image;
第二处理单元804,用于基于所述第二图像和所述第三图像确定目标偏移量;A second processing unit 804 configured to determine a target offset based on the second image and the third image;
第三处理单元805,用于基于所述目标偏移量移动所述第三图像。The third processing unit 805 is configured to move the third image based on the target offset.
在一种可能的实现方式中,第一处理单元803,具体用于获取所述第一图像中的第二轨迹线,基于所述第一轨迹线和所述第二轨迹线确定第一间距;获取所述第二图像中的第三轨迹线和第四轨迹线,基于所述第三轨迹线和所述第四轨迹线确定第二间距,其中,所述第三轨迹线的索引号与所述第一轨迹线的索引号相同,所述第四轨迹线的索引号与所述第二轨迹线的索引号相同;基于所述第一间距和所述第二间距确定比例值,将所述第一图像按照所述比例值进行放大或缩小得到第三图像。In a possible implementation, the first processing unit 803 is specifically configured to obtain the second trajectory line in the first image, and determine the first distance based on the first trajectory line and the second trajectory line; Obtain the third trajectory line and the fourth trajectory line in the second image, and determine the second distance based on the third trajectory line and the fourth trajectory line, wherein the index number of the third trajectory line is the same as the index number of the third trajectory line. The index number of the first trajectory line is the same, the index number of the fourth trajectory line is the same as the index number of the second trajectory line; the proportion value is determined based on the first spacing and the second spacing, and the The first image is enlarged or reduced according to the ratio value to obtain a third image.
在一种可能的实现方式中,第一处理单元803,具体用于将所述第一图像进行放大或缩小得到第四图像,所述第四图像与所述第二图像具有相同的比例;将所述第四图像按照预设周期和预设旋转角度移动,得到所述第三图像。In a possible implementation, the first processing unit 803 is specifically configured to enlarge or reduce the first image to obtain a fourth image, where the fourth image has the same proportion as the second image; The fourth image moves according to a preset period and a preset rotation angle to obtain the third image.
在一种可能的实现方式中,第一处理单元803,具体用于将所述第一图像进行放大或缩小得到第五图像,所述第五图像与所述第二图像具有相同的比例;分别计算所述第五图像的第一重心坐标和所述第二图像的第二重心坐标;基于所述第一重心坐标和所述第二重心坐标确定重心偏移量;基于所述重心偏移量移动所述第五图像,得到所述第四图像。In a possible implementation, the first processing unit 803 is specifically configured to enlarge or reduce the first image to obtain a fifth image, where the fifth image and the second image have the same proportion; respectively Calculate the first gravity center coordinate of the fifth image and the second gravity center coordinate of the second image; determine the gravity center offset based on the first gravity center coordinate and the second gravity center coordinate; based on the gravity center offset The fifth image is moved to obtain the fourth image.
在一种可能的实现方式中,第一处理单元803,具体用于获取所述预设周期和多个预设旋转角度;针对任一预设旋转角度,基于所述第四图像和所述第二图像确定第一偏移量;确定所述第一偏移量在所述预设周期内所对应的多个第二偏移量,所述多个第二偏移量中的每个第二偏移量与所述预设周期内的每个周期一一对应;针对任一第二偏移量,基于所述第二偏移量移动所述第四图像,得到第六图像;确定所述第六图像与所述第二图像之间的第一相似度;基于所述多个预设旋转角度和所述每个周期所对应的第一相似度确定第一最大相似度;确定所述第一最大相似度所对应的第六图像为所述第三图像。In a possible implementation, the first processing unit 803 is specifically configured to obtain the preset period and multiple preset rotation angles; for any preset rotation angle, based on the fourth image and the third The second image determines a first offset; determines a plurality of second offsets corresponding to the first offset within the preset period, and each second offset in the plurality of second offsets is determined. The offset corresponds to each period within the preset period; for any second offset, move the fourth image based on the second offset to obtain a sixth image; determine the a first similarity between the sixth image and the second image; determining a first maximum similarity based on the plurality of preset rotation angles and the first similarity corresponding to each period; determining the first similarity The sixth image corresponding to a maximum similarity is the third image.
在一种可能的实现方式中,第二处理单元804,具体用于确定所述第三图像所对应的第二偏移量为所述目标偏移量;In a possible implementation, the second processing unit 804 is specifically configured to determine the second offset corresponding to the third image as the target offset;
第三处理单元805,具体用于基于所述第三图像所对应的预设旋转角度和所述目标偏移量移动所述第三图像。The third processing unit 805 is specifically configured to move the third image based on the preset rotation angle corresponding to the third image and the target offset.
在一种可能的实现方式中,第一处理单元803,具体用于获取所述预设周期和所述多个预设旋转角度;针对任一预设旋转角度,将所述第四图像分别按照所述预设周期内的每个周期移动,得到多个第七图像,所述多个第七图像中的每个第七图像与所述预设周期内的每个周期一一对应;针对任一第七图像,确定所述第七图像与所述第二图像之间的第二相似度;基于所述多个预设旋转角度和所述每个周期所对应的第二相似度确定第二最大相似度;确定所述第二最大相似度所对应的第七图像为所述第三图像。In a possible implementation, the first processing unit 803 is specifically configured to obtain the preset period and the plurality of preset rotation angles; for any preset rotation angle, the fourth image is processed according to Each period within the preset period is moved to obtain a plurality of seventh images, and each seventh image in the plurality of seventh images corresponds to each period within the preset period; for any a seventh image, determining a second degree of similarity between the seventh image and the second image; determining a second degree of similarity based on the plurality of preset rotation angles and the second degree of similarity corresponding to each period. Maximum similarity; determine the seventh image corresponding to the second maximum similarity as the third image.
在一种可能的实现方式中,第二处理单元804,具体用于基于所述第二图像和所述第三图像确定多个第三偏移量;基于所述多个第三偏移量确定所述目标偏移量;In a possible implementation, the second processing unit 804 is specifically configured to determine a plurality of third offsets based on the second image and the third image; determine a plurality of third offsets based on the plurality of third offsets. The target offset;
第三处理单元805,具体用于基于所述第三图像所对应的预设旋转角度和所述目标偏移量移动所述第三图像。The third processing unit 805 is specifically configured to move the third image based on the preset rotation angle corresponding to the third image and the target offset.
在一种可能的实现方式中,第一处理单元803,具体用于获取多组轨迹点集合,所述多组轨迹点集合中的每组轨迹点集合包括第一轨迹点和第二轨迹点,所述第一轨迹点位于所述第四图像,所述第二轨迹点位于所述第二图像,所述第一轨迹点与所述第二轨迹点具有相同的索引标识;针对任一组轨迹点集合,基于所述轨迹点集合下的所述第一轨迹点的坐标和所述第二轨迹点的坐标确定第四偏移量;基于所述多组轨迹点集合所对应的第四偏移量确定所述第一偏移量。In a possible implementation, the first processing unit 803 is specifically configured to obtain multiple sets of trajectory point sets, each of the multiple sets of trajectory point sets including a first trajectory point and a second trajectory point, The first trajectory point is located in the fourth image, the second trajectory point is located in the second image, and the first trajectory point and the second trajectory point have the same index identifier; for any group of trajectories point set, determining a fourth offset based on the coordinates of the first track point and the coordinates of the second track point under the track point set; based on the fourth offset corresponding to the multiple groups of track point sets The amount determines the first offset.
在一种可能的实现方式中,当所述第二图像具有多个子图像时,每个子图像的轨迹线具有相同的索引号,第一处理单元803,具体用于基于所述第一轨迹点的索引标识确定所述每个子图像中的所述第二轨迹点,所述第一轨迹点与所述第二轨迹点具有相同的索引标识;确定所述第一轨迹点和多个所述第二轨迹点中任一第二轨迹点之间的欧式距离;确定多个所述欧式距离中的最小欧式距离所对应的第二轨迹点;基于所述第一轨迹点的坐标和所述最小欧式距离所对应的第二轨迹点的坐标确定第四偏移量。In a possible implementation, when the second image has multiple sub-images, the trajectory lines of each sub-image have the same index number, and the first processing unit 803 is specifically used to perform tracking based on the first trajectory point. The index identification determines the second trajectory point in each sub-image, and the first trajectory point and the second trajectory point have the same index identification; determines the first trajectory point and a plurality of the second trajectory points. The Euclidean distance between any second trajectory points among the trajectory points; determining the second trajectory point corresponding to the minimum Euclidean distance among a plurality of the Euclidean distances; based on the coordinates of the first trajectory point and the minimum Euclidean distance The coordinates of the corresponding second trajectory point determine the fourth offset amount.
在一种可能的实现方式中,第一处理单元803,具体用于对所述第六图像进行频域变换得到第一频域图像;对所述第二图像进行频域变换得到第二频域图像;计算所述第一频域图像与所述第二频域图像之间的汉明距离作为第一相似度;第一处理单元803,还用于基于所述多个预设旋转角度和所述每个周期所对应的汉明距离,确定最小汉明距离为第一最大相似度。In a possible implementation, the first processing unit 803 is specifically configured to perform frequency domain transformation on the sixth image to obtain a first frequency domain image; perform frequency domain transformation on the second image to obtain a second frequency domain image. image; calculate the Hamming distance between the first frequency domain image and the second frequency domain image as the first similarity; the first processing unit 803 is also configured to based on the plurality of preset rotation angles and the Describe the Hamming distance corresponding to each period, and determine the minimum Hamming distance as the first maximum similarity.
在一种可能的实现方式中,第一处理单元803,具体用于计算所述第四图像的第三重心坐标;以所述第三重心坐标所在的周期为中心,分别按照所述每个周期移动所述第四图像,得到所述第七图像。In a possible implementation, the first processing unit 803 is specifically configured to calculate the third barycenter coordinate of the fourth image; taking the period in which the third barycenter coordinate is located as the center, calculate the third barycenter coordinate according to each of the The fourth image is moved in cycles to obtain the seventh image.
在一种可能的实现方式中,第一处理单元803,具体用于获取多组轨迹点集合,所述多组轨迹点集合中的每组轨迹点集合包括第三轨迹点和第四轨迹点,所述第三轨迹点位于所述第三图像,所述第四轨迹点位于所述第二图像,所述第三轨迹点与所述第四轨迹点具有相同的索引标识;针对任一组轨迹点集合,基于所述轨迹点集合下的所述第三轨迹点的坐标和所述第四轨迹点的坐标确定第三偏移量。In a possible implementation, the first processing unit 803 is specifically configured to obtain multiple sets of trajectory point sets, each of the multiple sets of trajectory point sets including a third trajectory point and a fourth trajectory point, The third trajectory point is located in the third image, the fourth trajectory point is located in the second image, and the third trajectory point and the fourth trajectory point have the same index identifier; for any group of trajectories Point set, determining a third offset based on the coordinates of the third trajectory point and the coordinates of the fourth trajectory point under the trajectory point set.
在一种可能的实现方式中,装置800,还用于基于移动后的所述第三图像以及所述第二图像,获取多组轨迹点集合,所述多组轨迹点集合中的每组轨迹点集合包括第五轨迹点和第六轨迹点,所述第五轨迹点位于所述移动后的所述第三图像,所述第六轨迹点位于所述第二图像,所述第五轨迹点与所述六轨迹点具有相同的索引标识;针对任一组轨迹点集合,基于所述轨迹点集合下的所述第五轨迹点的坐标和所述第六轨迹点的坐标确定第五偏移量;基于所述多组轨迹点集合所对应的第五偏移量确定最终偏移量;基于所述最终偏移量移动所述移动后的所述第三图像。In a possible implementation, the device 800 is further configured to obtain multiple sets of trajectory point sets based on the moved third image and the second image. Each set of trajectories in the multiple sets of trajectory point sets is The point set includes a fifth trajectory point and a sixth trajectory point. The fifth trajectory point is located in the third image after the movement. The sixth trajectory point is located in the second image. The fifth trajectory point It has the same index identifier as the six track points; for any set of track points, the fifth offset is determined based on the coordinates of the fifth track point and the coordinates of the sixth track point under the set of track points. amount; determine the final offset amount based on the fifth offset amount corresponding to the plurality of sets of trajectory points; and move the moved third image based on the final offset amount.
在一种可能的实现方式中,第一获取单元801,具体用于获取第八图像,对所述第八图像进行卷积增强处理得到所述第二图像。In a possible implementation, the first acquisition unit 801 is specifically configured to acquire an eighth image, and perform convolution enhancement processing on the eighth image to obtain the second image.
基于上述方法实施例和装置实施例,本申请实施例还提供一种电子设备。参见图9,该电子设备900包括:存储器901以及处理器902;Based on the above method embodiments and device embodiments, embodiments of the present application also provide an electronic device. Referring to Figure 9, the electronic device 900 includes: a memory 901 and a processor 902;
所述存储器901,用于存储指令或计算机程序;The memory 901 is used to store instructions or computer programs;
所述处理器902,用于执行所述存储器中的所述指令或计算机程序,以使得所述电子设备执行上述方法实施例所述的图像处理方法。The processor 902 is configured to execute the instructions or computer programs in the memory, so that the electronic device executes the image processing method described in the above method embodiment.
此外,本申请实施例还提供一种计算机可读存储介质,所述计算机可读存储介质用于存储计算机程序,所述计算机程序用于执行上述方法实施例所述的图像处理方法。In addition, embodiments of the present application also provide a computer-readable storage medium, the computer-readable storage medium being used to store a computer program, and the computer program being used to execute the image processing method described in the above method embodiment.
本申请实施例还提供一种计算机程序产品,所述计算机程序产品包含程序,当所述程序在处理器上运行时,使得计算机或网络设备执行上述方法实施例所述的图像处理方法。Embodiments of the present application also provide a computer program product. The computer program product includes a program. When the program is run on a processor, the computer or network device causes the computer or network device to execute the image processing method described in the above method embodiment.
需要说明的是,本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似部分互相参见即可。尤其,对于系统或装置实施例而言,由于其基本类似于方法实施例,所以描述得比较简单,相关部分参见方法实施例的部分说明即可。以上所描述的装置实施例仅仅是示意性的,其中作为分离部件说明的单元或模块可以是或者也可以不是物理上分开的,作为单元或模块显示的部件可以是或者也可以不是物理模块,即可以位于一个地方,或者也可以分布到多个网络单元上,可以根据实际需要选择其中的部分或者全部单元或模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。It should be noted that each embodiment in this specification is described in a progressive manner, and each embodiment focuses on its differences from other embodiments. The same and similar parts between the various embodiments can be referred to each other. In particular, the system or device embodiments are described simply because they are basically similar to the method embodiments. For relevant parts, please refer to the partial description of the method embodiments. The device embodiments described above are only illustrative, in which units or modules illustrated as separate components may or may not be physically separated, and components shown as units or modules may or may not be physical modules, that is, It can be located in one place, or it can also be distributed to multiple network units. Some or all of the units or modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. Persons of ordinary skill in the art can understand and implement the method without any creative effort.
应当理解,在本申请中,“至少一个(项)”是指一个或者多个,“多个”是指两个或两个以上。“和/或”,用于描述关联对象的关联关系,表示可以存在三种关系,例如,“A和/或B”可以表示:只存在A,只存在B以及同时存在A和B三种情况,其中A,B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。“以下至少一项(个)”或其类似表达,是指这些项中的任意组合,包括单项(个)或复数项(个)的任意组合。例如,a,b或c中的至少一项(个),可以表示:a,b,c,“a和b”,“a和c”,“b和c”,或“a和b和c”,其中a,b,c可以是单个,也可以是多个。It should be understood that in this application, "at least one (item)" refers to one or more, and "plurality" refers to two or more. "And/or" is used to describe the relationship between associated objects, indicating that there can be three relationships. For example, "A and/or B" can mean: only A exists, only B exists, and A and B exist simultaneously. , where A and B can be singular or plural. The character "/" generally indicates that the related objects are in an "or" relationship. “At least one of the following” or similar expressions thereof refers to any combination of these items, including any combination of a single item (items) or a plurality of items (items). For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c" ”, where a, b, c can be single or multiple.
还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should also be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that these entities or operations There is no such actual relationship or sequence between them. Furthermore, the terms "comprises," "comprises," or any other variations thereof are intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus that includes a list of elements includes not only those elements, but also those not expressly listed other elements, or elements inherent to the process, method, article or equipment. Without further limitation, an element defined by the statement "comprises a..." does not exclude the presence of additional identical elements in a process, method, article, or apparatus that includes the stated element.
结合本文中所公开的实施例描述的方法或算法的步骤可以直接用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein may be implemented directly in hardware, in software modules executed by a processor, or in a combination of both. Software modules may be located in random access memory (RAM), memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disks, removable disks, CD-ROMs, or anywhere in the field of technology. any other known form of storage media.
对所公开的实施例的上述说明,使本领域专业技术人员能够实现或使用本申请。对这些实施例的多种修改对本领域的专业技术人员来说将是显而易见的,本文中所定义的一般原理可以在不脱离本申请的精神或范围的情况下,在其它实施例中实现。因此,本申请将不会被限制于本文所示的这些实施例,而是要符合与本文所公开的原理和新颖特点相一致的最宽的范围。The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be practiced in other embodiments without departing from the spirit or scope of the application. Therefore, the present application is not to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (19)

  1. 一种图像处理方法,其特征在于,所述方法包括:An image processing method, characterized in that the method includes:
    获取第一图像和第二图像,其中,所述第一图像和所述第二图像包括多条轨迹线和/或多个轨迹点,所述轨迹点是由两条所述轨迹线相交形成的,所述多条轨迹线中的每条轨迹线具有对应的索引号;Obtaining a first image and a second image, wherein the first image and the second image include a plurality of trajectory lines and/or a plurality of trajectory points, the trajectory points are formed by the intersection of the two trajectory lines , each of the plurality of trajectory lines has a corresponding index number;
    获取所述第一图像中的第一轨迹线,基于所述第一轨迹线与水平方向的夹角旋转所述第一图像;Obtain the first trajectory line in the first image, and rotate the first image based on the angle between the first trajectory line and the horizontal direction;
    将所述第一图像进行放大或缩小得到第三图像,所述第三图像与所述第二图像具有相同的比例;Enlarging or reducing the first image to obtain a third image, the third image having the same proportion as the second image;
    基于所述第二图像和所述第三图像确定目标偏移量;determining a target offset based on the second image and the third image;
    基于所述目标偏移量移动所述第三图像。The third image is moved based on the target offset.
  2. 根据权利要求1所述的方法,其特征在于,所述将所述第一图像进行放大或缩小得到第三图像,包括:The method of claim 1, wherein enlarging or reducing the first image to obtain a third image includes:
    获取所述第一图像中的第二轨迹线,基于所述第一轨迹线和所述第二轨迹线确定第一间距;Obtain a second trajectory line in the first image, and determine a first distance based on the first trajectory line and the second trajectory line;
    获取所述第二图像中的第三轨迹线和第四轨迹线,基于所述第三轨迹线和所述第四轨迹线确定第二间距,其中,所述第三轨迹线的索引号与所述第一轨迹线的索引号相同,所述第四轨迹线的索引号与所述第二轨迹线的索引号相同;Obtain the third trajectory line and the fourth trajectory line in the second image, and determine the second distance based on the third trajectory line and the fourth trajectory line, wherein the index number of the third trajectory line is the same as the index number of the third trajectory line. The index number of the first trajectory line is the same, the index number of the fourth trajectory line is the same as the index number of the second trajectory line;
    基于所述第一间距和所述第二间距确定比例值,将所述第一图像按照所述比例值进行放大或缩小得到第三图像。A ratio value is determined based on the first distance and the second distance, and the first image is enlarged or reduced according to the ratio value to obtain a third image.
  3. 根据权利要求1所述的方法,其特征在于,所述将所述第一图像进行放大或缩小得到第三图像,包括:The method of claim 1, wherein enlarging or reducing the first image to obtain a third image includes:
    将所述第一图像进行放大或缩小得到第四图像,所述第四图像与所述第二图像具有相同的比例;Enlarging or reducing the first image to obtain a fourth image, the fourth image having the same proportion as the second image;
    将所述第四图像按照预设周期和预设旋转角度移动,得到所述第三图像。The fourth image is moved according to a preset period and a preset rotation angle to obtain the third image.
  4. 根据权利要求3所述的方法,其特征在于,所述将所述第一图像进行放大或缩小得到第四图像,包括:The method of claim 3, wherein enlarging or reducing the first image to obtain a fourth image includes:
    将所述第一图像进行放大或缩小得到第五图像,所述第五图像与所述第二图像具有相同的比例;Enlarging or reducing the first image to obtain a fifth image, where the fifth image has the same proportion as the second image;
    分别计算所述第五图像的第一重心坐标和所述第二图像的第二重心坐标;Calculate the first barycenter coordinates of the fifth image and the second barycenter coordinates of the second image respectively;
    基于所述第一重心坐标和所述第二重心坐标确定重心偏移量;Determine a center of gravity offset based on the first center of gravity coordinates and the second center of gravity coordinates;
    基于所述重心偏移量移动所述第五图像,得到所述第四图像。The fifth image is moved based on the gravity center offset to obtain the fourth image.
  5. 根据权利要求3或4所述的方法,其特征在于,所述将所述第四图像按照预设周期和预设旋转角度移动,得到所述第三图像,包括:The method according to claim 3 or 4, characterized in that said moving the fourth image according to a preset period and a preset rotation angle to obtain the third image includes:
    获取所述预设周期和多个预设旋转角度;Obtain the preset period and multiple preset rotation angles;
    针对任一预设旋转角度,基于所述第四图像和所述第二图像确定第一偏移量;For any preset rotation angle, determine a first offset based on the fourth image and the second image;
    确定所述第一偏移量在所述预设周期内所对应的多个第二偏移量,所述多个第二偏移 量中的每个第二偏移量与所述预设周期内的每个周期一一对应;Determine a plurality of second offsets corresponding to the first offset within the preset period, and each second offset in the plurality of second offsets is consistent with the preset period. Each cycle within has a one-to-one correspondence;
    针对任一第二偏移量,基于所述第二偏移量移动所述第四图像,得到第六图像;For any second offset, move the fourth image based on the second offset to obtain a sixth image;
    确定所述第六图像与所述第二图像之间的第一相似度;determining a first degree of similarity between the sixth image and the second image;
    基于所述多个预设旋转角度和所述每个周期所对应的第一相似度确定第一最大相似度;Determine a first maximum similarity based on the plurality of preset rotation angles and the first similarity corresponding to each cycle;
    确定所述第一最大相似度所对应的第六图像为所述第三图像。The sixth image corresponding to the first maximum similarity is determined to be the third image.
  6. 根据权利要求5所述的方法,其特征在于,所述基于所述第二图像和所述第三图像确定目标偏移量,包括:The method of claim 5, wherein determining the target offset based on the second image and the third image includes:
    确定所述第三图像所对应的第二偏移量为所述目标偏移量;Determine the second offset corresponding to the third image as the target offset;
    所述基于所述目标偏移量移动所述第三图像,包括:The moving the third image based on the target offset includes:
    基于所述第三图像所对应的预设旋转角度和所述目标偏移量移动所述第三图像。The third image is moved based on the preset rotation angle corresponding to the third image and the target offset.
  7. 根据权利要求3所述的方法,其特征在于,所述将所述第四图像按照预设周期和预设旋转角度移动,得到所述第三图像,包括:The method of claim 3, wherein moving the fourth image according to a preset period and a preset rotation angle to obtain the third image includes:
    获取所述预设周期和所述多个预设旋转角度;Obtain the preset period and the plurality of preset rotation angles;
    针对任一预设旋转角度,将所述第四图像分别按照所述预设周期内的每个周期移动,得到多个第七图像,所述多个第七图像中的每个第七图像与所述预设周期内的每个周期一一对应;For any preset rotation angle, the fourth image is moved according to each period within the preset period to obtain a plurality of seventh images, and each seventh image in the plurality of seventh images is related to Each period within the preset period has a one-to-one correspondence;
    针对任一第七图像,确定所述第七图像与所述第二图像之间的第二相似度;For any seventh image, determine a second degree of similarity between the seventh image and the second image;
    基于所述多个预设旋转角度和所述每个周期所对应的第二相似度确定第二最大相似度;Determine a second maximum similarity based on the plurality of preset rotation angles and the second similarity corresponding to each cycle;
    确定所述第二最大相似度所对应的第七图像为所述第三图像。The seventh image corresponding to the second maximum similarity is determined to be the third image.
  8. 根据权利要求7所述的方法,其特征在于,所述基于所述第二图像和所述第三图像确定目标偏移量,包括:The method of claim 7, wherein determining the target offset based on the second image and the third image includes:
    基于所述第二图像和所述第三图像确定多个第三偏移量;determining a plurality of third offsets based on the second image and the third image;
    基于所述多个第三偏移量确定所述目标偏移量;determining the target offset based on the plurality of third offsets;
    所述基于所述目标偏移量移动所述第三图像,包括:The moving the third image based on the target offset includes:
    基于所述第三图像所对应的预设旋转角度和所述目标偏移量移动所述第三图像。The third image is moved based on the preset rotation angle corresponding to the third image and the target offset.
  9. 根据权利要求5所述的方法,其特征在于,所述基于所述第四图像和所述第二图像确定第一偏移量,包括:The method of claim 5, wherein determining the first offset based on the fourth image and the second image includes:
    获取多组轨迹点集合,所述多组轨迹点集合中的每组轨迹点集合包括第一轨迹点和第二轨迹点,所述第一轨迹点位于所述第四图像,所述第二轨迹点位于所述第二图像,所述第一轨迹点与所述第二轨迹点具有相同的索引标识;Acquire multiple sets of trajectory point sets. Each set of trajectory points in the multiple sets of trajectory point sets includes a first trajectory point and a second trajectory point. The first trajectory point is located in the fourth image, and the second trajectory point is located in the fourth image. The point is located in the second image, and the first trajectory point and the second trajectory point have the same index identifier;
    针对任一组轨迹点集合,基于所述轨迹点集合下的所述第一轨迹点的坐标和所述第二轨迹点的坐标确定第四偏移量;For any set of trajectory points, determine a fourth offset based on the coordinates of the first trajectory point and the coordinates of the second trajectory point under the set of trajectory points;
    基于所述多组轨迹点集合所对应的第四偏移量确定所述第一偏移量。The first offset is determined based on the fourth offset corresponding to the plurality of sets of trajectory points.
  10. 根据权利要求9所述的方法,其特征在于,当所述第二图像具有多个子图像时,每个子图像的轨迹线具有相同的索引号,所述基于所述轨迹点集合下的所述第一轨迹点的 坐标和所述第二轨迹点的坐标确定第四偏移量,包括:The method according to claim 9, characterized in that when the second image has multiple sub-images, the trajectory line of each sub-image has the same index number, and the trajectory line based on the trajectory point set is The coordinates of a trajectory point and the coordinates of the second trajectory point determine a fourth offset, including:
    基于所述第一轨迹点的索引标识确定所述每个子图像中的所述第二轨迹点,所述第一轨迹点与所述第二轨迹点具有相同的索引标识;Determine the second trajectory point in each sub-image based on the index identification of the first trajectory point, where the first trajectory point and the second trajectory point have the same index identification;
    确定所述第一轨迹点和多个所述第二轨迹点中任一第二轨迹点之间的欧式距离;Determine the Euclidean distance between the first trajectory point and any second trajectory point among the plurality of second trajectory points;
    确定多个所述欧式距离中的最小欧式距离所对应的第二轨迹点;Determine the second trajectory point corresponding to the minimum Euclidean distance among the plurality of Euclidean distances;
    基于所述第一轨迹点的坐标和所述最小欧式距离所对应的第二轨迹点的坐标确定第四偏移量。The fourth offset is determined based on the coordinates of the first trajectory point and the coordinates of the second trajectory point corresponding to the minimum Euclidean distance.
  11. 根据权利要求5所述的方法,其特征在于,所述确定所述第六图像与所述第二图像之间的第一相似度,包括:The method of claim 5, wherein determining the first similarity between the sixth image and the second image includes:
    对所述第六图像进行频域变换得到第一频域图像;Perform frequency domain transformation on the sixth image to obtain a first frequency domain image;
    对所述第二图像进行频域变换得到第二频域图像;Perform frequency domain transformation on the second image to obtain a second frequency domain image;
    计算所述第一频域图像与所述第二频域图像之间的汉明距离作为第一相似度;Calculate the Hamming distance between the first frequency domain image and the second frequency domain image as the first similarity;
    所述基于所述多个预设旋转角度和所述每个周期所对应的第一相似度确定第一最大相似度,包括:Determining the first maximum similarity based on the plurality of preset rotation angles and the first similarity corresponding to each cycle includes:
    基于所述多个预设旋转角度和所述每个周期所对应的汉明距离,确定最小汉明距离为第一最大相似度。Based on the plurality of preset rotation angles and the Hamming distance corresponding to each period, the minimum Hamming distance is determined to be the first maximum similarity.
  12. 根据权利要求7所述的方法,其特征在于,所述将所述第四图像分别按照所述预设周期内的每个周期移动,得到第七图像,包括:The method according to claim 7, wherein said moving the fourth image according to each period within the preset period to obtain a seventh image includes:
    计算所述第四图像的第三重心坐标;Calculate the coordinates of the third center of gravity of the fourth image;
    以所述第三重心坐标所在的周期为中心,分别按照所述每个周期移动所述第四图像,得到所述第七图像。Taking the period where the third barycenter coordinate is located as the center, the fourth image is moved according to each period to obtain the seventh image.
  13. 根据权利要求8所述的方法,其特征在于,所述基于所述第二图像和所述第三图像确定多个第三偏移量,包括:The method of claim 8, wherein determining a plurality of third offsets based on the second image and the third image includes:
    获取多组轨迹点集合,所述多组轨迹点集合中的每组轨迹点集合包括第三轨迹点和第四轨迹点,所述第三轨迹点位于所述第三图像,所述第四轨迹点位于所述第二图像,所述第三轨迹点与所述第四轨迹点具有相同的索引标识;Acquire multiple sets of trajectory point sets, each of the multiple sets of trajectory point sets includes a third trajectory point and a fourth trajectory point, the third trajectory point is located in the third image, and the fourth trajectory point The point is located in the second image, and the third trajectory point and the fourth trajectory point have the same index identifier;
    针对任一组轨迹点集合,基于所述轨迹点集合下的所述第三轨迹点的坐标和所述第四轨迹点的坐标确定第三偏移量。For any set of trajectory points, a third offset is determined based on the coordinates of the third trajectory point and the coordinates of the fourth trajectory point under the set of trajectory points.
  14. 根据权利要求1所述的方法,其特征在于,在基于所述目标偏移量移动所述第三图像之后,所述方法还包括:The method of claim 1, wherein after moving the third image based on the target offset, the method further includes:
    基于移动后的所述第三图像以及所述第二图像,获取多组轨迹点集合,所述多组轨迹点集合中的每组轨迹点集合包括第五轨迹点和第六轨迹点,所述第五轨迹点位于所述移动后的所述第三图像,所述第六轨迹点位于所述第二图像,所述第五轨迹点与所述六轨迹点具有相同的索引标识;Based on the moved third image and the second image, multiple sets of trajectory point sets are obtained, each of the multiple sets of trajectory point sets includes a fifth trajectory point and a sixth trajectory point, The fifth trajectory point is located in the third image after the movement, the sixth trajectory point is located in the second image, and the fifth trajectory point and the six trajectory points have the same index identifier;
    针对任一组轨迹点集合,基于所述轨迹点集合下的所述第五轨迹点的坐标和所述第六轨迹点的坐标确定第五偏移量;For any group of trajectory point sets, determine a fifth offset based on the coordinates of the fifth trajectory point and the coordinates of the sixth trajectory point under the trajectory point set;
    基于所述多组轨迹点集合所对应的第五偏移量确定最终偏移量;Determine the final offset based on the fifth offset corresponding to the multiple sets of trajectory points;
    基于所述最终偏移量移动所述移动后的所述第三图像。The moved third image is moved based on the final offset.
  15. 根据权利要求1至14任一项所述的方法,其特征在于,所述获取第二图像包括:The method according to any one of claims 1 to 14, wherein obtaining the second image includes:
    获取第八图像,对所述第八图像进行卷积增强处理得到所述第二图像。An eighth image is acquired, and convolution enhancement processing is performed on the eighth image to obtain the second image.
  16. 一种图像处理装置,其特征在于,所述装置包括:An image processing device, characterized in that the device includes:
    第一获取单元,用于获取第一图像和第二图像,其中,所述第一图像和所述第二图像包括多条轨迹线和/或多个轨迹点,所述轨迹点是由两条所述轨迹线相交形成的,所述多条轨迹线中的每条轨迹线具有对应的索引号;A first acquisition unit, configured to acquire a first image and a second image, wherein the first image and the second image include a plurality of trajectory lines and/or a plurality of trajectory points, and the trajectory points are composed of two The trajectory lines are formed by intersecting, and each trajectory line in the plurality of trajectory lines has a corresponding index number;
    第二获取单元,用于获取所述第一图像中的第一轨迹线,基于所述第一轨迹线与水平方向的夹角旋转所述第一图像;a second acquisition unit, configured to acquire the first trajectory line in the first image, and rotate the first image based on the angle between the first trajectory line and the horizontal direction;
    第一处理单元,用于将所述第一图像进行放大或缩小得到第三图像,所述第三图像与所述第二图像具有相同的比例;A first processing unit configured to enlarge or reduce the first image to obtain a third image, where the third image has the same proportion as the second image;
    第二处理单元,用于基于所述第二图像和所述第三图像确定目标偏移量;a second processing unit configured to determine a target offset based on the second image and the third image;
    第三处理单元,用于基于所述目标偏移量移动所述第三图像。A third processing unit configured to move the third image based on the target offset.
  17. 一种电子设备,其特征在于,所述电子设备包括:存储器以及处理器;An electronic device, characterized in that the electronic device includes: a memory and a processor;
    所述存储器,用于存储指令或计算机程序;The memory is used to store instructions or computer programs;
    所述处理器,用于执行所述存储器中的所述指令或计算机程序,以使得所述电子设备执行权利要求1至15任一项所述的图像处理方法。The processor is configured to execute the instructions or computer programs in the memory, so that the electronic device executes the image processing method according to any one of claims 1 to 15.
  18. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质用于存储计算机程序,所述计算机程序用于执行上述权利要求1至15任一所述的图像处理方法。A computer-readable storage medium, characterized in that the computer-readable storage medium is used to store a computer program, and the computer program is used to execute the image processing method described in any one of claims 1 to 15.
  19. 一种计算机程序产品,其特征在于,所述计算机程序产品包含程序,当所述程序在处理器上运行时,使得计算机或网络设备执行权利要求1至15任一项所述的图像处理方法。A computer program product, characterized in that the computer program product includes a program, which when the program is run on a processor, causes the computer or network device to execute the image processing method described in any one of claims 1 to 15.
PCT/CN2022/102360 2022-06-29 2022-06-29 Image processing method and apparatus, and device and medium WO2024000268A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2022/102360 WO2024000268A1 (en) 2022-06-29 2022-06-29 Image processing method and apparatus, and device and medium
PCT/CN2022/136698 WO2024001051A1 (en) 2022-06-29 2022-12-05 Spatial omics single cell data acquisition method and apparatus, and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2022/102360 WO2024000268A1 (en) 2022-06-29 2022-06-29 Image processing method and apparatus, and device and medium

Publications (1)

Publication Number Publication Date
WO2024000268A1 true WO2024000268A1 (en) 2024-01-04

Family

ID=89383423

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/102360 WO2024000268A1 (en) 2022-06-29 2022-06-29 Image processing method and apparatus, and device and medium

Country Status (1)

Country Link
WO (1) WO2024000268A1 (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100069742A1 (en) * 2008-09-15 2010-03-18 Varian Medical Systems, Inc. Systems and Methods for Tracking and Targeting Object in a Patient Using Imaging Techniques
CN108350494A (en) * 2015-08-06 2018-07-31 阿柯生物有限公司 System and method for genome analysis
CN109643453A (en) * 2016-08-31 2019-04-16 分子装置有限公司 System and method for the image analysis based on template
CN110047107A (en) * 2018-01-13 2019-07-23 深圳华大智造科技有限公司 Camera calibration method and method for registering images, gene sequencer and system
CN112204615A (en) * 2019-01-31 2021-01-08 深圳华大生命科学研究院 Fluorescent image registration method, gene sequencer system and storage medium
WO2021229668A1 (en) * 2020-05-12 2021-11-18 株式会社日立ハイテク Nucleic acid analysis device, nucleic acid analysis method, and machine learning method
CN113781530A (en) * 2021-10-09 2021-12-10 上海衡道医学病理诊断中心有限公司 Image registration method and system for stained section

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100069742A1 (en) * 2008-09-15 2010-03-18 Varian Medical Systems, Inc. Systems and Methods for Tracking and Targeting Object in a Patient Using Imaging Techniques
CN108350494A (en) * 2015-08-06 2018-07-31 阿柯生物有限公司 System and method for genome analysis
CN109643453A (en) * 2016-08-31 2019-04-16 分子装置有限公司 System and method for the image analysis based on template
CN110047107A (en) * 2018-01-13 2019-07-23 深圳华大智造科技有限公司 Camera calibration method and method for registering images, gene sequencer and system
CN112204615A (en) * 2019-01-31 2021-01-08 深圳华大生命科学研究院 Fluorescent image registration method, gene sequencer system and storage medium
WO2021229668A1 (en) * 2020-05-12 2021-11-18 株式会社日立ハイテク Nucleic acid analysis device, nucleic acid analysis method, and machine learning method
CN113781530A (en) * 2021-10-09 2021-12-10 上海衡道医学病理诊断中心有限公司 Image registration method and system for stained section

Similar Documents

Publication Publication Date Title
CN111243032B (en) Full-automatic detection method for checkerboard corner points
CN105701766B (en) Image matching method and device
CN106960451B (en) Method for increasing number of feature points of image weak texture area
CN106548462B (en) Non-linear SAR image geometric correction method based on thin-plate spline interpolation
CN104200461B (en) The remote sensing image registration method of block and sift features is selected based on mutual information image
CN108596867A (en) A kind of picture bearing calibration and system based on ORB algorithms
CN108986152B (en) Foreign matter detection method and device based on difference image
CN112132907B (en) Camera calibration method and device, electronic equipment and storage medium
CN105654421B (en) Based on the projective transformation image matching method for converting constant low-rank texture
JP5339065B2 (en) Object tracking device
CN108010082B (en) Geometric matching method
CN104021547A (en) Three dimensional matching method for lung CT
CN107170001A (en) Method and apparatus for carrying out registration to image
CN107123130B (en) Kernel correlation filtering target tracking method based on superpixel and hybrid hash
CN105354841B (en) A kind of rapid remote sensing image matching method and system
Liu et al. Unstructured road vanishing point detection using convolutional neural networks and heatmap regression
JP2021168143A (en) System and method for efficiently scoring probe in image by vision system
CN106296587B (en) Splicing method of tire mold images
CN106204422B (en) Super large width image Rapid matching joining method based on block subgraph search
CN111402330A (en) Laser line key point extraction method based on plane target
CN112257721A (en) Image target region matching method based on Fast ICP
WO2024000268A1 (en) Image processing method and apparatus, and device and medium
JP2003078811A (en) Method for associating marker coordinate, method and system for acquiring camera parameter and calibration pattern
Zhu et al. A fast and accurate algorithm for chessboard corner detection
CN104156952B (en) A kind of image matching method for resisting deformation

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22948383

Country of ref document: EP

Kind code of ref document: A1