Microscopic operation automatic focusing method and system based on variance and global search strategy

文档序号:1295573 发布日期:2020-08-07 浏览:19次 中文

阅读说明:本技术 基于方差和全局搜索策略的显微操作自动聚焦方法及系统 (Microscopic operation automatic focusing method and system based on variance and global search strategy ) 是由 于兴虎 于 2020-04-15 设计创作,主要内容包括:本发明公开了一种基于方差和全局搜索策略的显微操作自动聚焦方法及系统。所述方法将显微镜的物镜移至最高点,获取物镜在当前位置拍摄的当前图像并转为灰度图像;计算灰度图像的当前方差并与当前位置对应存储;判断当前位置是否为物镜最低点,若否,物镜下降固定步长,返回获取物镜在当前位置拍摄的当前图像并转为灰度图像的步骤;若是,获取存储的所有当前方差中的最大值作为最佳聚焦值,确定最佳聚焦值对应的当前位置为最佳聚焦位置;将物镜移动到最佳聚焦位置,完成显微镜的自动聚焦。本发明方法利用方差作为清晰度评价标准,同时结合全局搜索策略,在保证准确聚焦的前提下提高了搜索效率,计算量相对较小,实现起来非常容易。(The invention discloses a microscopic operation automatic focusing method and system based on variance and a global search strategy. The method comprises the steps of moving an objective lens of a microscope to the highest point, obtaining a current image shot by the objective lens at the current position and converting the current image into a gray image; calculating the current variance of the gray level image and storing the current variance corresponding to the current position; judging whether the current position is the lowest point of the objective lens, if not, descending the objective lens by a fixed step length, and returning to the step of acquiring the current image shot by the objective lens at the current position and converting the current image into a gray image; if so, acquiring the maximum value in all the stored current variances as the optimal focusing value, and determining the current position corresponding to the optimal focusing value as the optimal focusing position; and moving the objective lens to the optimal focusing position to complete the automatic focusing of the microscope. The method of the invention utilizes the variance as the definition evaluation standard and combines the global search strategy, thereby improving the search efficiency on the premise of ensuring accurate focusing, and the method has relatively small calculated amount and is very easy to realize.)

1. A method for micromanipulation autofocus based on variance and global search strategies, the method comprising:

moving the objective lens of the microscope to the highest point;

acquiring a current image shot by the objective lens at the current position and converting the current image into a gray image;

calculating a current variance according to the gray value of each pixel in the gray image, and correspondingly storing the current variance and the current position;

judging whether the current position is the lowest point of the objective lens or not to obtain a first judgment result;

if the first judgment result shows that the current position is not the lowest point of the objective lens, the objective lens descends for a fixed step length, and the step of acquiring the current image shot by the objective lens at the current position and converting the current image into a gray image is returned;

if the first judgment result is that the current position is the lowest point of the objective lens, acquiring the maximum value of all the stored current variances as the optimal focus value, and determining the current position corresponding to the optimal focus value as the optimal focus position;

and moving the objective lens to the optimal focusing position to finish the automatic focusing of the microscope.

2. The micromanipulation autofocus method of claim 1, wherein the calculating a current variance from the grayscale values of the pixels in the grayscale image specifically comprises:

adopting a formula according to the gray value of each pixel in the gray imageCalculating a current variance F; where H is a grayscale image height direction pixel value, W is a grayscale image width direction pixel value, i (x, y) is a grayscale value at a grayscale image (x, y) point, and μ is an average grayscale value of the entire grayscale image.

3. The micromanipulation autofocus method of claim 1, wherein the objective lens is lowered by a fixed step size, the fixed step size being a minimum step size of the microscope drive motor.

4. A micromanipulation autofocus system based on variance and global search strategy, the system comprising:

the initial position determining module is used for moving an objective lens of the microscope to the highest point;

the image shooting conversion module is used for acquiring a current image shot by the objective lens at the current position and converting the current image into a gray image;

the variance calculation and storage module is used for calculating the current variance according to the gray value of each pixel in the gray image and correspondingly storing the current variance and the current position;

the position judging module is used for judging whether the current position is the lowest point of the objective lens or not and obtaining a first judging result;

the global searching module is used for descending the objective lens by a fixed step length if the first judgment result shows that the current position is not the lowest point of the objective lens, and returning to the step of acquiring the current image shot by the objective lens at the current position and converting the current image into a gray image;

an optimal focusing position determining module, configured to, if the first determination result indicates that the current position is the lowest point of the objective lens, obtain a maximum value of all stored current variances as an optimal focusing value, and determine that the current position corresponding to the optimal focusing value is an optimal focusing position;

