[go: up one dir, main page]

CN111199536A - A focus evaluation method and device thereof - Google Patents

A focus evaluation method and device thereof Download PDF

Info

Publication number
CN111199536A
CN111199536A CN201911271735.7A CN201911271735A CN111199536A CN 111199536 A CN111199536 A CN 111199536A CN 201911271735 A CN201911271735 A CN 201911271735A CN 111199536 A CN111199536 A CN 111199536A
Authority
CN
China
Prior art keywords
image
grayscale
state
value
cluster
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201911271735.7A
Other languages
Chinese (zh)
Other versions
CN111199536B (en
Inventor
冀高
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Ruiwode Life Technology Co ltd
Original Assignee
Rwd Life Science Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Rwd Life Science Co ltd filed Critical Rwd Life Science Co ltd
Priority to CN201911271735.7A priority Critical patent/CN111199536B/en
Publication of CN111199536A publication Critical patent/CN111199536A/en
Application granted granted Critical
Publication of CN111199536B publication Critical patent/CN111199536B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/23Clustering techniques
    • G06F18/232Non-hierarchical techniques
    • G06F18/2321Non-hierarchical techniques using statistics or function optimisation, e.g. modelling of probability density functions
    • G06F18/23213Non-hierarchical techniques using statistics or function optimisation, e.g. modelling of probability density functions with fixed number of clusters, e.g. K-means clustering
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30168Image quality inspection

Landscapes

  • Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Physics & Mathematics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Probability & Statistics with Applications (AREA)
  • Quality & Reliability (AREA)
  • Artificial Intelligence (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • General Engineering & Computer Science (AREA)
  • Image Processing (AREA)
  • Image Analysis (AREA)
  • Studio Devices (AREA)

Abstract

本发明实施例提供一种聚焦评价方法,包括:根据第一聚焦评价方法确定第一聚焦位置,第一聚焦评价方法通过图像的状态和第一K均值聚类算法评价图像的清晰度;在以第一聚焦位置为中心的预设区间内,根据第二聚焦评价方法确定第二聚焦位置作为最终的聚焦位置,第二聚焦评价方法通过锐化算子和第二K均值聚类算法评价图像的清晰度。本发明实施例在大范围调焦时,根据距离最终的聚焦位置远近不同的图像在清晰度评价上的特征采用不同的聚焦评价方式,提高了图像清晰度评价的准确性。

Figure 201911271735

An embodiment of the present invention provides a focus evaluation method, including: determining a first focus position according to the first focus evaluation method, and the first focus evaluation method evaluates the clarity of the image through the state of the image and the first K-means clustering algorithm; In the preset interval centered on the first focus position, the second focus position is determined as the final focus position according to the second focus evaluation method, and the second focus evaluation method evaluates the image quality by the sharpening operator and the second K-means clustering algorithm. clarity. In the embodiment of the present invention, when focusing in a wide range, different focus evaluation methods are adopted according to the characteristics of images with different distances from the final focus position in sharpness evaluation, thereby improving the accuracy of image sharpness evaluation.

Figure 201911271735

Description

Focus evaluation method and device
Technical Field
The invention relates to the field of image processing, in particular to a focus evaluation method and a focus evaluation device.
Background
The auto-focus process typically includes a focus search process and a focus evaluation process. When the lens group is automatically focused, the lens group is moved to shoot a plurality of images, and then the clearest image is calculated through a focusing evaluation algorithm. The focus evaluation process represented by the focus evaluation algorithm occupies a core position in the automatic focusing process, and is a basis for evaluating whether an image is clear or not.
The traditional focus evaluation algorithm simply utilizes the sharpness value of an image to represent the sharpness, and the higher the sharpness value is, the clearer the image is represented; the definition is also represented by using the information entropy of the image, and the larger the entropy value is, the clearer the image is. Practice proves that when focusing is carried out in a large range, images which are close to and far away from a real focusing position have different characteristics in definition evaluation, and the definition evaluation of the images can be made to be wrong only by adopting a traditional focusing evaluation algorithm in the whole automatic focusing process.
Disclosure of Invention
The embodiment of the invention provides a focusing evaluation method, and aims to solve the problem of misjudgment of image definition evaluation in the prior art.
In a first aspect, a focus evaluation method is provided, including:
determining a first focusing position according to a first focusing evaluation method, wherein the first focusing evaluation method evaluates the definition of an image through the state of the image and a first K-means clustering algorithm;
and determining a second focusing position as a final focusing position according to a second focusing evaluation method in a preset interval with the first focusing position as a center, wherein the second focusing evaluation method evaluates the definition of the image through a sharpening operator and a second K-means clustering algorithm.
In a second aspect, there is provided a focus evaluation apparatus comprising:
the first evaluation unit is used for determining a first focusing position according to a first focusing evaluation method, and the first focusing evaluation method is used for evaluating the definition of an image through the state of the image and a first K-means clustering algorithm;
and the second evaluation unit is used for determining a second focusing position as a final focusing position according to a second focusing evaluation method in a preset interval with the first focusing position as a center, and the second focusing evaluation method is used for evaluating the definition of the image through a sharpening operator and a second K-means clustering algorithm.
When the wide-range focusing is carried out, the first focusing position is determined through the state of the image and the first K-means clustering algorithm, the first focusing position can be called coarse focusing evaluation, then the second focusing position is determined through the sharpening operator and the second K-means clustering algorithm in a preset interval with the first focusing position as the center, the second focusing position is the final focusing position and can be called fine focusing evaluation, different focusing evaluation modes are adopted according to the characteristics of the images which are far away from the final focusing position and are near to the final focusing position in the definition evaluation, and the accuracy of the image definition evaluation is improved.
Drawings
The foregoing and/or additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
FIG. 1 is a flow chart of a focus evaluation method according to an embodiment of the present invention;
FIG. 2 is a flow chart of a first focus evaluation method provided by an embodiment of the invention;
FIG. 3 is a flow chart of a second focus assessment method provided by embodiments of the present invention;
fig. 4 is a block diagram of a focus evaluation apparatus according to a second embodiment of the present invention;
fig. 5 is a block diagram of a first evaluation unit according to an embodiment of the present invention;
fig. 6 is a block diagram of a second evaluation unit according to an embodiment of the present invention.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar modules or modules having the same or similar functionality throughout. The embodiments described below with reference to the accompanying drawings are illustrative only for the purpose of explaining the present invention, and are not to be construed as limiting the present invention. On the contrary, the embodiments of the invention include all changes, modifications and equivalents coming within the spirit and terms of the claims appended hereto.
Optical imaging technology is inseparable from our lives, and relates to optical imaging from cameras, video cameras, telescopes and projectors in daily life, to microscopes and laser speckle imaging systems in laboratories. In optical imaging, a focus evaluation algorithm is an important component. Due to the fact that application scenes are more and more, the demand for a focus evaluation algorithm which is suitable for large-range focusing and high in accuracy is stronger and stronger.
When the wide-range focusing is carried out, the first focusing position is determined through the state of the image and the first K-means clustering algorithm, the first focusing position can be called coarse focusing evaluation, then the second focusing position is determined through the sharpening operator and the second K-means clustering algorithm in a preset interval with the first focusing position as the center, the second focusing position is the final focusing position and can be called fine focusing evaluation, different focusing evaluation modes are adopted according to the characteristics of the images which are far away from the final focusing position and are near to the final focusing position in the definition evaluation, and the accuracy of the image definition evaluation is improved.
Example one
Fig. 1 is a flowchart of a focus evaluation method according to an embodiment of the present invention. As shown in fig. 1, the method includes:
step S101: and determining a first focusing position according to a first focusing evaluation method, wherein the first focusing evaluation method evaluates the definition of the image through the state of the image and a first K-means clustering algorithm.
In an embodiment of the present invention, a first focus position is first determined using a first focus evaluation method, which may also be referred to as a coarse focus evaluation.
As an embodiment of the present invention, a first focus evaluation method is shown in fig. 2, the method including:
step S201: and performing first K-means clustering on the gray values of all pixel points in the gray image to obtain a clustering center of each type.
Briefly, K-means clustering is an iterative solution classifier that focuses data to various cluster centers according to some distance function, dividing the data into K sets of clusters. The number K of cluster sets required and the initial value of each cluster center are set by the user. In the embodiment of the invention, the gray values of all pixel points in the gray image are subjected to first K-means clustering. Wherein K1 is 2, that is, dividing the gray values of all the pixels in the gray image into a first cluster set and a second cluster set; the initial value of the first clustering center of the first clustering set is set as the minimum gray value of all pixel points in the gray image, and the initial value of the second clustering center of the second clustering set is set as the maximum gray value of all pixel points in the gray image, which can also be called as dividing the gray values of all pixel points in the gray image into a low gray value pixel clustering set and a high gray value pixel clustering set.
As an embodiment of the present invention, the first K-means clustering process specifically includes: calculating a modulus of a difference value between the gray value and the first clustering center as a first parameter and a modulus of a difference value between the gray value and the second clustering center as a second parameter for each pixel point; if the first parameter is smaller than the second parameter, the pixel point belongs to a first clustering set, and if the first parameter is larger than the second parameter, the pixel point belongs to a second clustering set; and averaging the first cluster set and the second cluster set to update the first cluster center and the second cluster center respectively.
In the embodiment of the present invention, the first cluster center is Smin, the second cluster center is Smax, and the gray value of each pixel point is S, then the first parameter = abs (S-Smin) and the second parameter = abs (S-Smax), where the first parameter represents the distance from the pixel point to the first cluster center, and the second parameter represents the distance from the pixel point to the second cluster center. If the first parameter is smaller than the second parameter, namely the pixel point is closer to the first clustering center, dividing the pixel point into a first clustering set; and if the first parameter is greater than the second parameter, namely the pixel point is closer to the center of the second cluster, dividing the pixel point into the second cluster set.
After the first cluster set and the second cluster set are divided, the data in the first cluster set and the data in the second cluster set are respectively averaged to be used as a new cluster center. If the difference value of the second clustering centers of two adjacent times is smaller than a set value, the data division tends to be stable, and the clustering process is stopped; otherwise, repeating the steps until the condition of stopping clustering is met.
In the embodiment of the invention, the main operation process is the operation of K-means clustering, and the method has small operation amount and stable performance.
Step S202: and calculating the gray average value of the gray image.
Step S203: and dividing the state of the gray level image according to the average value of the gray levels.
In the embodiment of the invention, the gray level average value G is obtained for the gray level image, and the gray level image is divided into a first state and a second state according to the gray level average value G. The gray average value G is larger than a preset threshold value T, and the first state shows that the gray image is overall brighter; and the gray average value G is smaller than the preset threshold value T, so that the second state is realized, and the gray image is darker as a whole.
Step S204: and evaluating the definition of the gray level image according to the clustering center of each type and the state of the gray level image.
In the embodiment of the invention, if the gray-scale image is bright as a whole and belongs to the first state, the focus evaluation value D = 255-Smin; when the entire gray image is dark, the state is the second state, and the focus evaluation value D = Smax. The larger the focus evaluation value D is, the sharper the representative grayscale image is. When the gray level image is darker as a whole, the larger the center of the second cluster is, namely, the brighter part in the gray level image is, the clearer the gray level image is; when the gray image is overall brighter, the smaller the first clustering center, i.e., the darker the dark portion in the gray image, the clearer the gray image.
If the gray image is not divided according to the illumination degree, only one mode is adopted to calculate the focus evaluation value, a plurality of wave crests exist in a focus evaluation value curve during large-range focusing, and the best focus position may not be searched after the focus search process is combined. In the embodiment of the invention, the gray level image is divided according to the illumination degree, and the focus evaluation value is calculated in different ways according to different illumination degrees, so that the focus evaluation value curve is a single peak in large-range focusing, and the optimal focus position can be accurately searched by combining the focus search process.
In the embodiment of the invention, the gray values of all pixel points in the gray image are subjected to the first K-means clustering, and meanwhile, the definition of the gray image is calculated by selecting a proper clustering set according to the gray mean value of the gray image, so that the accuracy of evaluating the definition of the image is improved in the process of large-range focusing.
Step S102: and determining a second focusing position as a final focusing position according to a second focusing evaluation method in a preset interval with the first focusing position as the center, wherein the second focusing evaluation method evaluates the definition of the image through a sharpening operator and a second K-means clustering algorithm.
The accuracy of the first focus position obtained after the rough focus evaluation is often further improved. In the embodiment of the invention, after the coarse focusing evaluation is finished, the fine focusing evaluation is carried out, and in a preset interval taking the first focusing position as the center, a second focusing position is determined for a plurality of images shot in the preset interval by adopting a second focusing evaluation method. The preset interval is smaller than the search interval at the time of the coarse focus evaluation, and therefore may also be referred to as a fine focus evaluation.
As an embodiment of the present invention, a second focus evaluation method is shown in fig. 3, and includes:
step S301: and calculating to obtain a gradient image of the gray level image by adopting a sharpening operator.
In embodiments of the present invention, the sharpening operator includes, but is not limited to, a Sobel operator, a Roberts operator, a Laplacian operator, or an absolute gradient operator. If the sharpening operator is an absolute gradient operator, aiming at each pixel point, the gray value is v0, the gray values of the four fields are v1, v2, v3 and v4 respectively, the gradient value of the pixel point is Grad = abs (v0-v1) + abs (v0-v2) + abs (v0-v3) + abs (v0-v4), and abs is modulo operation; and for the pixel points on the four edges of the gray image, the gradient value of the pixel points does not have complete four fields and is subjected to zero setting treatment.
Step S302: and performing second K-means clustering on the gradient values of all the pixel points in the gradient image to obtain a clustering center of each type.
In the embodiment of the invention, the gradient values of all the pixel points in the gradient image are subjected to second K-means clustering. Wherein K2 is 2, that is, the gradient values of all the pixel points in the gradient image are divided into a third clustering set and a fourth clustering set; the third clustering center initial value of the third clustering set is the minimum gradient value of all pixel points in the gradient image, and the fourth clustering center initial value of the fourth clustering set is the maximum gradient value of all pixel points in the gradient image, which can also be called as dividing the gradient values of all pixel points in the gradient image into a low gradient value pixel point clustering set and a high gradient value pixel point clustering set.
The process of the second K-means clustering is similar to the process of the first K-means clustering, and is not repeated herein.
In the embodiment of the invention, the main operation processes are convolution operation for solving gradient values and K mean value clustering operation, and the method has small operation amount and stable performance.
Step S303: and evaluating the definition of the gray level image according to the fourth clustering center.
In the embodiment of the present invention, the fourth cluster center is used as the focus evaluation value. The larger the fourth clustering center is, that is, the larger the center of the high gradient value pixel point clustering set in the gradient image is, the clearer the gray level image is.
In the embodiment of the invention, the acquired gray level image is converted into the gradient image in the preset interval, then the pixels in the gradient image are divided by the K-means clustering algorithm, the definition of the gray level image is represented by the center of the high gradient value pixel clustering set, namely the mean value of the high gradient value pixel clustering set, the one-sidedness when the definition of the gray level image is represented by the maximum gradient value is avoided, and the method is suitable for the image definition evaluation near the final focusing position.
When the wide-range focusing is carried out, the first focusing position is determined through the state of the image and the first K-means clustering algorithm, the first focusing position can be called coarse focusing evaluation, then the second focusing position is determined through the sharpening operator and the second K-means clustering algorithm in a preset interval with the first focusing position as the center, the second focusing position is the final focusing position and can be called fine focusing evaluation, different focusing evaluation modes are adopted according to the characteristics of the images which are far away from the final focusing position and are near to the final focusing position in the definition evaluation, and the accuracy of the image definition evaluation is improved.
Example two
Fig. 4 is a block diagram of a focusing evaluation apparatus according to a second embodiment of the present invention, and as shown in fig. 4, the apparatus includes: a first evaluation unit 41 and a second evaluation unit 42.
The first evaluation unit 41 is configured to determine a first focus position according to a first focus evaluation method, which evaluates the sharpness of the image by the state of the image and a first K-means clustering algorithm.
The second evaluation unit 42 is configured to determine, within a preset interval centered on the first focusing position, a second focusing position as a final focusing position according to a second focusing evaluation method, where the second focusing evaluation method evaluates the sharpness of the image through a sharpening operator and a second K-means clustering algorithm.
Preferably, as shown in fig. 5, the first evaluation unit 41 includes: a first clustering subunit 411, a first calculating subunit 412, a state dividing subunit 413, and a first evaluating subunit 414.
The first clustering subunit 411 is configured to perform first K-means clustering on the gray values of all the pixels in the gray image to obtain a clustering center of each class, where K1 is 2, and divide the gray values of all the pixels in the gray image into a first clustering set and a second clustering set, where a first clustering center initial value of the first clustering set is a minimum gray value of all the pixels in the gray image, and a second clustering center initial value of the second clustering set is a maximum gray value of all the pixels in the gray image.
The first calculating subunit 412 is configured to calculate a mean grayscale value of the grayscale image.
The state division unit 413 is used to divide the states of the grayscale image according to the grayscale mean.
The first evaluation subunit 414 is configured to evaluate the sharpness of the grayscale image according to the cluster center of each class and the state of the grayscale image.
Preferably, the state-scoring unit 413 is specifically: and dividing the gray level image into a first state and a second state according to the gray level average value, wherein the first state is the gray level average value greater than a preset threshold value, and the second state is the gray level average value less than the preset threshold value.
Correspondingly, the first evaluation subunit 414 specifically is: if the gray level image is in the first state, the focusing evaluation value is a difference value between 255 and the first clustering center; if the gray scale image is in the second state, the focus evaluation value is the second cluster center.
Preferably, as shown in fig. 6, the second evaluation unit 42 includes: a second calculation subunit 421, a second clustering subunit 422, and a second evaluation subunit 423.
The second calculating subunit 421 is configured to calculate a gradient image of the grayscale image by using a sharpening operator.
The second clustering subunit 422 is configured to perform second K-means clustering on the gradient values of all the pixels in the gradient image to obtain a clustering center of each cluster, where K2 is 2, and divide the gradient values of all the pixels in the gradient image into a third clustering set and a fourth clustering set, where a third clustering center initial value of the third clustering set is a minimum gradient value of all the pixels in the gradient image, and a fourth clustering center initial value of the fourth clustering set is a maximum gradient value of all the pixels in the gradient image.
The second evaluation subunit 423 is configured to evaluate the sharpness of the grayscale image according to the fourth cluster center.
Preferably, the sharpening operator comprises a Sobel operator, a Roberts operator, a Laplacian operator, or an absolute gradient operator.
The focus evaluation method executed in the focus evaluation device corresponds to the method described in the first embodiment one by one, and is not described herein again.
When the wide-range focusing is carried out, the first focusing position is determined through the state of the image and the first K-means clustering algorithm, the first focusing position can be called coarse focusing evaluation, then the second focusing position is determined through the sharpening operator and the second K-means clustering algorithm in a preset interval with the first focusing position as the center, the second focusing position is the final focusing position and can be called fine focusing evaluation, different focusing evaluation modes are adopted according to the characteristics of the images which are far away from the final focusing position and are near to the final focusing position in the definition evaluation, and the accuracy of the image definition evaluation is improved.
While embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are illustrative and not to be construed as limiting the invention, which is within the scope of the invention for one of ordinary skill in the art.

Claims (10)

1.一种聚焦评价方法,其特征在于,所述方法包括:1. A focus evaluation method, characterized in that the method comprises: 根据第一聚焦评价方法确定第一聚焦位置,所述第一聚焦评价方法通过图像的状态和第一K均值聚类算法评价图像的清晰度;The first focus position is determined according to the first focus evaluation method, and the first focus evaluation method evaluates the sharpness of the image through the state of the image and the first K-means clustering algorithm; 在以所述第一聚焦位置为中心的预设区间内,根据第二聚焦评价方法确定第二聚焦位置作为最终的聚焦位置,所述第二聚焦评价方法通过锐化算子和第二K均值聚类算法评价图像的清晰度。Within a preset interval centered on the first focus position, a second focus position is determined as the final focus position according to a second focus evaluation method, which uses a sharpening operator and a second K-means The clustering algorithm evaluates the sharpness of the image. 2.根据权利要求1所述的方法,其特征在于,所述第一聚焦评价方法通过图像的状态和第一K均值聚类算法评价图像的清晰度包括:2. The method according to claim 1, wherein the first focus evaluation method evaluates the sharpness of the image by the state of the image and the first K-means clustering algorithm comprising: 对灰度图像中所有像素点的灰度值进行第一K均值聚类,得到每一类的聚类中心,其中,K1为2,将所述灰度图像中所有像素点的灰度值分为第一聚类集合和第二聚类集合,所述第一聚类集合的第一聚类中心初始值为所述灰度图像中所有像素点的最小灰度值,所述第二聚类集合的第二聚类中心初始值为所述灰度图像中所有像素点的最大灰度值;The first K-means clustering is performed on the grayscale values of all pixels in the grayscale image to obtain the cluster center of each class, where K1 is 2, and the grayscale values of all pixels in the grayscale image are divided into are the first cluster set and the second cluster set, the initial value of the first cluster center of the first cluster set is the minimum gray value of all pixels in the gray image, and the second cluster The initial value of the second cluster center of the set is the maximum gray value of all pixels in the gray image; 计算所述灰度图像的灰度均值;calculating the grayscale mean of the grayscale image; 根据所述灰度均值划分所述灰度图像的状态;Divide the state of the grayscale image according to the grayscale mean; 根据所述每一类的聚类中心和所述灰度图像的状态评价所述灰度图像的清晰度。The sharpness of the grayscale image is evaluated according to the cluster centers of each class and the state of the grayscale image. 3.根据权利要求2所述的方法,其特征在于,3. The method of claim 2, wherein 根据所述灰度均值划分所述灰度图像的状态包括:The state of dividing the grayscale image according to the grayscale mean value includes: 根据所述灰度均值将所述灰度图像划分为第一状态和第二状态,所述灰度均值大于预设阈值为所述第一状态,所述灰度均值小于所述预设阈值为所述第二状态;The grayscale image is divided into a first state and a second state according to the grayscale mean value, the grayscale mean value greater than the preset threshold is the first state, and the grayscale mean value less than the preset threshold value is the second state; 根据所述每一类的聚类中心和所述灰度图像的状态评价所述图像的清晰度包括:Evaluating the sharpness of the image according to the cluster centers of each class and the state of the grayscale image includes: 若所述灰度图像为所述第一状态,聚焦评价值为255与所述第一聚类中心的差值;If the grayscale image is in the first state, the focus evaluation value is the difference between 255 and the first cluster center; 若所述灰度图像为所述第二状态,所述聚焦评价值为所述第二聚类中心。If the grayscale image is in the second state, the focus evaluation value is the second cluster center. 4.根据权利要求1所述的方法,其特征在于,所述第二聚焦评价方法通过锐化算子和第二K均值聚类算法评价图像的清晰度包括:4. The method according to claim 1, wherein the second focus evaluation method evaluates the sharpness of the image by a sharpening operator and the second K-means clustering algorithm comprising: 采用锐化算子计算得到灰度图像的梯度图像;The gradient image of the grayscale image is obtained by calculating the sharpening operator; 对所述梯度图像中所有像素点的梯度值进行第二K均值聚类,得到每一类的聚类中心,其中,K2为2,将所述梯度图像中所有像素点的梯度值分为第三聚类集合和第四聚类集合,所述第三聚类集合的第三聚类中心初始值为所述梯度图像中所有像素点的最小梯度值,所述第四聚类集合的第四聚类中心初始值为所述梯度图像中所有像素点的最大梯度值;The second K-means clustering is performed on the gradient values of all pixels in the gradient image to obtain the cluster center of each class, where K2 is 2, and the gradient values of all pixels in the gradient image are divided into Three cluster sets and a fourth cluster set, the initial value of the third cluster center of the third cluster set is the minimum gradient value of all pixels in the gradient image, and the fourth cluster set of the fourth cluster set The initial value of the cluster center is the maximum gradient value of all pixels in the gradient image; 根据所述第四聚类中心评价所述灰度图像的清晰度。The sharpness of the grayscale image is evaluated according to the fourth cluster center. 5.根据权利要求4所述的方法,其特征在于,所述锐化算子包括Sobel算子、Roberts算子、Laplacian算子或者绝对梯度算子。5. The method according to claim 4, wherein the sharpening operator comprises a Sobel operator, a Roberts operator, a Laplacian operator or an absolute gradient operator. 6.一种聚焦评价装置,其特征在于,所述装置包括:6. A focus evaluation device, characterized in that the device comprises: 第一评价单元,用于根据第一聚焦评价方法确定第一聚焦位置,所述第一聚焦评价方法通过图像的状态和第一K均值聚类算法评价图像的清晰度;a first evaluation unit, configured to determine a first focus position according to a first focus evaluation method, and the first focus evaluation method evaluates the clarity of the image through the state of the image and the first K-means clustering algorithm; 第二评价单元,用于在以所述第一聚焦位置为中心的预设区间内,根据第二聚焦评价方法确定第二聚焦位置作为最终的聚焦位置,所述第二聚焦评价方法通过锐化算子和第二K均值聚类算法评价图像的清晰度。A second evaluation unit, configured to determine a second focus position as a final focus position according to a second focus evaluation method within a preset interval centered on the first focus position, and the second focus evaluation method uses sharpening The operator and the second K-means clustering algorithm evaluate the sharpness of the image. 7.根据权利要求6所述的装置,其特征在于,所述第一评价单元包括:7. The device according to claim 6, wherein the first evaluation unit comprises: 第一聚类子单元,用于对灰度图像中所有像素点的灰度值进行第一K均值聚类,得到每一类的聚类中心,其中,K1为2,将所述灰度图像中所有像素点的灰度值分为第一聚类集合和第二聚类集合,所述第一聚类集合的第一聚类中心初始值为所述灰度图像中所有像素点的最小灰度值,所述第二聚类集合的第二聚类中心初始值为所述灰度图像中所有像素点的最大灰度值;The first clustering subunit is used to perform the first K-means clustering on the grayscale values of all pixel points in the grayscale image to obtain the cluster center of each class, where K1 is 2, and the grayscale image The grayscale values of all pixels in the grayscale image are divided into a first cluster set and a second cluster set, and the initial value of the first cluster center of the first cluster set is the minimum grayscale value of all pixels in the grayscale image. degree value, the initial value of the second cluster center of the second cluster set is the maximum gray value of all pixels in the gray image; 第一计算子单元,用于计算所述灰度图像的灰度均值;a first calculation subunit, used for calculating the grayscale mean value of the grayscale image; 状态划分子单元,用于根据所述灰度均值划分所述灰度图像的状态;a state dividing subunit, configured to divide the state of the grayscale image according to the grayscale mean value; 第一评价子单元,用于根据所述每一类的聚类中心和所述灰度图像的状态评价所述灰度图像的清晰度。The first evaluation subunit is used for evaluating the sharpness of the grayscale image according to the cluster center of each class and the state of the grayscale image. 8.根据权利要求7所述的装置,其特征在于,8. The device of claim 7, wherein 所述状态划分子单元具体为:The state division subunits are specifically: 根据所述灰度均值将所述灰度图像划分为第一状态和第二状态,所述灰度均值大于预设阈值为所述第一状态,所述灰度均值小于所述预设阈值为所述第二状态;The grayscale image is divided into a first state and a second state according to the grayscale mean value, the grayscale mean value greater than the preset threshold is the first state, and the grayscale mean value less than the preset threshold value is the second state; 所述第一评价子单元具体为:The first evaluation subunit is specifically: 若所述灰度图像为所述第一状态,聚焦评价值为255与所述第一聚类中心的差值;If the grayscale image is in the first state, the focus evaluation value is the difference between 255 and the first cluster center; 若所述灰度图像为所述第二状态,所述聚焦评价值为所述第二聚类中心。If the grayscale image is in the second state, the focus evaluation value is the second cluster center. 9.根据权利要求6所述的装置,其特征在于,所述第二评价单元包括:9. The device according to claim 6, wherein the second evaluation unit comprises: 第二计算子单元,用于采用锐化算子计算得到灰度图像的梯度图像;The second calculation subunit is used to calculate the gradient image of the grayscale image by using the sharpening operator; 第二聚类子单元,用于对所述梯度图像中所有像素点的梯度值进行第二K均值聚类,得到每一类的聚类中心,其中,K2为2,将所述梯度图像中所有像素点的梯度值分为第三聚类集合和第四聚类集合,所述第三聚类集合的第三聚类中心初始值为所述梯度图像中所有像素点的最小梯度值,所述第四聚类集合的第四聚类中心初始值为所述梯度图像中所有像素点的最大梯度值;The second clustering subunit is used to perform the second K-means clustering on the gradient values of all the pixel points in the gradient image to obtain the cluster center of each class, where K2 is 2, and the gradient image is divided into The gradient values of all pixels are divided into a third cluster set and a fourth cluster set, and the initial value of the third cluster center of the third cluster set is the minimum gradient value of all pixels in the gradient image, so The initial value of the fourth cluster center of the fourth cluster set is the maximum gradient value of all pixels in the gradient image; 第二评价子单元,用于根据所述第四聚类中心评价所述灰度图像的清晰度。The second evaluation subunit is configured to evaluate the sharpness of the grayscale image according to the fourth cluster center. 10.根据权利要求9所述的装置,其特征在于,所述锐化算子包括Sobel算子、Roberts算子、Laplacian算子或者绝对梯度算子。10. The apparatus according to claim 9, wherein the sharpening operator comprises a Sobel operator, a Roberts operator, a Laplacian operator or an absolute gradient operator.
CN201911271735.7A 2019-12-13 2019-12-13 Focusing evaluation method and device Active CN111199536B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911271735.7A CN111199536B (en) 2019-12-13 2019-12-13 Focusing evaluation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911271735.7A CN111199536B (en) 2019-12-13 2019-12-13 Focusing evaluation method and device

Publications (2)

Publication Number Publication Date
CN111199536A true CN111199536A (en) 2020-05-26
CN111199536B CN111199536B (en) 2023-11-14

Family

ID=70746577

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911271735.7A Active CN111199536B (en) 2019-12-13 2019-12-13 Focusing evaluation method and device

Country Status (1)

Country Link
CN (1) CN111199536B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111932499A (en) * 2020-07-10 2020-11-13 深圳市瑞沃德生命科技有限公司 Method, device and system for calculating cell diameter
CN114663405A (en) * 2022-03-27 2022-06-24 扬州市苏灵农药化工有限公司 Wastewater treatment control method for pesticide production enterprises
CN115835016A (en) * 2022-11-16 2023-03-21 中国科学院新疆理化技术研究所 Radiation-resistant camera open-loop autofocus method, device, equipment and medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101706609A (en) * 2009-11-23 2010-05-12 常州达奇信息科技有限公司 Image processing based fast automatic focusing method of microscope
US20140226004A1 (en) * 2011-09-15 2014-08-14 Intekplus Co., Ltd Method for inspecting flat panel
CN108961201A (en) * 2017-05-19 2018-12-07 广州康昕瑞基因健康科技有限公司 Image definition recognition methods and auto focusing method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101706609A (en) * 2009-11-23 2010-05-12 常州达奇信息科技有限公司 Image processing based fast automatic focusing method of microscope
US20140226004A1 (en) * 2011-09-15 2014-08-14 Intekplus Co., Ltd Method for inspecting flat panel
CN108961201A (en) * 2017-05-19 2018-12-07 广州康昕瑞基因健康科技有限公司 Image definition recognition methods and auto focusing method

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111932499A (en) * 2020-07-10 2020-11-13 深圳市瑞沃德生命科技有限公司 Method, device and system for calculating cell diameter
CN111932499B (en) * 2020-07-10 2023-12-22 深圳市瑞沃德生命科技有限公司 Cell diameter calculation method, device and system
CN114663405A (en) * 2022-03-27 2022-06-24 扬州市苏灵农药化工有限公司 Wastewater treatment control method for pesticide production enterprises
CN115835016A (en) * 2022-11-16 2023-03-21 中国科学院新疆理化技术研究所 Radiation-resistant camera open-loop autofocus method, device, equipment and medium
CN115835016B (en) * 2022-11-16 2024-04-23 中国科学院新疆理化技术研究所 Open-loop type automatic focusing method, device, equipment and medium for radiation-resistant camera

Also Published As

Publication number Publication date
CN111199536B (en) 2023-11-14

Similar Documents

Publication Publication Date Title
US8629915B2 (en) Digital photographing apparatus, method of controlling the same, and computer readable storage medium
US20130100334A1 (en) Method and System for an Adaptive Auto-Focus Algorithm
TWI515470B (en) Multi-lens autofocus system and method thereof
JP5453573B2 (en) Imaging apparatus, imaging method, and program
EP3371741B1 (en) Focus detection
JP2016085637A (en) Data processor, imaging device, and data processing method
WO2012132486A1 (en) Imaging device, imaging method, program, and program storage medium
CN114868377B (en) image fusion
CN111161221B (en) Focusing evaluation method, device and system
JP2009103800A (en) Autofocus device and method, and program
CN111199536B (en) Focusing evaluation method and device
CN114845042A (en) Camera automatic focusing method based on image information entropy
CN104205800B (en) camera equipment
CN105845534B (en) The auto focusing method of electron microscope
CN106981065B (en) A kind of image Absolute Central Moment innovatory algorithm based on exposure compensating
JP2015207090A (en) Image processing apparatus and control method thereof
TWI515471B (en) Auto-focus system for multiple lens and method thereof
CN110619616B (en) Image processing method, device and related equipment
CN114943648A (en) Image processing method, device and system, training method and device, and storage medium
Wang et al. Intelligent autofocus
CN105022138B (en) Automatic focusing system using multiple lenses and method thereof
JP5900049B2 (en) Depth of field expansion system and depth of field expansion method
CN113055584B (en) Focusing method based on fuzzy degree, lens controller and camera module
US11115582B2 (en) Imaging control apparatus, imaging apparatus, and recording medium
EP2621161A2 (en) Method and system for an adaptive auto-focus algorithm

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 518057 room 1901, block a, building 9, area C, Wanke Yuncheng phase III, Liuxin 4th Road, Xili community, Xili street, Nanshan District, Shenzhen City, Guangdong Province

Applicant after: RWD LIFE SCIENCE Co.,Ltd.

Address before: 518057 201, Beiter building, No.11, North 4th Road, Gaoxin, songpingshan community, Xili street, Nanshan District, Shenzhen City, Guangdong Province

Applicant before: RWD LIFE SCIENCE Co.,Ltd.

GR01 Patent grant
GR01 Patent grant
CP03 Change of name, title or address
CP03 Change of name, title or address

Address after: 518057, Room 1901, Building A, Building 7, Shenzhen International Innovation Valley, Dashi Road, Xili Community, Xili Street, Nanshan District, Shenzhen City, Guangdong Province (9th, 19th, 20th, and 9th floors of Building A)

Patentee after: Shenzhen Ruiwode Life Technology Co.,Ltd.

Country or region after: China

Address before: 518057 room 1901, block a, building 9, area C, Wanke Yuncheng phase III, Liuxin 4th Road, Xili community, Xili street, Nanshan District, Shenzhen City, Guangdong Province

Patentee before: RWD LIFE SCIENCE Co.,Ltd.

Country or region before: China