Automatic focusing method, system and equipment based on fixed light spot image and medium
The autofocus method based on fixed spot images solves the image out-of-focus problem caused by focal length changes in microscanning imaging, achieves autofocusing of the entire slice field of view, is suitable for a variety of imaging methods, and improves the efficiency of scanning imaging. and quality.
Patent Information
- Application Number
- CN202410944670.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-15
- Publication Date
- 2024-10-15
AI Technical Summary
During the microscanning imaging process, the focal length of the sample changes due to mechanical vibration, inherent fluctuations and vibration of the displacement stage, resulting in the image being out of focus. The existing technology has limitations in focusing speed and sample selection, and it is difficult to adapt to different imaging conditions, especially in a variety of imaging applications. There are difficulties in the way.
An automatic focusing method based on a fixed spot image is adopted. By obtaining the image sequence of the focused spot, the mutual correlation between the reference image and the spot image is determined, linear fitting is performed, the defocus distance is calculated, and the focus is adjusted to achieve automatic focus of the entire slice field of view. Focus.
The effect of scanning imaging is improved, and each field of view only needs to collect a single frame of spot image to achieve automatic focusing. It is suitable for a variety of imaging methods and significantly improves the efficiency and quality of scanning imaging.
Smart Images

Figure CN118778236A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of microscopic scanning imaging technology, and in particular to an autofocus method, system, device and medium based on a fixed spot image. Background Art
[0002] In the field of microscopic scanning imaging, especially for whole slide imaging (WSI), during the scanning imaging process, the field of view needs to be constantly moved to collect all the fields of view of the sample. Taking whole slide imaging as an example, the scanning process requires moving dozens or even hundreds of fields of view (taking traditional surface scanning as an example), and the depth of field of the objective lens used is usually at the micron level. The focal plane change of the sample varies by several microns or even tens of microns between different fields of view. However, during the entire scanning imaging process, due to mechanical vibration, inherent fluctuations of the sample, and vibration of the sample displacement stage, the sample fails to remain at the working depth of field of the objective lens, which easily leads to blurred images due to defocus, and ultimately causes the loss of whole slide image information.
[0003] At present, the relevant technology is limited in terms of focusing speed, sample selection and imaging mode, and there are many deficiencies in ease of use. It cannot adapt well to different imaging conditions, which seriously affects the scanning imaging effect. For example, the method based on focal plane modeling depends on the accuracy of modeling, and it is necessary to collect image sequences multiple times to find the focal plane. The accuracy of modeling depends on the number of focal planes used for modeling, and the more focal plane searches, the longer it takes. For example, the focusing method based on confocal pinhole laser scanning for cell fluorescence imaging is easily affected by different interfaces. In addition, the above method is usually only applicable to a single imaging method, and there are many limitations in other imaging methods, which brings imaging difficulties to samples that need to be imaged using multiple imaging methods. Summary of the invention
[0004] The main purpose of the embodiments of the present application is to propose an autofocus method, system, device and medium based on a fixed spot image, which can effectively improve the scanning imaging effect.
[0005] To achieve the above purpose, one aspect of an embodiment of the present application provides an auto-focus method based on a fixed spot image, the method comprising:
[0006] Acquire an image sequence of the focused light spot;
[0007] Based on the image sequence, determining a first reference image, a second reference image, and a third reference image;
[0008] Performing cross-correlation operations on the first reference image, the second reference image and the third reference image with the image sequence respectively to obtain a first correlation degree;
[0009] Performing linear fitting on the first correlation and the Z-axis position to obtain a linear relationship;
[0010] Scanning and imaging the sample, and collecting a spot image in the first field of view;
[0011] Performing cross-correlation operations on the first reference image, the second reference image and the third reference image with the spot image respectively to obtain a second correlation degree;
[0012] Determining a defocus distance according to the linear relationship and the second correlation;
[0013] The focal length is adjusted according to the defocus distance, a sample image of a first field of view is acquired, and the scanning field of view of the sample is moved until the sample image of the entire field of view is scanned to obtain a sample image of the entire slice field of view.
[0014] In some embodiments, determining the first reference image, the second reference image, and the third reference image based on the image sequence comprises the following steps:
[0015] Using the focus position image in the image sequence as the first reference image;
[0016] using the first symmetrical image above the focal plane position image as the second reference image;
[0017] The first symmetrical image below the focus position image is used as the third reference image.
[0018] In some embodiments, performing cross-correlation operations on the first reference image, the second reference image, and the third reference image with the image sequence to obtain a first correlation degree comprises the following steps:
[0019] Perform a cross-correlation operation on the first reference image and the image sequence to obtain a first cross-correlation matrix;
[0020] Perform a cross-correlation operation on the second reference image and the image sequence to obtain a second cross-correlation matrix;
[0021] Perform a cross-correlation operation on the third reference image and the image sequence to obtain a third cross-correlation matrix;
[0022] Calculating the difference between the second mutual correlation matrix and the third mutual correlation matrix to obtain a fourth mutual correlation matrix;
[0023] A quotient of the fourth mutual correlation matrix and the first mutual correlation matrix is calculated to obtain a first correlation.
[0024] In some embodiments, performing cross-correlation operations on the first reference image, the second reference image, and the third reference image with the spot image to obtain a second correlation degree comprises the following steps:
[0025] Perform a cross-correlation operation on the first reference image and the spot image to obtain a fifth cross-correlation matrix;
[0026] Perform a cross-correlation operation on the second reference image and the spot image to obtain a sixth cross-correlation matrix;
[0027] Perform a cross-correlation operation on the third reference image and the spot image to obtain a seventh cross-correlation matrix;
[0028] Calculating the difference between the sixth mutual correlation matrix and the seventh mutual correlation matrix to obtain an eighth mutual correlation matrix;
[0029] A quotient of the eighth mutual correlation matrix and the fifth mutual correlation matrix is calculated to obtain a second correlation degree.
[0030] In some embodiments, the cross-correlation operation expression is:
[0031]
[0032] Among them, C(x, y) represents the cross-correlation matrix; T′ represents the normalized reference image, which is the first reference image or the second reference image or the third reference image; I′ represents the normalized calculated image, which is an image sequence or a spot image; (x, y) represents the position of a pixel in the image.
[0033] In some embodiments, the normalized reference image is obtained by the following expression:
[0034]
[0035] Among them, T′(x′,y′) represents the normalized grayscale value of the pixel position in the reference image. represents the average grayscale value of all pixels in the reference image, and T(x′,y′) represents the grayscale value of all pixels in the reference image;
[0036] The normalized calculation image is obtained by the following expression:
[0037]
[0038] Among them, I′(x+x′,y+y′) represents the normalized grayscale value of the pixel position in the calculated image. It represents the average grayscale value of the pixels in the overlapping part of the reference image and the calculated image, and I(x+x′,y+y′) represents the grayscale value of all pixels in the calculated image.
[0039] In some embodiments, the defocus distance is determined by the following expression:
[0040] ΔZ = ζ2 / k;
[0041] Wherein, ΔZ is the defocus distance, ζ2 is the second correlation, and k is a linear relationship.
[0042] To achieve the above object, another aspect of the embodiment of the present application provides an autofocus system based on a fixed spot image, the system comprising:
[0043] The first module is used to obtain an image sequence of a focused light spot;
[0044] A second module is used to determine a first reference image, a second reference image and a third reference image based on the image sequence;
[0045] A third module is used to perform cross-correlation operations on the first reference image, the second reference image and the third reference image with the image sequence respectively to obtain a first correlation degree;
[0046] A fourth module is used to perform linear fitting on the first correlation and the Z-axis position to obtain a linear relationship;
[0047] The fifth module is used to scan and image the sample and collect the spot image in the first field of view;
[0048] A sixth module is used to perform cross-correlation operations on the first reference image, the second reference image and the third reference image with the spot image to obtain a second correlation degree;
[0049] A seventh module is used to determine a defocus distance according to the linear relationship and the second correlation;
[0050] The eighth module is used to adjust the focal length according to the defocus distance, obtain the sample image of the first field of view, move the scanning field of view of the sample, until the sample image of the entire field of view is scanned, and obtain the sample image of the entire slice field of view.
[0051] To achieve the above-mentioned purpose, another aspect of an embodiment of the present application provides an electronic device, the electronic device comprising a memory and a processor, the memory storing a computer program, and the processor implementing the above-mentioned method when executing the computer program.
[0052] To achieve the above objective, another aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described above is implemented.
[0053] The embodiments of the present application include at least the following beneficial effects: The present application provides an autofocus method, system, device and medium based on a fixed spot image. The scheme obtains an image sequence of the focus spot before scanning and imaging the sample, and performs a cross-correlation operation on the image sequence to obtain a first correlation. Then, a linear fit is performed on the first correlation and the Z-axis position to calculate a linear relationship. Then, during the scanning and imaging of the sample, the spot image under each field of view is collected, and a cross-correlation operation is performed on the spot image to obtain a second correlation. Finally, based on the linear relationship and the second correlation, the defocus distance is determined, and the sample image is collected again, and the scanning field of the sample is moved to obtain the sample image of the full slice field of view. During scanning and imaging, this scheme only needs to collect a single frame of spot image in each field of view to achieve autofocus, and can be applied to a variety of imaging methods, effectively improving the effect of scanning imaging. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 is a flow chart of an auto-focus method based on a fixed spot image provided in an embodiment of the present application;
[0055] Figure 2 is a structural diagram of an autofocus system based on a fixed spot image provided in an embodiment of the present application;
[0056] Figure 3 It is a schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0057] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below in conjunction with the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the embodiments of the present application, they are only examples of systems and methods consistent with some aspects of the embodiments of the present application.
[0058] It is understood that the terms "first", "second", etc. used in this application can be used to describe various concepts in this article, but unless otherwise specified, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another concept. For example, without departing from the scope of the embodiment of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the words "if" and "if" as used herein can be interpreted as "at the time of" or "when" or "in response to determination".
[0059] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0060] The following is a detailed description with reference to the accompanying drawings:
[0061] See also Figure 2 The present invention also provides an autofocus system based on a fixed spot image, which is used to implement the autofocus method based on a fixed spot image provided in the embodiment of the present application. The system includes a focusing module 100, a displacement module 200, an imaging light source module 300, a detection module 400, a control module (not marked in the figure) and an image processing module 500.
[0062] Furthermore, the focusing module includes an LED light source 101, a Y-type optical fiber 102, a collimating objective lens 103, a lens 104, a beam splitter 105, a color filter 106, an imaging lens 107 and a focusing spot detector 108. Among them, the focusing module is used for generating and detecting the focusing spot. The LED light source is 850nm, which is used to generate a light source for the light spot. The Y-type optical fiber is used to generate the light spot. The collimating objective lens is used to collimate the light spot optical fiber. The lens is used for conjugate magnification. The beam splitter is used to separate the incident light and the reflected light spot. The color filter is used to reflect the incident light spot to the sample end. The imaging lens is used to image the reflected light spot in the focusing camera. The focusing spot detector is used to detect the reflected light spot.
[0063] Furthermore, the displacement module includes an axial displacement stage and an XY plane displacement stage. The displacement module is used for moving the field of view and adjusting the focus.
[0064] Furthermore, the imaging light source module is used to provide light source illumination for imaging.
[0065] Further, the detection module includes an imaging objective lens 401, a dichroic mirror 402, a tube lens 403 and an imaging detector 404. The detection module is used to collect sample images. The imaging objective lens is used to collect a magnified image of the sample. There are two dichroic mirrors, which are used to distinguish the light collected by the imaging objective lens. The tube lens is used to image the light of the sample image in the detector. The imaging detector is used to detect and collect the sample image.
[0066] Furthermore, the control module is used to control the translation stage and the camera to complete focusing, movement, and image acquisition.
[0067] Furthermore, the image processing module is used to process the light spot image.
[0068] Exemplarily, the workflow of the autofocus system based on a fixed spot image is as follows:
[0069] First, the focusing module generates a focusing spot and projects it onto the sample end; then the focusing spot detector collects the spot image, and the spot image is input into the image processing module for processing to calculate the defocus distance; then, based on the defocus distance, the control module feedback adjusts the focus plane of the displacement module; finally, the detection module collects the sample image. In this process, the imaging light source module adjusts the illumination of the sample according to the needs of the light source.
[0070] For example, in the embodiment of the present application, the time for the fixed spot image autofocus system to collect the spot image once is 5ms, the time for the image processing module to calculate the defocus distance is 50ms, and the defocus distance can be calculated in 55ms. In other words, the embodiment of the present application has the advantage of high efficiency.
[0071] See also Figure 1 , Figure 1 is an optional flow chart of an auto-focus method based on a fixed spot image provided in an embodiment of the present application. Figure 1 The method may include but is not limited to steps S101 to S108:
[0072] Step S101, acquiring an image sequence of a focused light spot.
[0073] Step S102: determining a first reference image, a second reference image, and a third reference image based on the image sequence.
[0074] Step S103 : performing cross-correlation operations on the first reference image, the second reference image and the third reference image and the image sequence respectively to obtain a first correlation degree.
[0075] Step S104: performing linear fitting on the first correlation and the Z-axis position to obtain a linear relationship.
[0076] Step S105, scanning and imaging the sample, and collecting a spot image in the first field of view.
[0077] Step S106 , performing cross-correlation operations on the first reference image, the second reference image and the third reference image and the spot image respectively to obtain a second correlation degree.
[0078] Step S107, determining the defocus distance according to the linear relationship and the second correlation.
[0079] Step S108, adjusting the focal length according to the defocus distance, acquiring a sample image of the first field of view, and moving the scanning field of view of the sample until the sample image of the entire field of view is scanned to obtain a sample image of the entire slice field of view.
[0080] In step S101 of some embodiments, before scanning imaging, it is necessary to collect an image sequence of a focus spot with a fixed step length within a Z-axis symmetric range of the focal plane position in the same field of view.
[0081] In some embodiments, step S102 may include but is not limited to steps S201 to S203:
[0082] Step S201: taking a focus position image in an image sequence as a first reference image.
[0083] Step S202: Use the first symmetrical image above the focus position image as a second reference image.
[0084] Step S203: Use the first symmetrical image below the focus position image as the third reference image.
[0085] In steps S201 to S203 of some embodiments, the first reference image is denoted as T f , the second reference image is denoted as T p , the third reference image is denoted as T n .
[0086] In steps S201 to S203 shown in the embodiment of the present application, the first reference image, the second reference image and the third reference image are determined through the image sequence, which can lay a foundation for the subsequent calculation of the correlation.
[0087] In some embodiments, step S103 may include but is not limited to steps S301 to S305:
[0088] Step S301, performing a cross-correlation operation on a first reference image and an image sequence to obtain a first cross-correlation matrix.
[0089] Step S302: performing a cross-correlation operation on the second reference image and the image sequence to obtain a second cross-correlation matrix.
[0090] Step S303: performing a cross-correlation operation on the third reference image and the image sequence to obtain a third cross-correlation matrix.
[0091] Step S304: Calculate the difference between the second mutual correlation matrix and the third mutual correlation matrix to obtain a fourth mutual correlation matrix.
[0092] Step S305: Calculate the quotient of the fourth mutual correlation matrix and the first mutual correlation matrix to obtain a first correlation.
[0093] In steps S301 to S303 of some embodiments, the cross-correlation operation expression is:
[0094]
[0095] Among them, C(x,y) represents the cross-correlation matrix; T′ represents the normalized reference image, which is the first reference image, the second reference image, or the third reference image; I′ represents the normalized calculated image, which is an image sequence; (x,y) represents the position of a pixel in the image.
[0096] Exemplarily, the normalization process is as follows:
[0097] The normalized reference image is obtained by the following expression:
[0098]
[0099] Among them, T′(x′,y′) represents the normalized grayscale value of the pixel position in the reference image. represents the average grayscale value of all pixels in the reference image, and T(x′,y′) represents the grayscale value of all pixels in the reference image;
[0100] The normalized computational image is obtained by the following expression:
[0101]
[0102] Among them, I′(x+x′,y+y′) represents the normalized grayscale value of the pixel position in the calculated image. It represents the average grayscale value of the pixels in the overlapping part of the reference image and the calculated image, and I(x+x′,y+y′) represents the grayscale value of all pixels in the calculated image.
[0103] In steps S304 to S305 of some embodiments, the expression of the first correlation is:
[0104]
[0105] Among them, ζ1 represents the first correlation, C p,i represents the second cross-correlation matrix, C n,i represents the third cross-correlation matrix, C f,i represents the first cross-correlation matrix, C p,i -C n,i Denotes the fourth cross-correlation matrix.
[0106] In steps S301 to S305 shown in the embodiment of the present application, a first correlation degree is obtained by performing cross-correlation operations on the first reference image, the second reference image and the third reference image with the image sequence respectively, which can lay a foundation for the subsequent calculation of the linear relationship.
[0107] In step S104 of some embodiments, the linear relationship is expressed as:
[0108] Z = k × ζ1;
[0109] Wherein, Z represents the Z-axis position, k represents the linear relationship, and ζ1 represents the first correlation degree.
[0110] In some embodiments, step S106 may include but is not limited to steps S401 to S405:
[0111] Step S401, performing a cross-correlation operation on the first reference image and the spot image to obtain a fifth cross-correlation matrix.
[0112] Step S402: performing a cross-correlation operation on the second reference image and the spot image to obtain a sixth cross-correlation matrix.
[0113] Step S403: performing a cross-correlation operation on the third reference image and the spot image to obtain a seventh cross-correlation matrix.
[0114] Step S404: Calculate the difference between the sixth mutual correlation matrix and the seventh mutual correlation matrix to obtain an eighth mutual correlation matrix.
[0115] Step S405: Calculate the quotient of the eighth mutual correlation matrix and the fifth mutual correlation matrix to obtain a second correlation.
[0116] In steps S401 to S403 of some embodiments, the cross-correlation operation expression is:
[0117]
[0118] Among them, C(x,y) represents the cross-correlation matrix; T′ represents the normalized reference image, which is the first reference image, the second reference image, or the third reference image; I′ represents the normalized calculated image, which is the spot image; (x,y) represents the position of a pixel in the image.
[0119] Exemplarily, the normalization process is as follows:
[0120] The normalized reference image is obtained by the following expression:
[0121]
[0122] Among them, T′(x′,y′) represents the normalized grayscale value of the pixel position in the reference image. represents the average grayscale value of all pixels in the reference image, and T(x′,y′) represents the grayscale value of all pixels in the reference image;
[0123] The normalized computational image is obtained by the following expression:
[0124]
[0125] Among them, I′(x+x′,y+y′) represents the normalized grayscale value of the pixel position in the calculated image. It represents the average grayscale value of the pixels in the overlapping part of the reference image and the calculated image, and I(x+x′,y+y′) represents the grayscale value of all pixels in the calculated image.
[0126] In steps S404 to S405 of some embodiments, the expression of the second correlation is:
[0127]
[0128] Among them, ζ1 represents the first correlation, C' p,i Denotes the sixth cross-correlation matrix, C' n,i Denotes the seventh cross-correlation matrix, C' f,i Denotes the fifth cross-correlation matrix, C' p,i -C' n,i represents the eighth cross-correlation matrix.
[0129] In steps S401 to S405 shown in the embodiment of the present application, by performing cross-correlation operations on the first reference image, the second reference image and the third reference image with the spot image respectively, a second correlation degree is obtained, which can lay a foundation for the subsequent calculation of the defocus distance.
[0130] In some embodiments, in step S107, the defocus distance is determined by the following expression:
[0131] ΔZ = ζ2 / k;
[0132] Wherein, ΔZ is the defocus distance, ζ2 is the second correlation, and k is a linear relationship.
[0133] In some embodiments, in step S108, after acquiring the sample image of the first field of view, the scanning field of view of the sample is moved, and then steps S105 to S107 are repeated to recalculate the correlation and the new defocus distance of the new field of view, and acquire the sample image of the new field of view until the sample image of the entire slice field of view is acquired.
[0134] Steps S101 to S108 shown in the embodiment of the present application are obtained by acquiring an image sequence of the focused light spot before scanning and imaging the sample, and performing a cross-correlation operation on the image sequence to obtain a first correlation. Then, a linear fit is performed on the first correlation and the Z-axis position to calculate a linear relationship. Then, during the scanning and imaging of the sample, the spot image under each field of view is collected, and the spot image is cross-correlated to obtain a second correlation. Finally, based on the linear relationship and the second correlation, the defocus distance is determined, the sample image is collected, and the scanning field of the sample is moved to obtain a sample image of the entire slice field of view. During scanning and imaging, this solution only needs to collect a single frame of spot image in each field of view to achieve automatic focus, which can effectively improve the effect of scanning imaging.
[0135] The embodiment of the present application further provides an autofocus system based on a fixed spot image, which can implement the above method, and the system includes:
[0136] The first module is used to obtain an image sequence of a focused light spot;
[0137] A second module is used to determine a first reference image, a second reference image and a third reference image based on the image sequence;
[0138] A third module is used to perform cross-correlation operations on the first reference image, the second reference image and the third reference image with the image sequence respectively to obtain a first correlation degree;
[0139] The fourth module is used to perform linear fitting on the first correlation and the Z-axis position to obtain a linear relationship;
[0140] The fifth module is used to scan and image the sample and collect the spot image in the first field of view;
[0141] A sixth module is used to perform cross-correlation operations on the first reference image, the second reference image and the third reference image with the spot image to obtain a second correlation degree;
[0142] A seventh module is used to determine the defocus distance according to the linear relationship and the second correlation;
[0143] The eighth module is used to adjust the focal length according to the defocus distance, obtain the sample image of the first field of view, move the scanning field of view of the sample, until the sample image of the entire field of view is scanned, and obtain the sample image of the entire slice field of view.
[0144] It can be understood that the contents of the above method embodiments are all applicable to the present system embodiments, the functions specifically implemented by the present system embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0145] The embodiment of the present application also provides an electronic device, the electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the above-mentioned adaptive reservoir scheduling rule extraction method when executing the computer program. The electronic device can be any intelligent terminal including a tablet computer, a car computer, etc.
[0146] It can be understood that the contents of the above method embodiments are all applicable to the present device embodiments, the functions specifically implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0147] See also Figure 3 , Figure 3 The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:
[0148] The processor 301 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;
[0149] The memory 302 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 302 can store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 302, and the processor 301 calls and executes the adaptive reservoir scheduling rule extraction method of the embodiment of this application;
[0150] Input / output interface 303, used to implement information input and output;
[0151] The communication interface 304 is used to realize the communication interaction between the device and other devices. The communication can be realized through a wired manner (such as USB, network cable, etc.) or a wireless manner (such as mobile network, WIFI, Bluetooth, etc.);
[0152] A bus 305 that transmits information between the various components of the device (e.g., the processor 301, the memory 302, the input / output interface 303, and the communication interface 304);
[0153] The processor 301 , the memory 302 , the input / output interface 303 and the communication interface 304 are connected to each other in communication within the device via the bus 305 .
[0154] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned adaptive reservoir scheduling rule extraction method is implemented.
[0155] It can be understood that the contents of the above method embodiments are all applicable to the present storage medium embodiments, the functions specifically implemented by the present storage medium embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0156] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0157] The embodiments of the present application provide an autofocus method, system, electronic device and storage medium based on a fixed spot image, which obtains an image sequence of the focus spot before scanning and imaging the sample, and performs a cross-correlation operation on the image sequence to obtain a first correlation. Then, a linear fit is performed on the first correlation and the Z-axis position to calculate a linear relationship. Then, during the scanning and imaging of the sample, the spot image under each field of view is collected, and the spot image is cross-correlated to obtain a second correlation. Finally, based on the linear relationship and the second correlation, the defocus distance is determined, and the sample image is collected again, and the scanning field of the sample is moved to obtain the sample image of the entire slice field of view. During scanning and imaging, this solution only needs to collect a single frame of spot image in each field of view to achieve autofocus, which can effectively improve the scanning imaging effect.
[0158] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0159] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0160] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0161] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0162] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.
Claims
1. An autofocus method based on a fixed spot image, characterized in that: The method comprises the following steps: Acquire an image sequence of the focused light spot; Based on the image sequence, determining a first reference image, a second reference image, and a third reference image; Performing cross-correlation operations on the first reference image, the second reference image and the third reference image with the image sequence respectively to obtain a first correlation degree; Performing linear fitting on the first correlation and the Z-axis position to obtain a linear relationship; Scanning and imaging the sample, and collecting a spot image in the first field of view; Performing cross-correlation operations on the first reference image, the second reference image and the third reference image with the spot image respectively to obtain a second correlation degree; Determining a defocus distance according to the linear relationship and the second correlation; The focal length is adjusted according to the defocus distance, a sample image of a first field of view is acquired, and the scanning field of view of the sample is moved until the sample image of the entire field of view is scanned to obtain a sample image of the entire slice field of view.
2. The method according to claim 1, characterized in that Determining the first reference image, the second reference image and the third reference image based on the image sequence comprises the following steps: Using the focus position image in the image sequence as the first reference image; Using the first symmetrical image above the focal plane position image as the second reference image; The first symmetrical image below the focus position image is used as the third reference image.
3. The method according to claim 1, characterized in that The method of performing cross-correlation operations on the first reference image, the second reference image and the third reference image with the image sequence to obtain a first correlation degree comprises the following steps: Perform a cross-correlation operation on the first reference image and the image sequence to obtain a first cross-correlation matrix; Perform a cross-correlation operation on the second reference image and the image sequence to obtain a second cross-correlation matrix; Performing a cross-correlation operation on the third reference image and the image sequence to obtain a third cross-correlation matrix; Calculating the difference between the second mutual correlation matrix and the third mutual correlation matrix to obtain a fourth mutual correlation matrix; A quotient of the fourth mutual correlation matrix and the first mutual correlation matrix is calculated to obtain a first correlation.
4. The method according to claim 1, characterized in that: The method of performing cross-correlation operations on the first reference image, the second reference image and the third reference image respectively with the spot image to obtain a second correlation degree comprises the following steps: Perform a cross-correlation operation on the first reference image and the spot image to obtain a fifth cross-correlation matrix; Perform a cross-correlation operation on the second reference image and the spot image to obtain a sixth cross-correlation matrix; Perform a cross-correlation operation on the third reference image and the spot image to obtain a seventh cross-correlation matrix; Calculating the difference between the sixth mutual correlation matrix and the seventh mutual correlation matrix to obtain an eighth mutual correlation matrix; A quotient of the eighth mutual correlation matrix and the fifth mutual correlation matrix is calculated to obtain a second correlation degree.
5. The method according to claim 1, characterized in that The cross-correlation operation expression is: Where C(x,y) represents the cross-correlation matrix; T ′ represents a normalized reference image, wherein the reference image is the first reference image, the second reference image, or the third reference image; ′ represents a normalized computational image, which is an image sequence or a spot image; (x, y) represents the position of a pixel in the image.
6. The method according to claim 5, characterized in that The normalized reference image is obtained by the following expression: Among them, T ′ (x ′ ,y ′ ) represents the normalized grayscale value of the pixel position in the reference image. Represents the average grayscale value of all pixels in the reference image, T(x ′ ,y ′ ) represents the grayscale value of all pixels in the reference image; The normalized calculation image is obtained by the following expression: Among them, I ′ (x+x ′ ,y+y ′ ) represents the normalized gray value of the pixel position in the calculated image. It represents the average grayscale value of the pixels in the overlapping part of the reference image and the calculated image, I(x+x ′ ,y+y ′ ) means calculating the grayscale values of all pixels in the image.
7. The method according to claim 1, characterized in that The defocus distance is determined by the following expression: ΔZ = ζ2 / k; Wherein, ΔZ is the defocus distance, ζ2 is the second correlation, and k is a linear relationship.
8. An autofocus system based on a fixed spot image, characterized in that: The system comprises: The first module is used to obtain an image sequence of a focused light spot; A second module is used to determine a first reference image, a second reference image and a third reference image based on the image sequence; A third module is used to perform cross-correlation operations on the first reference image, the second reference image and the third reference image with the image sequence respectively to obtain a first correlation degree; A fourth module is used to perform linear fitting on the first correlation and the Z-axis position to obtain a linear relationship; The fifth module is used to scan and image the sample and collect the spot image in the first field of view; A sixth module is used to perform cross-correlation operations on the first reference image, the second reference image and the third reference image with the spot image to obtain a second correlation degree; A seventh module is used to determine a defocus distance according to the linear relationship and the second correlation; The eighth module is used to adjust the focal length according to the defocus distance, obtain the sample image of the first field of view, move the scanning field of view of the sample, until the sample image of the entire field of view is scanned, and obtain the sample image of the entire slice field of view.
9. An electronic device, characterized in that: include: at least one processor; at least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor implements the method according to any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Image correlation processing by addition of reaggregation
US12597147B2