and the micromanipulation automatic focusing module is used for moving the objective lens to the optimal focusing position to finish the automatic focusing of the microscope.

5. The micromanipulation autofocus system of claim 4, wherein the variance calculation storage module comprises in particular:

a variance calculating unit for adopting a formula according to the gray value of each pixel in the gray imageCalculating a current variance F; where H is a grayscale image height direction pixel value, W is a grayscale image width direction pixel value, i (x, y) is a grayscale value at a grayscale image (x, y) point, and μ is an average grayscale value of the entire grayscale image.

6. The micromachined autofocus system of claim 4, wherein the fixed step size is the minimum step size of the microscope drive motor.

Technical Field

The invention relates to the technical field of automatic focusing of a microscopic operation system, in particular to a microscopic operation automatic focusing method and a microscopic operation automatic focusing system based on variance and a global search strategy.

Background

Auto-focusing is a fundamental microscopic technique, particularly in biological observation and manipulation at the micron nanometer scale, such as: high throughput observation screens pharmacological agents, delivers foreign substances to cells, and the like. In addition, reliable auto-focusing methods are also critical for micro-assembly of micro-electromechanical systems using microscopes.

The auto-focus process can be divided into two parts: and evaluating image definition and searching algorithm.

Although image sharpness evaluation indicators are a long standing topic and a significant portion of focusing algorithms have been discussed by researchers, the selection of a suitable sharpness definition and calculation for a particular experimental microscopic imaging condition remains difficult and time consuming.

Disclosure of Invention

The invention aims to provide a method and a system for automatically focusing micromanipulation based on a variance and a global search strategy, which aim to solve the problems of large calculation amount, time consumption and labor consumption of the existing method for automatically focusing micromanipulation.

In order to achieve the purpose, the invention provides the following scheme:

a method of micromanipulation autofocus based on variance and global search strategies, the method comprising:

moving the objective lens of the microscope to the highest point;

acquiring a current image shot by the objective lens at the current position and converting the current image into a gray image;

calculating a current variance according to the gray value of each pixel in the gray image, and correspondingly storing the current variance and the current position;

judging whether the current position is the lowest point of the objective lens or not to obtain a first judgment result;

if the first judgment result shows that the current position is not the lowest point of the objective lens, the objective lens descends for a fixed step length, and the step of acquiring the current image shot by the objective lens at the current position and converting the current image into a gray image is returned;

if the first judgment result is that the current position is the lowest point of the objective lens, acquiring the maximum value of all the stored current variances as the optimal focus value, and determining the current position corresponding to the optimal focus value as the optimal focus position;

and moving the objective lens to the optimal focusing position to finish the automatic focusing of the microscope.

Optionally, the calculating the current variance according to the gray value of each pixel in the gray image specifically includes:

adopting a formula according to the gray value of each pixel in the gray imageCalculating a current variance F; where H is a grayscale image height direction pixel value, W is a grayscale image width direction pixel value, i (x, y) is a grayscale value at a grayscale image (x, y) point, and μ is an average grayscale value of the entire grayscale image.

Optionally, in a fixed step length of the objective lens descending, the fixed step length is a minimum step length of the microscope driving motor.

A micromanipulation autofocus system based on variance and global search strategy, the system comprising:

the initial position determining module is used for moving an objective lens of the microscope to the highest point;

the image shooting conversion module is used for acquiring a current image shot by the objective lens at the current position and converting the current image into a gray image;

the variance calculation and storage module is used for calculating the current variance according to the gray value of each pixel in the gray image and correspondingly storing the current variance and the current position;

the position judging module is used for judging whether the current position is the lowest point of the objective lens or not and obtaining a first judging result;

the global searching module is used for descending the objective lens by a fixed step length if the first judgment result shows that the current position is not the lowest point of the objective lens, and returning to the step of acquiring the current image shot by the objective lens at the current position and converting the current image into a gray image;

an optimal focusing position determining module, configured to, if the first determination result indicates that the current position is the lowest point of the objective lens, obtain a maximum value of all stored current variances as an optimal focusing value, and determine that the current position corresponding to the optimal focusing value is an optimal focusing position;

and the micromanipulation automatic focusing module is used for moving the objective lens to the optimal focusing position to finish the automatic focusing of the microscope.

Optionally, the variance calculation and storage module specifically includes:

a variance calculating unit for adopting a formula according to the gray value of each pixel in the gray imageCalculating a current variance F; where H is a grayscale image height direction pixel value, W is a grayscale image width direction pixel value, i (x, y) is a grayscale value at a grayscale image (x, y) point, and μ is an average grayscale value of the entire grayscale image.

