An autofocus method and system for atomic imaging
By integrating multiple evaluation metrics and adaptive search strategies, an autofocus method was developed to address the issues of focus positioning accuracy and stability in atomic imaging systems, achieving efficient and stable atomic image acquisition.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HANGZHOU ATOMIC MATRIX COMPUTING CO LTD
- Filing Date
- 2026-03-06
- Publication Date
- 2026-05-15
AI Technical Summary
Existing atomic imaging systems rely on manual judgment for focusing, which is inefficient and highly subjective. It is difficult to maintain focus stability during long-term experiments, and they lack an effective closed-loop control mechanism, making it impossible to respond quickly to real-time changes in imaging conditions.
The system employs three evaluation metrics—core-ring energy, gradient energy, and second-order moment compactness—combined with a weighted combination of sharpness scoring methods and a hill-climbing search strategy that combines initial scanning with adaptive step size to achieve autofocus. It also compensates for focus shift in real time through a closed-loop control mechanism.
It significantly improves the positioning accuracy of the optimal focus position, obtains atomic images with higher resolution and signal-to-noise ratio, achieves fast autofocus and focus stability, and improves experimental efficiency and data reliability.
Smart Images

Figure CN121784950B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of quantum physics and quantum technology, and in particular relates to an autofocus method and system for atomic imaging. Background Technology
[0002] In cold atom physics and quantum information experiments, fluorescence imaging and absorption imaging are key technologies for achieving single-atom detection and atomic array resolution. High numerical aperture microscope objectives are typically used to image atomic signals onto scientific-grade cameras to obtain high spatial resolution. However, in actual experiments, due to factors such as non-uniform refractive index of the vacuum window, mechanical drift caused by temperature fluctuations, and switching between different probe lights or imaging modes, the focal position of the imaging system is prone to shift, severely affecting image quality and data reliability.
[0003] Currently, focusing in atomic imaging systems largely relies on manual judgment of image sharpness or manual adjustment based on simple contrast metrics. This method is not only inefficient and highly subjective, but also struggles to maintain focus stability during long-term experiments. Especially in high-dynamic experiments, it cannot quickly respond to real-time changes in imaging conditions. Furthermore, existing technologies lack effective closed-loop control mechanisms and cannot automatically compensate for focus drift caused by mechanical vibration or thermal expansion and contraction, limiting further improvements in imaging resolution and experimental efficiency.
[0004] Therefore, given the stringent requirements for focusing accuracy, efficiency, and stability in atomic imaging, developing a focusing method and system that can achieve rapid autofocus, adapt to different imaging modes, and has closed-loop compensation capabilities has become a pressing technical challenge in this field. Summary of the Invention
[0005] The purpose of this invention is to overcome the shortcomings of existing technologies and provide an autofocus method and system for atomic imaging. By integrating three evaluation metrics—core-loop energy, gradient energy, and second-moment compactness—and employing a weighted combination of sharpness scoring methods, the image focus state can be evaluated more comprehensively and accurately. Combining an initial scan with an adaptive step-size hill-climbing search strategy effectively overcomes the limitations of traditional single evaluation functions, significantly improving the positioning accuracy of the optimal focus position, thereby obtaining atomic images with higher resolution and signal-to-noise ratio.
[0006] The technical solution adopted by this invention to solve its technical problem is: to provide an autofocus method for atomic imaging, comprising the following steps:
[0007] S1. Acquire fluorescence or absorption images of single atoms in the region to be imaged to obtain two-dimensional grayscale image data;
[0008] S2. Determine the positions of single atoms in the two-dimensional grayscale image data, and intercept a region of interest (ROI) with a preset size centered on the position of the single atom;
[0009] S3. Calculate the centroid coordinates of the light spot within the ROI, and use this centroid as the reference center for subsequent clarity evaluation metrics;
[0010] S4. Based on the ROI, calculate clarity evaluation metrics, and obtain a clarity score S by combining them according to a preset weight;
[0011] S5. Execute a focus search strategy, including an initial scanning stage and a hill-climbing search stage, to determine the optimal focus position z best ;
[0012] S6. Control the electric displacement stage to adjust the camera to the optimal focus position z best .
[0013] Further, in step S3, the calculation formula for the centroid coordinates (x c , y c ) is:
[0014] ;
[0015] ;
[0016] where I(x, y) is the pixel grayscale value, ε is a preset extremely small positive number, and x, y are the local coordinates of the pixel within the ROI.
[0017] Further, in step S4, calculating the clarity evaluation metrics includes:
[0018] a) Core-Ring energy metric CoreRing: Calculate the ratio of the energy E core within the first radius r1 near the centroid to the energy E ring in the outer ring with r1 ≤ r < r2;
[0019] b) Gradient energy metric Sharp: In the ROI, perform horizontal and vertical gradient operations on the image to obtain the vertical gradient G y (x, y) and the horizontal gradient G x (x, y), and accumulate the sum of the squares of the gradients to obtain the total gradient energy G; Divide the total gradient energy G by the sum of the pixel grayscale I(x, y) in the region of interest ROI and a preset extremely small positive number β to obtain the normalized gradient energy metric Sharp;
[0020] c) Second moment compactness metric Compact: Based on the region of interest ROI, with the centroid of the light spot as the reference point, calculate the weighted second moment M2 of the light intensity, and take its reciprocal as the compactness metric.
[0021] Furthermore, the calculation formula for the CoreRing energy index is as follows:
[0022] ;in, The minimum positive number is preset.
[0023] Furthermore, the formula for calculating the gradient energy index Sharp is as follows:
[0024] ;
[0025] Among them, G x (x,y) and G y (x,y) represent the horizontal and vertical gradients, respectively, I(x,y) is the pixel gray value, and β is a preset minimum positive number.
[0026] Furthermore, the formula for calculating the second-order moment compactness index is as follows:
[0027] ;
[0028] Where M2 is the weighted second moment of the light intensity. Assuming a minimum positive number is assumed, the formula for calculating the weighted second moment M² is:
[0029] ;
[0030] Where, r 2 (x,y) is the squared distance from pixel (x,y) to the centroid of the spot, I(x,y) is the pixel gray value, and ε is a preset minimum positive number;
[0031] The r 2 The formula for calculating (x,y) is: .
[0032] Furthermore, in step S4, the formula for calculating the sharpness score S is:
[0033] ;
[0034] Among them, w1, w2, and w3 are preset weight parameters, which are preset or adjusted in real time according to the experimental environment.
[0035] Furthermore, in step S5, the focus search strategy includes:
[0036] a) Initial scanning phase: Within the set focus search range, the camera moves point by point along the optical axis with a preset step size, sequentially acquiring multiple frames of images. The sharpness score of each frame is calculated, and the point with the highest score is selected as the candidate focus position z. s ;
[0037] b) During the hill-climbing search phase, using the candidate focal position z s As the initial location, a hill-climbing search method is used to optimize the surrounding area:
[0038] Apply step size Δz in both the forward and reverse directions at the current position, acquire images, and calculate the sharpness score;
[0039] Compare the score of the current position with that of the adjacent positions. If the score increases in a certain direction, update the current position to the new position in that direction.
[0040] Repeat the above steps, and gradually reduce the step size according to the changes in the score to gradually improve the search accuracy;
[0041] When the increase in score is less than a preset threshold for several consecutive iterations, or when the step size decreases to below a preset threshold, the current position is determined to be the optimal focus position z. best .
[0042] Furthermore, it also includes a closed-loop control step: during the atomic imaging experiment, steps S1 to S6 are repeated periodically to compensate for focus shift caused by mechanical drift or temperature changes in real time.
[0043] The present invention also provides an autofocus system for atomic imaging, comprising:
[0044] The imaging module, including a high numerical aperture microscope objective and a scientific-grade camera, is used to acquire atomic fluorescence or absorption images;
[0045] The execution module includes an electric displacement stage for precisely adjusting the position of the camera along the optical axis.
[0046] The control module includes a processor and a memory, the memory storing a computer program configured to implement the above-described autofocus method when executed on the processor.
[0047] The present invention has the following beneficial effects:
[0048] (1) This invention comprehensively and accurately evaluates the image focus state by integrating three evaluation indicators: core-ring energy, gradient energy, and second-moment compactness, and adopting a weighted combination of sharpness scoring methods. By combining the initial scan and adaptive step size hill-climbing search strategy, the limitations of traditional single evaluation functions are effectively overcome, and the positioning accuracy of the optimal focus position is significantly improved, thereby obtaining atomic images with higher resolution and signal-to-noise ratio.
[0049] (2) This invention adopts a fully automatic focus search and closed-loop control mechanism, which completely changes the traditional focusing mode that relies on manual judgment and adjustment. The system can quickly complete the focusing operation during the experiment and periodically and automatically compensate for the focus shift caused by mechanical drift or temperature changes, which greatly reduces manual intervention and improves experimental efficiency. It is especially suitable for dynamic quantum experiments that require rapid switching of imaging conditions.
[0050] (3) The weight parameters of the sharpness evaluation index of this invention can be preset or adjusted in real time according to different experimental environments (such as photon number level, array crosstalk situation), so that the system can adapt to multiple modes such as fluorescence imaging and absorption imaging. The closed-loop control mechanism ensures the continuous stability of the focal position in long-term experiments, effectively guaranteeing the consistency and reliability of experimental data, and providing more stable technical support for quantum physics research. Attached Figure Description
[0051] To more clearly illustrate the technical solutions in the embodiments of this specification, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0052] Figure 1 This is a schematic flowchart of an autofocus method for atomic imaging according to the present invention.
[0053] Figure 2 This is a schematic diagram of an autofocus system for atomic imaging according to the present invention;
[0054] Figure 3 This is a schematic diagram of the core component of an autofocusing method for atomic imaging according to the present invention—the ring ratio energy index.
[0055] Figure 4 This is a schematic diagram of the focus search strategy of an autofocus method for atomic imaging according to the present invention;
[0056] Figure 5 This is another schematic diagram of an autofocus system for atomic imaging according to the present invention. Detailed Implementation
[0057] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0058] The terms "first," "second," "third," etc., in the description, claims, and accompanying drawings are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to such processes, methods, products, or apparatus.
[0059] In the following description, terms such as “inner,” “outer,” “upper,” “lower,” “left,” and “right” are used only to facilitate the description of the embodiments and to simplify the description, and are not intended to indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this specification.
[0060] All data involved in this application are information and data authorized by the user or fully authorized by all parties, and the collection of relevant data complies with the relevant laws, regulations and standards of the relevant countries and regions.
[0061] Example 1:
[0062] This embodiment provides an autofocus method for atomic imaging, such as... Figure 1 As shown, it includes the following steps:
[0063] S1. Acquire fluorescence or absorption images of single atoms in the region to be imaged to obtain two-dimensional grayscale image data; the control module sends a trigger signal to the scientific-grade camera to acquire fluorescence or absorption images of the region to be imaged. The acquired image is a two-dimensional grayscale matrix data, where the grayscale value I(x,y) of each pixel represents the light intensity at that point. To obtain a sufficient signal-to-noise ratio, an appropriate camera exposure time can be set as needed, and multiple frames of images can be accumulated and averaged.
[0064] S2. Determine the position of a single atom in the two-dimensional grayscale image data and extract a region of interest (ROI) of a preset size centered on the single atom position. After obtaining the entire image, it is necessary to locate the atoms and extract the ROI to focus on the key area, reduce background noise interference, and improve the efficiency of subsequent calculations.
[0065] Atom position determination: For single-atom imaging, the atom appears in the image as a bright spot (fluorescence) or a dark spot (absorption) with an approximately Gaussian distribution. The approximate position of a single atom can be determined by finding the location of the gray-level extremes (maximum values for fluorescence and minimum values for absorption) in the image, or by using simple centroid methods or Gaussian fitting methods.
[0066] ROI extraction: Centered on the preliminarily determined atomic position, a square area of a preset size is intercepted as the ROI. According to the size of the atomic spot on the image plane and the magnification of the system, the size of the ROI is preferably 17×17 pixels to 23×23 pixels. This size is sufficient to contain the entire atomic spot and its adjacent background, while avoiding including too many irrelevant areas. If the imaging area is an atomic array, this method can be sequentially executed for each atom in the array, or a representative atom can be selected for focusing.
[0067] S3. Calculate the centroid coordinates of the spot within the ROI, and use this centroid as the reference center for subsequent sharpness evaluation metrics; The centroid is the geometric reference center for subsequent sharpness evaluation metrics, and its calculation accuracy directly affects the accuracy of the evaluation metrics. Within the ROI intercepted in S2, calculate the centroid coordinates (x c , y c ) of the spot. The calculation formula is as follows:
[0068] ;
[0069] ;
[0070] where x and y are the local coordinates of the pixel within the ROI; I(x, y) is the gray value at the pixel point (x, y); ε is a preset extremely small positive number used to prevent the denominator from being zero and ensure numerical stability. This calculation is essentially a weighted average of pixel coordinates with pixel gray values as weights. The calculated centroid coordinates can be sub-pixel accuracy, thereby improving the accuracy of subsequent calculations.
[0071] S4. Based on the ROI, calculate the sharpness evaluation metrics and obtain the sharpness score S by combining them according to the preset weights; The present invention innovatively proposes three complementary image sharpness evaluation metrics and combines them according to weights to form a more robust comprehensive score S.
[0072] Furthermore, in step S4, the calculation of the sharpness evaluation metrics includes:
[0073] a) As Figure 3 shown, the core-ring energy metric CoreRing: Calculate the ratio of the energy E core within the first radius r1 near the centroid to the energy E ring of the outer ring with radius r1 ≤ r < r2; The core-ring energy metric CoreRing, which utilizes the characteristic that when out-of-focus, the spot energy will spread from the core region to the outer ring zone.
[0074] Calculate the core region energy E core : With the centroid (x c , y cUsing a circle with center r1, calculate the sum of pixel grayscale values within a radius r1. The value of r1 should be slightly smaller than the Airy disk radius when the light spot is in focus, with an optimal value of 3-5 pixels.
[0075] Furthermore, in step S3, the centroid coordinates (x... c ,y c The formula for calculating ) is:
[0076] ;
[0077] ;
[0078] Where I(x,y) is the pixel gray value, and ε is a preset minimum positive number.
[0079] Calculate the energy E of the outer ring region ring Calculate the sum of pixel grayscale values within an annular region with a radius between r1 and r2. The value of r2 should be chosen to cover the main diffusion area of the out-of-focus spot, typically 1.5 to 2.5 times that of r1, for example, 5-10 pixels.
[0080] Calculate CoreRing metrics:
[0081] ;
[0082] Here, δ is a preset, extremely small positive number to prevent the denominator from being zero.
[0083] Physical meaning: At the focal point, light energy is highly concentrated in the core region, E core Large and E ring When the core ring value is small, it reaches its maximum. When out of focus, energy diffuses, E... core Decrease and E ring As the core ring value increases, the core ring value decreases.
[0084] b) Gradient Energy Scale Sharp: Within the ROI, perform horizontal and vertical gradient calculations on the image to obtain the vertical gradient G. y (x,y) and the transverse gradient G x (x,y) and accumulate the sum of the squares of the gradients to obtain the total gradient energy G; divide the total gradient energy G by the sum of the pixel gray level I(x,y) in the region of interest (ROI) and the preset minimum positive number β to obtain the normalized gradient energy index Sharp; the gradient energy index (Sharp) utilizes the characteristic that the edge of the image is clearest and the gradient is largest at the focal point.
[0085] Gradient Calculation: Within the ROI, perform gradient calculations on the image in both the horizontal (x-direction) and vertical (y-direction) directions. To balance noise immunity and computational accuracy, the Sobel gradient operator is preferred.
[0086] Lateral gradient G x (x,y)=Sobel x I(x,y)
[0087] Longitudinal gradient G y (x,y)=Sobel y I(x,y)
[0088] in, This represents the convolution operation.
[0089] Calculate the total gradient energy G:
[0090] ;
[0091] Normalization yields the Sharp metric: ;
[0092] Among them, G x (x,y) and G y (x,y) represent the horizontal and vertical gradients, respectively, I(x,y) is the pixel gray value, and β is a preset very small positive number used to avoid the denominator being zero.
[0093] Physical significance: The normalization process eliminates the influence of total light intensity fluctuations on gradient energy, making the index more universal. At the focal point, image edges are sharpest, the sum of squared gradients is largest, and the Sharp value is highest.
[0094] c) Second-order moment compactness index: Based on the region of interest (ROI), with the centroid of the light spot as the reference point, the weighted second-order moment M2 of the light intensity is calculated, and its reciprocal is taken as the compactness index. Second-order moment compactness index: Compact;
[0095] This index utilizes the characteristic that the light spot is the smallest and has the most compact energy distribution at the focal point.
[0096] Calculate the squared distance from the pixel to the centroid:
[0097] ;
[0098] Calculate the weighted second moment M2 of the light intensity:
[0099] ;
[0100] The meaning of ε here is the same as that in the calculation of the centroid.
[0101] Calculate the Compact metric:
[0102] ;
[0103] Wherein, λ is a preset minimum positive number to ensure that the denominator is not zero and to avoid the index value being too large when M2 is very small.
[0104] Physical meaning: M2 physically reflects the "size" of the light spot. At the focal point, the light spot is smallest, M2 is smallest, and therefore its reciprocal, Compact, is largest. When out of focus, the light spot becomes diffused, M2 increases, and Compact decreases.
[0105] d) Sharpness score S: The final sharpness score S is obtained by weighted summation of the above three indicators.
[0106] ;
[0107] Among them, w1, w2, and w3 are preset weight parameters, and they satisfy w1+w2+w3=1. The weight parameters are preset or adjusted in real time according to the experimental environment.
[0108] Weight adjustment strategy: Under experimental conditions of extremely low photon count and weak signal, the gradient information Sharp may be greatly affected by noise. In this case, the weight w3 of Compact should be increased appropriately because the second moment is relatively insensitive to noise.
[0109] In atomic array imaging, crosstalk may occur in the light spots of neighboring atoms. In this case, the weight w1 of CoreRing should be increased appropriately, because the core-ring ratio characteristic helps to suppress the background influence of neighboring light spots.
[0110] Under typical conditions of strong signal and clean background, the weights of the three can be set to be similar, for example, w1=0.4, w2=0.4, w3=0.2, or optimized and determined based on historical data.
[0111] The weight parameters can be preset in the software interface and can be fine-tuned in real time based on feedback from the experimental environment, reflecting the system's adaptability.
[0112] Furthermore, in step S5, such as Figure 4 As shown, the focus search strategy includes:
[0113] a) Initial scanning phase: Within the set focus search range, the camera moves point by point along the optical axis with a preset step size, sequentially acquiring multiple frames of images. The sharpness score of each frame is calculated, and the point with the highest score is selected as the candidate focus position z. s ;
[0114] b) During the hill-climbing search phase, using the candidate focal position z s As the initial location, a hill-climbing search method is used to optimize the surrounding area:
[0115] Apply step size Δz in both the forward and reverse directions at the current position, acquire images, and calculate the sharpness score;
[0116] Compare the score of the current position with that of the adjacent positions. If the score increases in a certain direction, update the current position to the new position in that direction.
[0117] Repeat the above steps, and gradually reduce the step size according to the changes in the score to gradually improve the search accuracy;
[0118] When the increase in score is less than a preset threshold for several consecutive iterations, or when the step size decreases to below a preset threshold, the current position is determined to be the optimal focus position z. best .
[0119] Furthermore, it also includes a closed-loop control step: during the atomic imaging experiment, steps S1 to S6 are repeated periodically to compensate for focus shift caused by mechanical drift or temperature changes in real time.
[0120] The focus search strategy is implemented, including an initial scanning phase and a hill-climbing search phase, to determine the optimal focus location z. best The focus search strategy of this invention employs a two-stage method: an initial scanning stage and a hill-climbing search stage, to achieve a balance between global search and precise local optimization. A schematic diagram of the search process is shown below. Figure 3 (Curve of sharpness score S as a function of focus position z).
[0121] a) Initial scanning phase; the goal of this phase is to quickly locate the approximate area of the best focus over a large area, avoiding getting stuck in local extrema.
[0122] Set a focus search range [Z] min Z max This range should be based on historical experience or theoretical estimates of the experimental system, such as ±50µm.
[0123] Set a relatively large initial step size ΔZ coarse For example, 5µm or 10µm, for fast traversal.
[0124] Control the electric displacement stage, from Z min Starting with ΔZ coarse Move to Z point by point, step by step. max At each position z i Perform steps S1 to S4 to calculate and record the sharpness score S(z) for that location. i ).
[0125] After traversal, compare all S(z) i The position with the highest score is selected as the candidate focal position z. s .
[0126] b) Climbing search phase; this phase focuses on candidate focal locations z s Starting from this point, a fine-grained local search is performed to determine the precise optimal focal position z. best .
[0127] Initialization: Sets the current focus position z. current =z s Set the initial fine search step size ΔZ. fine For example, 1µm. Set a step size reduction factor α (0 < α < 1), and a score increment threshold S. th and minimum step size ΔZ min .
[0128] Iterative search:
[0129] a. At the current location z current Calculate its sharpness score S current .
[0130] b. In the positive direction (z) forward =z current +ΔZ fine ) and reverse (z) backward =z current -ΔZ fine Images were acquired at two locations, and a score S was calculated for each location. forward and S backward .
[0131] c. Comparison and Movement:
[0132] If S forward >S current And S forward ≥S backward This indicates that the positive direction is clearer, let z current =z forward .
[0133] If S backward >S current And S backward >S forward This indicates that the reverse is clearer, let z current =z backward .
[0134] If S current Greater than or equal to S forward and S backward If the value is zero, it indicates that the current position may be an extreme point, and the position should not be moved.
[0135] d. Adaptive step size adjustment and convergence judgment:
[0136] After each move, check the maximum increase in score ΔS in this iteration.max =max(S forward ,S backward ,S current )-S current,old .
[0137] If ΔS max th This indicates that the peak value is approaching, so the step size should be further reduced: ΔZ fine =α*ΔZ fine .
[0138] If the reduced ΔZ fine <ΔZ min Or, the increase in score for N consecutive iterations (e.g., N=3) is less than S. th If the search converges, the iteration terminates. At this point, z current This is the final determined optimal focal position z. best .
[0139] This stage achieves a "fast at first, slow later" search by dynamically adjusting the step size, which accelerates the convergence speed while ensuring the final accuracy.
[0140] Step S6: Control the electric displacement stage to adjust the camera to the optimal focus position z. best .
[0141] Focusing execution: The control module sends a command to the electric displacement stage to precisely move it to the optimal focus position z determined in step S5. best .
[0142] Closed-loop control: In long-term atomic imaging experiments, such as quantum state detection and dynamics studies, the optimal focal position may change slowly due to factors such as temperature drift and mechanical relaxation. Therefore, this invention introduces a closed-loop control mechanism:
[0143] Set a focusing cycle T, and periodically or triggered by an external signal, repeat steps S1 to S6 to find and adjust to the current optimal focus position.
[0144] This mechanism can compensate for focus drift in real time, ensuring that the imaging system remains in optimal focus throughout the experiment, thereby guaranteeing the long-term consistency and reliability of the data.
[0145] Example 2: Autofocus in Single Atom Fluorescence Imaging
[0146] Experimental setup: Resonance fluorescence of rubidium-87 single atoms was collected using an objective lens with NA=0.7 and imaged on an EMCCD camera. The camera was mounted on a piezoelectric displacement stage (Z-axis travel 100µm, resolution 10nm). The ROI size was set to 21×21 pixels.
[0147] Parameter settings: CoreRing radius r1=3 pixels, r2=7 pixels; Sobel gradient operator; weights set to w1=0.3, w2=0.4, w3=0.3 (due to the good signal-to-noise ratio of single-atom signals). Initial scan range ±30µm, step size 5µm; initial step size for hill climbing search 1µm, α=0.5, ΔZ min =0.05µm.
[0148] Implementation process: After system startup, a complete autofocus process is executed first. The initial scan acquires images at 15 locations, identifying candidate locations z. s The hill-climbing search then converged after approximately 5 iterations, taking a total of about 30 seconds.
[0149] Results: Compared to traditional manual focusing, this invention improves the peak signal-to-noise ratio (PSNR) of single-atom images by approximately 15% and achieves full automation of the focusing process. In a one-hour experiment, the closed-loop control function was activated with a period of T=15 minutes, successfully compensating for approximately 2µm of focus drift while maintaining stable image quality.
[0150] Example 3: Autofocus in atomic array absorption imaging.
[0151] Experimental setup: Absorption imaging of a strontium-88 atom array trapped in an optical lattice was performed. An objective lens with NA=0.5 and an sCMOS camera were used. Since there are multiple atoms in the array, one atom at the center of the array was selected as the focus reference point, and the ROI size was set to 19×19 pixels.
[0152] Parameter settings: To reduce the impact of crosstalk between neighboring atoms, the weights were adjusted to w1=0.5, w2=0.3, w3=0.2, increasing the weight of CoreRing.
[0153] Implementation process: After switching to absorption imaging mode, the system automatically executes the focusing process. Since atoms are dark spots in absorption imaging, the image is inverted before calculating the centroid and various indicators, turning the dark spots into bright spots; the rest of the process remains unchanged.
[0154] Results: This invention is successfully applied to absorption imaging mode, producing a clear imaging outline of the atomic array after autofocus, with optimized simultaneous sharpness for all atoms in the array. When switching between different imaging light powers, the system can quickly reposition the optimal focus, significantly improving experimental efficiency.
[0155] Example 4:
[0156] The present invention also provides an autofocus system for atomic imaging, such as... Figure 2 As shown, it includes:
[0157] The imaging module, comprising a high numerical aperture (NA) microscope objective and a scientific-grade camera, is used to acquire atomic fluorescence or absorption images. The imaging module is responsible for capturing the optical signals of atoms, and its core components are: a high numerical aperture (NA) microscope objective: preferably an objective with NA > 0.5, such as a custom objective with NA = 0.6 to 0.8, to achieve high-efficiency collection of probe light in imaging the weak fluorescence or absorption emitted by single atoms. This objective is fixedly mounted outside the vacuum chamber, aligned with the atomic trapping region within the chamber, such as a magneto-optical trap or optical dipole trap. The scientific-grade camera: preferably a camera with high quantum efficiency, low readout noise, and low dark count, such as an sCMOS camera, EMCCD, or qCMOS camera. The camera is mounted on the execution module, located near the image plane of the microscope objective.
[0158] The execution module includes a motorized displacement stage for precisely adjusting the position of the camera along the optical axis. The execution module is responsible for precisely adjusting the position of the camera in the imaging module according to control commands to achieve focusing. Its core component is: a motorized displacement stage: preferably a piezoelectric ceramic driven or precision stepper motor driven stage, with a displacement accuracy along the Z-axis of the optical axis of at least better than 1µm, preferably reaching 100nm or higher. The displacement stage should have high rigidity and stability to minimize mechanical vibration and drift. The camera is securely mounted on the displacement stage via an adapter.
[0159] The control module includes a processor and a memory. The memory stores a computer program configured to implement the aforementioned autofocus method when executed on the processor. The control module is the brain of the entire system, responsible for image processing, decision generation, and motion control. The processor is a high-performance computer central processing unit (CPU) or graphics processing unit (GPU) used to run the autofocus algorithm and perform rapid image data and mathematical operations. The memory stores the computer program implementing the autofocus method of this invention, acquired image data, intermediate calculation results, and system parameters. The data acquisition card and motion control card are responsible for transmitting image data acquired by the camera to the processor and converting the control commands generated by the processor into electrical signals to drive the electric displacement stage.
[0160] like Figure 5 As shown, the entire system is centered around a computer (control module), which is responsible for issuing commands and processing data. The computer is connected to a micro-motion stage (execution module) via a data cable for precise position control. A scientific camera (imaging module) is mounted on the micro-motion stage to acquire high-quality images.
[0161] Its workflow is as follows: the computer sends control signals to the micro-motion stage, driving it to perform precise stepping movements; the scientific camera then moves to the designated position and acquires images, and then the image data is sent back to the computer for analysis and processing, thus forming a complete closed-loop control system.
[0162] These three modules are connected via cables and a software interface, forming a complete closed-loop control system. The control module uses program instructions to control the camera to acquire images and to move the electric displacement stage. Simultaneously, it performs calculations and judgments based on the acquired image information to ultimately achieve automatic focusing.
[0163] This invention provides an autofocusing method and system for atomic imaging. By integrating centroid localization, a sharpness evaluation function with multi-index fusion, and a two-stage adaptive search strategy, it achieves high precision, high efficiency, and strong robustness in the focusing process. The described closed-loop control mechanism further ensures focus stability during long-term experiments. This method is highly versatile and can be widely applied to various fluorescence and absorption imaging scenarios in fields such as cold atom physics and quantum information processing, providing a reliable technical guarantee for obtaining high-quality, highly consistent experimental data.
[0164] Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. An autofocusing method for atomic imaging, characterized in that, Includes the following steps: S1. Acquire fluorescence or absorption images of single atoms in the region to be imaged to obtain two-dimensional grayscale image data; S2. Determine the location of a single atom in the two-dimensional grayscale image data, and extract a region of interest (ROI) of a preset size centered on the single atom location; S3. Calculate the centroid coordinates of the spot within the ROI and use this centroid as the reference center for subsequent sharpness evaluation indicators. S4. Based on ROI, calculate the sharpness evaluation index and combine them according to the preset weights to obtain the sharpness score S; S5. Execute the focus search strategy, including the initial scanning phase and the hill-climbing search phase, to determine the optimal focus location z. best ; S6. Control the electric displacement stage to adjust the camera to the optimal focus position z. best ; In step S4, the calculation of the sharpness evaluation index includes: a) Core - Ring Energy Index CoreRing: Calculate the ratio of the energy E within the first radius r1 near the centroid to the energy E within the outer - ring radius r1 ≤ r < r2 core and the energy E within the outer - ring radius r1 ≤ r < r2 ring ; b) Gradient Energy Scale Sharp: Within the ROI, perform horizontal and vertical gradient calculations on the image to obtain the vertical gradient G. y (x,y) and the lateral gradient G x (x,y), and accumulate the sum of the squares of the gradients to obtain the total gradient energy G; divide the total gradient energy G by the sum of the pixel gray level I(x,y) in the region of interest (ROI) and the preset minimum positive number β to obtain the normalized gradient energy index Sharp; c) Compact index of second moment: Based on the region of interest (ROI), with the centroid of the light spot as the reference point, the weighted second moment M2 of the light intensity is calculated, and its reciprocal is taken as the compactness index.
2. The autofocusing method for atomic imaging according to claim 1, characterized in that, In step S3, the centroid coordinates (x c ,y c The formula for calculating ) is: ; ; Where I(x,y) is the pixel gray value, and ε is a preset minimum positive number.
3. The autofocusing method for atomic imaging according to claim 1, characterized in that, The formula for calculating the CoreRing energy index is as follows: ;in, It is a preset minimum positive number.
4. The autofocusing method for atomic imaging according to claim 1, characterized in that, The formula for calculating the gradient energy index Sharp is: ; Among them, G x (x,y) and G y (x,y) represent the horizontal and vertical gradients, respectively, I(x,y) is the pixel gray value, and β is a preset minimum positive number.
5. The autofocusing method for atomic imaging according to claim 1, characterized in that, The formula for calculating the second-order moment compactness index is as follows: ; Where M2 is the weighted second moment of the light intensity. Assuming a minimum positive number is assumed, the formula for calculating the weighted second moment M² is: ; Where, r 2 (x,y) is the squared distance from pixel (x,y) to the centroid of the spot, I(x,y) is the pixel gray value, and ε is a preset minimum positive number; The r 2 The formula for calculating (x,y) is: .
6. The autofocusing method for atomic imaging according to claim 1, characterized in that, In step S4, the formula for calculating the sharpness score S is: ; Among them, w1, w2, and w3 are preset weight parameters, which are preset or adjusted in real time according to the experimental environment.
7. The autofocusing method for atomic imaging according to claim 1, characterized in that, In step S5, the focus search strategy includes: a) Initial scanning phase: Within the set focus search range, the camera moves point by point along the optical axis with a preset step size, sequentially acquiring multiple frames of images. The sharpness score of each frame is calculated, and the point with the highest score is selected as the candidate focus position z. s ; b) During the hill-climbing search phase, using the candidate focal position z s As the initial location, a hill-climbing search method is used to optimize the surrounding area: Apply step size Δz in both the forward and reverse directions at the current position, acquire images, and calculate the sharpness score; Compare the score of the current position with that of the adjacent positions. If the score increases in a certain direction, update the current position to the new position in that direction. Repeat the above steps, and gradually reduce the step size according to the changes in the score to gradually improve the search accuracy; When the increase in score is less than a preset threshold for several consecutive iterations, or when the step size decreases to below a preset threshold, the current position is determined to be the optimal focus position z. best .
8. The autofocusing method for atomic imaging according to claim 1, characterized in that, It also includes a closed-loop control step: during the atomic imaging experiment, steps S1 to S6 are repeated periodically to compensate for focus shift caused by mechanical drift or temperature changes in real time.
9. A system using the autofocus method for atomic imaging according to any one of claims 1-8, characterized in that, include: The imaging module, including a high numerical aperture microscope objective and a scientific-grade camera, is used to acquire atomic fluorescence or absorption images; The execution module includes an electric displacement stage for precisely adjusting the position of the camera along the optical axis. A control module includes a processor and a memory, the memory storing a computer program configured to, when executed on the processor, implement the autofocus method according to any one of claims 1 to 8.