CN105243660B - A kind of quality evaluating method of the auto-focusing image containing light source scene - Google Patents
A kind of quality evaluating method of the auto-focusing image containing light source scene Download PDFInfo
- Publication number
- CN105243660B CN105243660B CN201510589904.7A CN201510589904A CN105243660B CN 105243660 B CN105243660 B CN 105243660B CN 201510589904 A CN201510589904 A CN 201510589904A CN 105243660 B CN105243660 B CN 105243660B
- Authority
- CN
- China
- Prior art keywords
- mrow
- light source
- focus
- gradient
- image
- 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.)
- Expired - Fee Related
Links
- 238000000034 method Methods 0.000 title claims abstract description 28
- 229920006395 saturated elastomer Polymers 0.000 claims abstract description 32
- 238000011156 evaluation Methods 0.000 claims abstract description 25
- 239000011159 matrix material Substances 0.000 claims abstract description 19
- 230000000877 morphologic effect Effects 0.000 claims description 3
- 230000035945 sensitivity Effects 0.000 abstract description 4
- 238000010586 diagram Methods 0.000 description 6
- 238000004364 calculation method Methods 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000003384 imaging method Methods 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 230000003595 spectral effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/0002—Inspection of images, e.g. flaw detection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/30—Subject of image; Context of image processing
- G06T2207/30168—Image quality inspection
Landscapes
- Engineering & Computer Science (AREA)
- Quality & Reliability (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Image Processing (AREA)
- Automatic Focus Adjustment (AREA)
Abstract
本发明公开了一种含有光源场景的自动对焦图像的质量评价方法,该方法采用饱和像素模板作用于梯度值矩阵的方法,去除了饱和像素对自动对焦评价函数的影响,得到了去除饱和像素的评价函数,对于夜景中光源以及过亮场景,去除饱和像素的评价函数具有良好的无偏性、单峰性、灵敏性、稳定性。
The invention discloses a method for evaluating the quality of an auto-focus image containing a light source scene. The method uses a saturated pixel template to act on a gradient value matrix, removes the influence of saturated pixels on the auto-focus evaluation function, and obtains the method of removing saturated pixels. The evaluation function, for the light source and overbright scene in the night scene, the evaluation function for removing saturated pixels has good unbiasedness, unimodality, sensitivity, and stability.
Description
技术领域technical field
本发明涉及一种含有光源场景的自动对焦图像的质量评价方法。The invention relates to a method for evaluating the quality of an automatic focus image of a scene containing a light source.
背景技术Background technique
随着数字图像和多媒体技术的快速发展,基于图像处理的自动对焦方法也越来越多地受到人们的关注。图像处理方法主要包括以下三个方面,分别为:对焦窗口的选择,对焦评价函数的选择,以及对焦搜索策略的选取。这种自动对焦方法是利用某种数字图像处理算法,获取图像清晰度特征值,并根据这一特征值控制电机,以驱动镜片或者图像传感器改变位置,做相应的调整,直到这一特征值满足某一预先约定的条件为止。而此过程中的关键问题则在于如何选取合适的对焦评价函数。With the rapid development of digital image and multimedia technology, more and more people pay attention to the automatic focus method based on image processing. The image processing method mainly includes the following three aspects, which are: the selection of the focus window, the selection of the focus evaluation function, and the selection of the focus search strategy. This autofocus method is to use a certain digital image processing algorithm to obtain the characteristic value of image clarity, and control the motor according to this characteristic value to drive the lens or image sensor to change the position and make corresponding adjustments until the characteristic value is satisfied. to a pre-agreed condition. The key issue in this process is how to choose an appropriate focus evaluation function.
理想的对焦评价函数应该具有无偏性、单峰性、灵敏性、稳定性。由于对焦评价函数的重要性,图像清晰度的评价已成为一个热门的研究领域,目前常见的图像清晰度评价函数主要包括能量方差法,能量梯度法,熵函数法,频谱函数法,拉普拉斯能量法等。其中最为常用的为基于梯度的评价方法,其依据模糊图像边缘信息较模糊,而清晰图像的边缘较锐利并且信息明显细节丰富的原理,来判断图像的模糊程度。An ideal focus evaluation function should be unbiased, unimodal, sensitive, and stable. Due to the importance of the focus evaluation function, the evaluation of image sharpness has become a hot research field. At present, the common image sharpness evaluation functions mainly include energy variance method, energy gradient method, entropy function method, spectral function method, Lapla Adams energy method, etc. The most commonly used method is the evaluation method based on the gradient, which judges the degree of blurring of the image based on the principle that the edge information of the blurred image is blurred, while the edge of the clear image is sharper and the information is obviously rich in details.
对于夜景的拍摄而言,景物在夜晚下光的反差会比较强烈,同时夜景中难免会存在灯光,甚至有时候我们的拍摄主体恰恰是灯光,然而由于相机传感器动态范围的限制,当探测器像元所接收的光子数超出了最大的容纳强度范围时便会饱和从而引起该像素处的光强度在最大输出值处被截断,这种像素我们称之为饱和像素。在自动对焦过程中,景物从准焦到离焦,饱和像素会随着离焦程度的变大而产生弥散。以一点光源为例,当准焦时,对于理想的成像系统其像点应该为一点像,然而所成像的光强度,并非该光源的真实光强度,而是饱和了的像素,对于离焦情况,该点光源会发生一定程度的弥散,而此时弥散的周边像素仍是饱和像素,形成一个均由饱和像素构成的弥散圆,反映在所获得的图像上面是一个亮度同样大的亮斑,与真实的场景相去甚远,仅依据现有的自动对焦评价函数是无法准确地评价其模糊程度的。因此对于夜景或灯光场景而言,找到适合饱和像素的自动对焦评价函数是自动对焦的关键问题。For night scene shooting, the light contrast of the scene at night will be relatively strong. At the same time, there will inevitably be lights in the night scene, and sometimes our subject is just the light. However, due to the limitation of the dynamic range of the camera sensor, when the detector image When the number of photons received by the element exceeds the maximum intensity range, it will be saturated, causing the light intensity at the pixel to be truncated at the maximum output value. We call this pixel a saturated pixel. During the autofocus process, when the scene is in-focus to out-of-focus, the saturated pixels will scatter as the degree of defocus becomes larger. Taking a point light source as an example, when it is in focus, its image point should be a point image for an ideal imaging system. However, the imaged light intensity is not the real light intensity of the light source, but a saturated pixel. For the out-of-focus situation , the point light source will be diffused to a certain extent, and the diffused surrounding pixels are still saturated pixels at this time, forming a diffused circle composed of saturated pixels, which is reflected in the obtained image as a bright spot with the same brightness. It is far from the real scene, and it is impossible to accurately evaluate the blur degree only based on the existing auto-focus evaluation function. Therefore, for night scenes or lighting scenes, finding an autofocus evaluation function suitable for saturated pixels is a key issue in autofocus.
发明内容Contents of the invention
本发明的目的在于针对目前夜景自动对焦存在的问题,提出一种含有光源场景的自动对焦图像的质量评价方法。The purpose of the present invention is to propose a method for evaluating the quality of auto-focus images of scenes containing light sources, aiming at the problems existing in the auto-focus of night scenes at present.
本发明的目的是通过以下技术方案实现的:一种含有光源场景的自动对焦图像的质量评价方法,该方法包括以下步骤:The object of the present invention is achieved by the following technical solutions: a method for evaluating the quality of an autofocus image containing a light source scene, the method comprising the following steps:
(1)在含有光源场景的自动对焦图像I中任意选择一个含有光源的对焦窗口Ic,采用梯度绝对值算子计算对焦窗口Ic中每个像素处的梯度值,组成对焦窗口的梯度值矩阵G;(1) Randomly select a focus window I c containing a light source in the auto-focus image I containing a light source scene, and use the gradient absolute value operator to calculate the gradient value at each pixel in the focus window I c to form the gradient value of the focus window matrix G;
(2)对Ic的灰度值进行归一化处理,并通过阈值T进行二值化处理,得到二值图M,提取出饱和像素区域模板BIc:(2) Normalize the gray value of Ic , and perform binarization through the threshold T to obtain the binary image M, and extract the saturated pixel area template BIc :
BIc=(Ic>T) (1)BI c =(I c >T) (1)
(3)利用形态学膨胀手段对饱和像素区域模板BIc进行扩展,得到饱和像素扩展区域模板BIc',扩展后的二值图为M';(3) Expand the template BI c of the saturated pixel area by means of morphological expansion to obtain the expanded area template BI c ' of the saturated pixel, and the expanded binary image is M';
其中,Rid是R×R的结构元素;是膨胀操作,M为二值化的饱和像素扩展区域模板;Among them, Rid is a structural element of R×R; is an expansion operation, and M is a binarized saturated pixel expansion region template;
(4)对扩展后的二值图M'进行取反操作,得到取反后的二值图并计算二值图中,像素值为1的像素个数N;(4) Invert the expanded binary image M' to obtain the inverted binary image and calculate the binary map , the number N of pixels with a pixel value of 1;
(5)将二值图作用于对焦窗口的梯度值矩阵G,得到非饱和像素处的梯度信息矩阵W:(5) Binary image Act on the gradient value matrix G of the focus window to obtain the gradient information matrix W at the unsaturated pixels:
(6)计算非饱和像素处的梯度信息矩阵W的所有梯度元素值之和Sw,获得最终去除饱和像素的清晰度评价函数指标Metric:(6) Calculate the sum S w of all gradient element values of the gradient information matrix W at the unsaturated pixel, and obtain the final definition evaluation function index Metric for desaturated pixels:
Metic=Sw/N(5)Metic=S w /N(5)
其中,i、j分别为W模板中的行和列,W(i,j)为梯度信息矩阵W中第i行第j列处的梯度值,a和b分别为对焦窗口Ic的长和宽。Among them, i and j are the rows and columns in the W template respectively, W(i, j) is the gradient value at the i-th row and j-th column in the gradient information matrix W, a and b are the length and length of the focus window I c width.
进一步地,所述步骤2中的阈值T=0.6~0.8。Further, the threshold T in the step 2 is 0.6-0.8.
进一步地,所述步骤3中的R为3。Further, R in the step 3 is 3.
本发明的有益效果在于:本发明采用饱和像素模板作用于梯度值矩阵,去除了饱和像素对自动对焦评价函数的影响,对于夜景中光源以及过亮场景,具有良好的无偏性、单峰性、灵敏性、稳定性。The beneficial effect of the present invention is that: the present invention uses the saturated pixel template to act on the gradient value matrix, removes the influence of saturated pixels on the autofocus evaluation function, and has good unbiasedness and unimodality for light sources and overbright scenes in night scenes , sensitivity, stability.
附图说明Description of drawings
图1为发明方法的流程框图;Fig. 1 is the flowchart of inventive method;
图2为一组实拍离焦序列图中任选5幅的示意图;Fig. 2 is a schematic diagram of a group of real-shot out-of-focus sequences of 5 optional frames;
图3为准焦位置处的实拍场景图;FIG. 3 is a real-shot scene diagram at a quasi-focus position;
图4为准焦位置处实拍场景图的对焦窗口区域;Fig. 4 is the focus window area of the real shot scene graph at the quasi-focus position;
图5为饱和像素区域示意图;FIG. 5 is a schematic diagram of a saturated pixel area;
图6为饱和像素扩展区域模板;Fig. 6 is a saturated pixel expansion area template;
图7为离焦序列的评价函数曲线。Fig. 7 is the evaluation function curve of the defocus sequence.
具体实施方式detailed description
本发明一种针对含饱和像素区域的自动对焦评价函数,该函数采用饱和像素模板作用于梯度值矩阵的方法,去除了饱和像素对自动对焦评价函数的影响,具有良好的无偏性、单峰性、灵敏性、稳定性。The present invention is an auto-focus evaluation function for an area containing saturated pixels. The function adopts a method of using a saturated pixel template to act on the gradient value matrix, and removes the influence of saturated pixels on the auto-focus evaluation function, and has good unbiasedness and single peak. performance, sensitivity, and stability.
下面结合附图和实例进行详细说明:Describe in detail below in conjunction with accompanying drawing and example:
图1为本发明方法的简易流程框图。本实施例以一组步数为42的实拍图像为例,图2为在42幅中随意选取5幅实拍图像及本实施例中所选取的对焦窗口区域的离焦序列示意图,其中(a)-(e)分别为电机在第1步、第11步、第21步、第31步、第41步位置处所获取的图片,第3个位置为准焦位置的清晰图像,图3为准焦位置处(本示例为第3个位置)的实际场景图,图4为准焦位置的对焦窗口图。图7为这组实拍图的采集过程为将马达从最近端以固定步距驱动至最远端,从而通过计算对焦窗口的评价函数值绘制出图7所示的评价函数曲线。本发明方法的评价函数曲线计算步骤如下:Fig. 1 is a simplified flowchart of the method of the present invention. In this embodiment, a group of real-shot images with a number of steps of 42 is taken as an example. FIG. 2 is a schematic diagram of a defocus sequence of 5 real-shot images randomly selected from among the 42 pieces and the focus window area selected in this embodiment, where ( a)-(e) are the pictures obtained by the motor at the 1st step, 11th step, 21st step, 31st step, and 41st step, respectively, and the third position is the clear image of the quasi-focus position. Figure 3 is The actual scene diagram at the in-focus position (the third position in this example), and Figure 4 is the focus window diagram of the in-focus position. Figure 7 shows the acquisition process of this group of real shots. The motor is driven from the nearest end to the farthest end with a fixed step, so that the evaluation function curve shown in Figure 7 is drawn by calculating the evaluation function value of the focus window. The evaluation function curve calculation steps of the inventive method are as follows:
(1)在图3所示的含有光源场景的自动对焦图像I中选择一个200×200的含有光源的对焦窗口Ic,如图4所示,采用梯度绝对值算子计算对焦窗口Ic中每个像素处的梯度值,组成对焦窗口的梯度值矩阵G;(1) Select a 200×200 focus window Ic containing a light source in the auto-focus image I shown in Figure 3 containing a light source, as shown in Figure 4, use the gradient absolute value operator to calculate the focus window Ic The gradient value at each pixel forms the gradient value matrix G of the focus window;
(2)对Ic的灰度值进行归一化处理,并通过阈值T进行二值化处理,得到二值图M,提取出饱和像素区域模板BIc:(2) Normalize the gray value of Ic , and perform binarization through the threshold T to obtain the binary image M, and extract the saturated pixel area template BIc :
BIc=(Ic>T) (1)BIc=(Ic>T) (1)
其中BIc体现了饱和像素所在区域,如图5所示,其中白色区域即为饱和像素区域;Where BI c reflects the area where the saturated pixel is located, as shown in Figure 5, where the white area is the saturated pixel area;
(3)利用形态学膨胀手段对饱和像素区域模板BIc进行扩展,得到饱和像素扩展区域模板BIc',扩展后的二值图为M';(3) Expand the template BI c of the saturated pixel area by means of morphological expansion to obtain the expanded area template BI c ' of the saturated pixel, and the expanded binary image is M';
其中,Rid是R×R的结构元素;是膨胀操作,M为二值化的饱和像素扩展区域模板,如图6所示;Among them, Rid is a structural element of R×R; is an expansion operation, and M is a binarized saturated pixel expansion region template, as shown in Figure 6;
(4)对扩展后的二值图M'进行取反操作,得到取反后的二值图并计算二值图中,像素值为1的像素个数N;(4) Invert the expanded binary image M' to obtain the inverted binary image and calculate the binary map , the number N of pixels with a pixel value of 1;
(5)将二值图作用于对焦窗口的梯度值矩阵G,得到非饱和像素处的梯度信息矩阵W:(5) Binary image Act on the gradient value matrix G of the focus window to obtain the gradient information matrix W at the unsaturated pixels:
W为非饱和像素处的梯度信息矩阵,即去除了饱和像素的影响;W is the gradient information matrix at unsaturated pixels, that is, the influence of saturated pixels is removed;
(6)计算非饱和像素处的梯度信息矩阵W的所有梯度元素值之和Sw,获得最终去除饱和像素的清晰度评价函数指标Metric:(6) Calculate the sum S w of all gradient element values of the gradient information matrix W at the unsaturated pixel, and obtain the final definition evaluation function index Metric for desaturated pixels:
Metic=Sw/N (5)Metic=Sw/N (5)
其中,i、j分别为W模板中的行和列,W(i,j)为梯度信息矩阵W中第i行第j列处的梯度值,a和b分别为对焦窗口Ic的长和宽。Among them, i and j are the rows and columns in the W template respectively, W(i, j) is the gradient value at the i-th row and j-th column in the gradient information matrix W, a and b are the length and length of the focus window I c width.
重复上述步骤对获取的42幅离焦序列图进行清晰度评价计算,并得到该组离焦序列对焦窗口的评价函数曲线,如图7所示。由此可以看出,本发明的评价方法具有良好的无偏性、单峰性、灵敏性、稳定性。Repeat the above steps to perform sharpness evaluation calculations on the 42 obtained defocus sequence images, and obtain the evaluation function curve of the focus window of the group of defocus sequences, as shown in Figure 7. It can be seen from this that the evaluation method of the present invention has good unbiasedness, unimodality, sensitivity and stability.
Claims (3)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510589904.7A CN105243660B (en) | 2015-09-16 | 2015-09-16 | A kind of quality evaluating method of the auto-focusing image containing light source scene |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510589904.7A CN105243660B (en) | 2015-09-16 | 2015-09-16 | A kind of quality evaluating method of the auto-focusing image containing light source scene |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105243660A CN105243660A (en) | 2016-01-13 |
CN105243660B true CN105243660B (en) | 2017-10-31 |
Family
ID=55041292
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510589904.7A Expired - Fee Related CN105243660B (en) | 2015-09-16 | 2015-09-16 | A kind of quality evaluating method of the auto-focusing image containing light source scene |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105243660B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106023190B (en) * | 2016-05-16 | 2019-05-07 | 浙江大学 | A method for evaluating the focus degree of autofocus images |
CN107170002B (en) * | 2017-05-04 | 2020-07-21 | 中国科学院微电子研究所 | Automatic image focusing method and device |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2009140160A (en) * | 2007-12-05 | 2009-06-25 | Nissin Electric Co Ltd | Vehicle number reading device |
CN102780847A (en) * | 2012-08-14 | 2012-11-14 | 北京汉邦高科数字技术股份有限公司 | Camera automatic focusing control method focused on moving target |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
RU2616158C2 (en) * | 2011-04-28 | 2017-04-12 | Конинклейке Филипс Н.В. | Apparatuses and methods for hdr image encoding and decoding |
-
2015
- 2015-09-16 CN CN201510589904.7A patent/CN105243660B/en not_active Expired - Fee Related
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2009140160A (en) * | 2007-12-05 | 2009-06-25 | Nissin Electric Co Ltd | Vehicle number reading device |
CN102780847A (en) * | 2012-08-14 | 2012-11-14 | 北京汉邦高科数字技术股份有限公司 | Camera automatic focusing control method focused on moving target |
Non-Patent Citations (2)
Title |
---|
基于梯度阈值计数的清晰度评价算法;张宏飞 等;《科学技术与工程》;20131231;第13卷(第34期);第10364-10368页 * |
稀疏图像内容情况下显微镜自动聚焦算法;翟永平 等;《软件学报》;20120531;第23卷(第5期);第1283-1287页第1节、第2.1节 * |
Also Published As
Publication number | Publication date |
---|---|
CN105243660A (en) | 2016-01-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109714519B (en) | Method and system for automatically adjusting image frame | |
US9253375B2 (en) | Camera obstruction detection | |
CN112203012B (en) | Image definition calculation method, automatic focusing method and system | |
KR101412752B1 (en) | Digital autofocus image generating apparatus and method | |
US8885091B2 (en) | Imaging device and distance information detecting method | |
US10389936B2 (en) | Focus stacking of captured images | |
TWI436142B (en) | Method and apparatus for auto-focusing in image sensor | |
CN103327245B (en) | A kind of Atomatic focusing method of infrared imaging system | |
CN107292830B (en) | Low-illumination image enhancement and evaluation method | |
TWI413846B (en) | Continuous focus method of digital camera | |
KR20090028255A (en) | Method and device for automatic focusing of image acquisition device | |
JP6548437B2 (en) | Focusing apparatus, control method therefor, control program, and imaging apparatus | |
JP2004037733A (en) | Automatic focusing device | |
CN105430277B (en) | Autofocus control method and device | |
CN102959942A (en) | Image capture device for stereoscopic viewing-use and control method of same | |
CN104184935A (en) | Image shooting device and method | |
CN105845534B (en) | The auto focusing method of electron microscope | |
CN117201937A (en) | Quick high-precision camera focusing method | |
CN105243660B (en) | A kind of quality evaluating method of the auto-focusing image containing light source scene | |
CN106506946A (en) | A camera automatic focusing method and camera | |
KR100764436B1 (en) | How to compare the sharpness of each color channel of an image for autofocusing | |
US9094581B2 (en) | Imaging device and distance information detecting method | |
JP2019016975A (en) | Image processing system and image processing method, imaging apparatus, program | |
KR20110035512A (en) | Auto Focus Method | |
Wang et al. | Intelligent autofocus |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20171031 Termination date: 20190916 |