Optionally, the fixed step size is a minimum step size of the microscope driving motor.

According to the specific embodiment provided by the invention, the invention discloses the following technical effects:

the invention provides a microscopic operation automatic focusing method and a microscopic operation automatic focusing system based on variance and a global search strategy, wherein the method comprises the steps of firstly moving an objective lens of a microscope to the highest point; acquiring a current image shot by the objective lens at the current position and converting the current image into a gray image; calculating a current variance according to the gray value of each pixel in the gray image, and correspondingly storing the current variance and the current position; judging whether the current position is the lowest point of the objective lens or not to obtain a first judgment result; if the first judgment result shows that the current position is not the lowest point of the objective lens, the objective lens descends for a fixed step length, and the step of acquiring the current image shot by the objective lens at the current position and converting the current image into a gray image is returned; if the first judgment result is that the current position is the lowest point of the objective lens, acquiring the maximum value of all the stored current variances as the optimal focus value, and determining the current position corresponding to the optimal focus value as the optimal focus position; and moving the objective lens to the optimal focusing position to finish the automatic focusing of the microscope. The microscopic operation automatic focusing method of the invention utilizes variance as the definition evaluation standard, the algorithm design is simple, the calculated amount is relatively small, and the realization is very easy; meanwhile, by combining with a global search strategy, the search efficiency is improved on the premise of ensuring accurate focusing, and the method is simple and easy to realize in programming and relatively high in stability.

Drawings

In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings without inventive exercise.

FIG. 1 is a flow chart of a method for micromanipulation autofocus based on variance and global search strategies as provided by the present invention;

FIG. 2 is a schematic diagram of a global search strategy provided by the present invention;

FIG. 3 is a block diagram of a micromanipulation autofocus system based on variance and global search strategy provided by the present invention.

Detailed Description

The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.

The invention aims to provide a method and a system for automatically focusing micromanipulation based on a variance and a global search strategy, which aim to solve the problems of large calculation amount, time consumption and labor consumption of the existing method for automatically focusing micromanipulation.

In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.

FIG. 1 is a flow chart of a micromanipulation autofocus method based on variance and global search strategy provided by the present invention. Referring to fig. 1, the method for micromanipulation autofocus based on variance and global search strategy provided by the present invention specifically includes:

step 101: the objective of the microscope was moved to the highest point.

The method selects the variance as an image definition evaluation standard, and combines a global search strategy to realize the automatic focusing of the microscopic operation. Wherein the global search strategy is a one-way search strategy that requires passing through each possible objective position, and then determining the objective position in which the maximum focus value F is present is considered to be the best objective position in focus. Therefore, the objective lens of the microscope needs to be moved to the highest point initially, then the objective lens is continuously lowered from the highest position according to a certain step length (set manually), and the variance of the shot image is correspondingly calculated at each position. And after the objective lens traverses each position in a one-way mode, selecting the maximum variance from all the calculated variances as the optimal focusing value, and determining the position corresponding to the optimal focusing value as the optimal focusing position, namely the optimal objective lens position under the focusing condition.

Step 102: and acquiring a current image shot by the objective lens at the current position and converting the current image into a gray image.

The RGB image is also called a true color image, which uses R, G, B three components to identify the color of a pixel, R, G, B represents 3 different basic colors of red, green and blue, respectively, and any color can be synthesized through 3 primary colors, so for a color image of size n × m, it is stored in MAT L AB as a multi-dimensional data array of n × m × 3, where the elements in the array define the red, green and blue of each pixel in the image.

Step 103: and calculating the current variance according to the gray value of each pixel in the gray image, and correspondingly storing the current variance and the current position.

Variance as a statistical-based algorithm, generally less sensitive to noise than derivative-based algorithms, the present method relies on variance to distinguish between in-focus and out-of-focus images.

Before calculating the image variance, the RGB image needs to be converted into a grayscale image, and then the grayscale image needs to be processed. The method calculates the variance under different image gray level meanings, because the clearly focused image has larger gray level difference than the blurred image, the variance function can be used as an evaluation function, and the calculation method is as follows:

wherein H is a pixel value in a height direction of the gray image, W is a pixel value in a width direction of the gray image, i (x, y) is a gray value at a point (x, y) on the gray image, μ is an average gray value of the entire gray image,indicating the sum in the grayscale image Height (Height) and Width (Width) directions, F being the current variance calculated for the grayscale image. The function (1) is sensitive to noise, and the clearer the image picture is, the larger the function value F is. Therefore, the method and the device take the current variance F of the image as an image definition evaluation standard to evaluate the image definition, and take an evaluation result as a guide for global search to search for the optimal focus value.

