Search

CN-121364556-B - Automatic focusing method, device and computer equipment

CN121364556BCN 121364556 BCN121364556 BCN 121364556BCN-121364556-B

Abstract

The application relates to an automatic focusing method, an automatic focusing device and computer equipment. The method is applied to a microscope and comprises the steps of responding to an automatic focusing instruction, controlling an objective lens to move according to a first stepping value corresponding to imaging parameters of the microscope, acquiring first reference images of at least two different objective lens positions, determining the first objective lens positions according to the objective lens positions and ambiguity features corresponding to the first reference images, controlling the objective lens to move according to the first objective lens positions and preset second stepping values, acquiring second reference images of at least two different objective lens positions, and determining target focal plane positions and completing focusing according to the objective lens positions and the sharpness features corresponding to the second reference images. By adopting the method, the focusing efficiency can be improved and the calculated amount can be reduced on the premise of ensuring the focusing accuracy.

Inventors

  • XU JIALE
  • LIU YI
  • XIA CHENYANG
  • HE YINGJIE
  • Weng Hangli

Assignees

  • 宁波舜宇仪器有限公司

Dates

Publication Date
20260512
Application Date
20251222

Claims (8)

  1. 1. An autofocus method for a microscope, the autofocus method comprising: Responding to an automatic focusing instruction, controlling the objective lens to move according to a first stepping value corresponding to an imaging parameter of the microscope, and acquiring at least two first reference images at different objective lens positions, wherein the imaging parameter comprises a depth-of-field parameter, and the depth-of-field parameter is calculated by a numerical aperture and a working wavelength of the objective lens through an optical formula; Determining a first objective lens position according to the objective lens position and the ambiguity feature corresponding to the first reference image; the method comprises the steps of determining a first objective lens position according to the corresponding objective lens position and the corresponding ambiguity characteristics of a first reference image, calculating the ambiguity characteristics of each first reference image according to a preset ambiguity algorithm, sequentially calculating the ratio of the ambiguity characteristics of each two first reference images and the difference value of the corresponding objective lens positions to obtain the ambiguity relative change characteristics of the first reference image, determining the first objective lens position according to the ambiguity relative change characteristics, and determining the first objective lens position according to the ambiguity relative change characteristics, wherein the steps of inputting the ambiguity relative change characteristics into a pre-trained objective lens position prediction model to obtain the first objective lens position; Controlling the objective to move according to the first objective position and a preset second stepping value, and acquiring at least two second reference images at different objective positions; And determining the target focal plane position according to the object lens position and the definition characteristic corresponding to the second reference image, and completing focusing.
  2. 2. The auto-focusing method according to claim 1, wherein the imaging parameters include depth of field parameters, the first reference image includes a first current reference image and a first step reference image, the controlling the movement of the objective lens according to a first step value corresponding to the imaging parameters of the microscope in response to the auto-focusing command, and acquiring the first reference image with at least two different objective lens positions includes: collecting a first current reference image at the current objective lens position; and controlling the objective lens to move at least once according to a first stepping value corresponding to the depth of field parameter, and acquiring at least one first stepping reference image.
  3. 3. The auto-focusing method according to claim 1, wherein the training process of the objective lens position prediction model comprises: controlling the objective lens to move according to a preset stepping interval within the movable range of the objective lens of the microscope, and obtaining a sample image of a target sample at each objective lens position; Calculating the ambiguity characteristic of each sample image according to a preset ambiguity algorithm; Sequentially calculating the ratio of the ambiguity features of every two sample images and the objective lens position difference value to obtain the ambiguity relative change feature, and taking the reduction number or the subtracted number corresponding to the objective lens position difference value as the real objective lens position of the ambiguity relative change feature; and training a preset machine learning model according to the relative change characteristics of the plurality of the ambiguities and the real objective lens positions to obtain the objective lens position prediction model.
  4. 4. The auto-focusing method according to claim 3, wherein calculating the blur feature of each image according to a preset blur algorithm comprises: extracting image characteristics of the image according to a preset gradient operator to obtain gradient information, wherein the gradient information comprises horizontal gradients and vertical gradients; and taking the sum of absolute values of the horizontal gradient and the vertical gradient as an ambiguity characteristic of the image.
  5. 5. The auto-focusing method according to claim 1, wherein controlling the movement of the objective lens according to the first objective lens position and a preset second step value, acquiring second reference images of at least two different objective lens positions includes: And controlling the objective lens to move to a target position according to the first objective lens position and the second stepping value to obtain at least two images with different objective lens positions, wherein the target position at least comprises two of a first objective lens position, a difference between the first objective lens position and the second stepping value and a sum of the first objective lens position and the second stepping value.
  6. 6. The auto-focusing method according to claim 1, wherein determining a target focal plane position and completing focusing according to the objective lens position and the sharpness feature corresponding to the second reference image comprises: respectively calculating the definition characteristics of each second reference image according to a preset definition algorithm; Screening a target reference image according to the definition characteristics of each second reference image, and taking the objective lens position corresponding to the target reference image as a target focal plane position; And controlling the objective lens to move to the target focal plane position.
  7. 7. An autofocus device for use with a microscope, the autofocus device comprising: the system comprises a first moving module, a second moving module, a first focusing module and a second focusing module, wherein the first moving module is used for responding to an automatic focusing instruction, controlling the movement of an objective according to a first stepping value corresponding to imaging parameters of the microscope, and acquiring at least two first reference images at different objective positions; The position analysis module is used for determining a first objective lens position according to the objective lens position and the ambiguity feature corresponding to the first reference image, wherein the determining of the first objective lens position comprises the steps of calculating the ambiguity feature of each first reference image according to a preset ambiguity algorithm, sequentially calculating the ratio of the ambiguity features of each two first reference images and the difference value of the corresponding objective lens positions to obtain the ambiguity relative change feature of the first reference image; the second moving module is used for controlling the objective lens to move according to the first objective lens position and a preset second stepping value, and acquiring at least two second reference images with different objective lens positions; and the focal plane analysis module is used for determining the target focal plane position according to the objective lens position and the definition characteristic corresponding to the second reference image and completing focusing.
  8. 8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the method of any one of claims 1 to 6 when executing the computer program.