Step 104: and judging whether the current position is the lowest point of the objective lens or not to obtain a first judgment result.

Fig. 2 is a schematic diagram of a global search strategy provided by the present invention. The global search strategy employed by the present invention is a one-way search strategy that requires passing through each possible objective position, and then the objective position with the largest focus value F is considered to be the objective position in focus. Therefore, each position of the objective lens is traversed by judging whether the current position is the lowest point of the objective lens, if not, the objective lens descends for a fixed step length, and the step of acquiring the current image shot by the objective lens at the current position and converting the current image into a gray image is returned; the fixed step length is preferably the minimum step length of the microscope driving motor; if so, acquiring the maximum value in all the stored current variances as an optimal focus value, and determining the current position corresponding to the optimal focus value as the optimal focus position to realize the automatic focusing of the microscopic operation according to the optimal focus position.

The global search strategy adopted by the invention ensures that the optimal objective position under the minimum stepping distance can be found (the minimum stepping distance refers to the step length which can be set as the minimum step length of a microscope driving motor). In the global search process, the focus value of each possible objective lens position needs to be calculated, i.e. each time the position of the objective lens is changed, the current variance calculation needs to be performed by using the variance image sharpness evaluation algorithm (1).

Step 105: and if the first judgment result shows that the current position is not the lowest point of the objective lens, the objective lens descends for a fixed step length, and the step of acquiring the current image shot by the objective lens at the current position and converting the current image into a gray image is returned.

Step 106: and if the current position is the lowest point of the objective lens according to the first judgment result, acquiring the maximum value of all the stored current variances as an optimal focus value, and determining the current position corresponding to the optimal focus value as the optimal focus position.

Step 107: and moving the objective lens to the optimal focusing position to finish the automatic focusing of the microscope.

The microscopic operation automatic focusing method of the invention utilizes the variance as the definition evaluation standard, combines with the global search strategy, and has higher efficiency on the premise of ensuring more accurate focusing. Moreover, the algorithm is simple in design, relatively small in calculation amount and very easy to implement.

Based on the provided micromanipulation automatic focusing method based on the variance and the global search strategy, the invention also provides a micromanipulation automatic focusing system based on the variance and the global search strategy, referring to fig. 3, the system comprises:

an initial position determining module 301, configured to move an objective lens of the microscope to a highest point;

an image shooting conversion module 302, configured to obtain a current image shot by the objective lens at a current position and convert the current image into a grayscale image;

a variance calculation and storage module 303, configured to calculate a current variance according to a gray value of each pixel in the gray image, and store the current variance and the current position correspondingly;

a position determining module 304, configured to determine whether the current position is the lowest point of the objective lens, so as to obtain a first determination result;

a global search module 305, configured to, if the first determination result indicates that the current position is not the lowest point of the objective lens, lower the objective lens by a fixed step length, and return to the step of acquiring the current image captured by the objective lens at the current position and converting the current image into a grayscale image; the fixed step length is the minimum step length of the microscope driving motor.

An optimal focus position determining module 306, configured to, if the first determination result indicates that the current position is the lowest point of the objective lens, obtain a maximum value of all stored current variances as an optimal focus value, and determine that the current position corresponding to the optimal focus value is an optimal focus position;

a micromanipulation autofocus module 307 for moving the objective lens to the best focus position to complete autofocus of the microscope.

The variance calculation and storage module 303 specifically includes:

a variance calculating unit for adopting a formula according to the gray value of each pixel in the gray imageCalculating a current variance F; where H is a grayscale image height direction pixel value, W is a grayscale image width direction pixel value, i (x, y) is a grayscale value at a grayscale image (x, y) point, and μ is an average grayscale value of the entire grayscale image.

The microscopic operation automatic focusing method and system based on the variance and the global search strategy utilize the variance as the definition evaluation standard, the algorithm design is simple, the calculated amount is relatively small, and the realization is very easy; meanwhile, by combining a global search strategy, the search efficiency is improved on the premise of ensuring accurate focusing, programming is simple and easy to realize, and stability is relatively high.

The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. For the system disclosed by the embodiment, the description is relatively simple because the system corresponds to the method disclosed by the embodiment, and the relevant points can be referred to the method part for description.

The principles and embodiments of the present invention have been described herein using specific examples, which are provided only to help understand the method and the core concept of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, the specific embodiments and the application range may be changed. In view of the above, the present disclosure should not be construed as limiting the invention.

10页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:基于方差结合爬山搜索法的显微操作自动聚焦方法及系统

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!