Description

Automatic focusing method, device and computer equipment Technical Field The present application relates to the field of microscope technologies, and in particular, to an automatic focusing method, an automatic focusing device, and a computer device. Background In the microscopic observation field, an automatic focusing technology is a key for guaranteeing imaging quality and observation efficiency. With the improvement of the performance of the image sensor, people put higher demands on the speed and the precision of the automatic focusing technology. In the traditional technology, a focusing depth method is adopted for automatic focusing, and the implementation of the method needs to collect a large amount of image data in different focusing states, so that the image collection quantity is huge, although the accuracy can be ensured to a certain extent, the data processing quantity is large, the focusing time is long, and the requirements of scenes such as high-speed scanning, real-time detection and the like are difficult to meet. Therefore, the problems of low focusing efficiency and large calculation amount still exist in the field of automatic focusing of a microscope in the prior art. Disclosure of Invention In view of the foregoing, it is desirable to provide an automatic focusing method, apparatus, and computer device that can improve focusing efficiency and reduce the amount of calculation while ensuring focusing accuracy. In a first aspect, the present application provides an autofocus method for a microscope, the autofocus method comprising: responding to an automatic focusing instruction, controlling the objective lens to move according to a first stepping value corresponding to an imaging parameter of the microscope, and acquiring at least two first reference images at different objective lens positions; determining a first objective lens position according to the objective lens position and the ambiguity feature corresponding to the first reference image; Controlling the objective to move according to the first objective position and a preset second stepping value, and acquiring at least two second reference images at different objective positions; And determining the target focal plane position according to the object lens position and the definition characteristic corresponding to the second reference image, and completing focusing. In one embodiment, the imaging parameters include depth of field parameters, the first reference image includes a first current reference image and a first step reference image, the responding to the auto-focusing instruction controls the objective lens to move according to a first step value corresponding to the imaging parameters of the microscope, and acquiring the first reference image of at least two different objective lens positions includes: collecting a first current reference image at the current objective lens position; and controlling the objective lens to move at least once according to a first stepping value corresponding to the depth of field parameter, and acquiring at least one first stepping reference image. In one embodiment, the determining the first objective lens position according to the objective lens position and the ambiguity feature corresponding to the first reference image includes: calculating the ambiguity characteristic of each first reference image according to a preset ambiguity algorithm; Sequentially calculating the ratio of the ambiguity features of each two first reference images and the difference value of the corresponding objective lens positions to obtain the ambiguity relative change features of the first reference images; And determining the position of the first objective lens according to the relative change characteristics of the ambiguity. In one embodiment, the determining the first objective lens position according to the blur degree relative change feature includes: And inputting the relative change characteristics of the ambiguity into a pre-trained objective lens position prediction model to obtain a first objective lens position. In one embodiment, the training process of the objective lens position prediction model includes: controlling the objective lens to move according to a preset stepping interval within the movable range of the objective lens of the microscope, and obtaining a sample image of a target sample at each objective lens position; Calculating the ambiguity characteristic of each sample image according to a preset ambiguity algorithm; Sequentially calculating the ratio of the ambiguity features of every two sample images and the objective lens position difference value to obtain the ambiguity relative change feature, and taking the reduction number or the subtracted number corresponding to the objective lens position difference value as the real objective lens position of the ambiguity relative change feature; and training a preset machine learning model according to the relative change charact