-
摘要
针对基于显微镜的自动对焦系统,本文提出了一种爬山搜索法和函数逼近法相结合的混合搜索算法。该算法中的爬山搜索法采用粗精结合的两段式算法。在粗略对焦时,大步距选用速度较快的灰度方差函数;当精细对焦时,小步距采用灵敏度较高的Laplacian函数;通过比较三幅图片来缩小对焦区间并且在该区间内采用函数逼近法来拟合出最佳对焦位置。该方法不仅大大减少了自动对焦所需要的图片数量,而且可以大幅度提高搜索精度。经实验验证,提出的新的搜索算法可以使搜索精度优于1 μm。
Abstract
For autofocus system of the microscope, this paper presents a hybrid search algorithm combining the mountain-climb search strategy with the approximation function strategy. In this algorithm, the mountain-climb search strategy adopts the two-stage algorithm of rough and fine focusing stage. In the rough focusing stage, the gray variance function is used to approach the focusing position quickly. In the fine focusing stage, the Laplacian function is used to locate the focusing position accurately. The algorithm narrows the focus interval by comparing three pictures and the approximation function strategy is used to fit the best focus in this range. This method greatly reduces the number of images required for autofocus and greatly improves the search accuracy. The experimental results indicate that this algorithm can make the search accuracy better than 1 μm.
-
Overview
Abstract: Auto-focusing is one of the key technologies in the area of robot vision, digital imaging systems and precision optical instrument. With the continuous development of science and technology and improved application demands, it is more and more urgent to develop an auto-focusing with high precision, fast speed and good stability. While the existing auto-focusing techniques can’t meet the above requirements, a further study on auto-focusing makes a very important practical significance. The depth from defocus method and the depth from focus method are two typical passive auto-focusing methods of autofocus method based on digital image processing. The depth from defocus method is popularly used in depth estimation and scene reconstruction, which can measure the position of samples by just a few images. Therefore, the efficiency of the method is high. However, the accuracy of the depth from defocus method is relatively low because the small number of images is collected by the method. The depth from focus methods are based on the fact that the image formed by an optical system is focused at a particular distance whereas objects at other distances are blurred or defocused. Very high accuracy can be achieved by depth from focus methods. In order to achieve efficient autofocusing, several commonly used search algorithms are studied, and a new low-computational search algorithm is presented, which combines the mountain-climb search strategy with the approximation function strategy to realize the hybrid search algorithm accurate and efficient autofocus. In this algorithm, the mountain-climb search strategy adopts the two-stage algorithm of rough and fine focusing stage. In the rough focusing stage, the large step distance takes into account the fastness of the algorithm, and the gray variance function is used to approach the focusing position quickly. In the fine focusing stage, the small step distance takes into account the sensitivity of the algorithm and the Laplacian function is used to locate the focusing position accurately. The algorithm narrows the focus interval by comparing three pictures and in the range uses the approximation function strategy to fit the best focus position. This method makes greatly improve the search accuracy. The experimental results indicate that this the algorithm can make the search accuracy better than 1 μm. And the method only needs to capture 17 pictures, reducing the number of image acquisition and evaluation. As a result, the time of the autofocus system is shortened and the search efficiency of the algorithm is improved.
-
-
图 6 两种不同样品及其图像. (a)电路板. (b)对焦图像. (c)离焦图像. (d)南瓜茎纵切标本. (e)对焦图像. (f)离焦图像.
Figure 6. Two different samples and their images. (a) The PCB circuit board. (b) The focus image of PCB. (c) The defocus image of PCB. (d) The longitudinal specimens of pumpkin stem. (e) The focus image of longitudinal specimens of pumpkin stem. (f) The focus image of longitudinal specimens of pumpkin stem.
表 1 PCB粗略对焦时采用灰度方差函数得到的清晰度评价函数值.
Table 1. The value of the sharpness evaluation function obtained by gray variance function in the rough focusing stage of PCB.
图片数量 1 2 3 4 5 6 7 8 9 10 镜头位置/μm -200 -160 -120 -80 -40 0 40 80 120 160 实验一 39.455 40.782 42.123 43.589 45.332 46.776 43.866 41.455 40.481 39.246 实验二 39.054 40.120 41.428 42.839 44.448 46.477 45.682 42.048 41.043 39.847 实验三 39.253 40.383 41.892 43.132 45.002 46.572 43.465 41.143 40.218 39.198 表 2 南瓜茎纵切标本粗略对焦时采用灰度方差函数得到的清晰度评价函数值.
Table 2. The value of the sharpness evaluation function obtained by gray variance function in the rough focusing stage of the longitudinal specimens of pumpkin stem.
图片数量 1 2 3 4 5 6 7 8 9 10 镜头位置/μm -200 -160 -120 -80 -40 0 40 80 120 160 实验一 16.88 16.895 17.298 17.898 19.114 19.486 18.214 17.651 17.323 17.273 实验二 16.882 16.906 17.191 17.747 18.727 19.729 18.445 17.794 17.467 17.277 实验三 16.883 16.907 17.187 17.744 18.692 19.723 18.446 17.796 17.488 17.231 表 3 PCB精细对焦时采用Laplacian函数得到的清晰度评价函数值.
Table 3. The value of the sharpness evaluation function obtained by Laplacian function in the fine focusing stage of PCB.
图片数量 11 12 13 14 15 16 镜头位置/μm 27 14 1 -12 -25 -38 实验一 12127.2 16181 16863 16760 13575 9763.1 实验二 10105 16883 17910 15755 11636 7899.2 实验三 9602.1 14585 17868 16300 12925 8063.9 表 4 南瓜茎纵切标本精细对焦时采用Laplacian函数得到的清晰度评价函数值.
Table 4. The value of the sharpness evaluation function obtained by Laplacian function in the fine focusing stage of the longitudinal specimens of pumpkin stem.
图片数量 11 12 13 14 15 16 镜头位置/μm 27 14 1 -12 -25 -38 实验一 30652 39865 42824 37756 27673 25517 实验二 26676 35137 42553 39014 33233 26619 实验三 31156 38861 42372 37646 28073 26095 表 5 PCB曲线拟合阶段采用Laplacian函数得到的清晰度评价函数值.
Table 5. The value of the sharpness evaluation function obtained by Laplacian function in the curve fitting stage of PCB.
图片数量 17 18 19 20 21 22 镜头位置/μm -8 -4 0 4 8 12 实验一 15682 16329 16813 17490 17670 17311 实验二 16715 17963 18111 17915 17210 17188 实验三 16759 16833 17869 17534 17524 14821 表 7 用爬山搜索法继续采集7幅PCB电路板图像的清晰度评价函数值.
Table 7. The evaluation function values of the seven PCB circuit board images collected by the mountain climbing method.
图片数量 23 24 25 26 27 28 29 镜头位置/μm 11 10 9 8 7 6 5 实验一 17416 17577 17641 17670 17675 17593 17504 图片数量 23 24 25 26 27 28 29 镜头位置/μm 3 2 1 0 -1 -2 -3 实验二 17947 18020 18232 18111 18079 18043 18006 实验三 17624 17776 17868 17869 17792 17633 16848 表 8 南瓜茎纵切标本曲线拟合阶段采用Laplacian函数得到的清晰度评价函数值.
Table 8. The value of the sharpness evaluation function obtained by Laplacian function in the curve fitting stage of the longitudinal specimens of pumpkin stem.
图片数量 17 18 19 20 21 22 镜头位置/μm -8 -4 0 4 8 12 实验一 36674 37823 42724 41014 40882 40046 实验二 40078 41103 42779 42264 40189 39379 实验三 38332 38638 43099 41725 40622 39075 表 9 用爬山搜索法继续采集7幅标本图像的清晰度评价函数值.
Table 9. The evaluation function values of the seven specimen images collected by the mountain climbing method.
图片数量 23 24 25 26 27 28 29 镜头位置/μm 3 2 1 0 -1 -2 -3 实验一 40599 42836 42987 42724 39051 38775 38250 实验二 42264 42444 42553 42779 42641 42499 41776 实验三 41805 42372 43360 43099 39818 39452 39039 表 10 传统爬山搜索法和混合搜索法的比较.
Table 10. Comparison between the traditional mountain-climb search strategy with the proposed hybrid search strategy.
对焦过程 传统的爬山搜索法 混合搜索法 采集图像 23 17 改变方向次数 4 3 总时间/s 4.398 2.587 -
参考文献
[1] Yazdanfar S, Kenny K B, Tasimi K, et al. Simple and robust image-based autofocusing for digital microscopy[J]. Optics Express, 2008, 16(12): 8670–8677. doi: 10.1364/OE.16.008670
[2] Han J W, Kim J H, Lee H T, et al. A novel training based au-to-focus for mobile-phone cameras[J]. IEEE Transactions on Consumer Electronics, 2011, 57(1): 232–238. doi: 10.1109/TCE.2011.5735507
[3] Park B K, Kim S S, Chung D S, et al. Fast and accurate auto focusing algorithm based on two defocused images using discrete cosine transform[J]. Proceedings of SPIE, 2008, 6817: 68170D. https://www.researchgate.net/publication/252969631_Fast_and_accurate_auto_focusing_algorithm_based_on_two_defocused_images_using_discrete_cosine_transform
[4] Subbarao M, Surya G. Depth from defocus: a spatial domain approach[J]. International Journal of Computer Vision, 1994, 13(3): 271–294. doi: 10.1007/BF02028349
[5] 黄德天. 基于图像技术的自动调焦方法研究[D]. 长春: 中国科学院大学(长春光学精密机械与物理研究所), 2013: 15–20.
Huang Detian. Study on auto-focusing method using image technology[D]. Changchun: Changchun Institute of Optics, Fine Mechanics and Physics, Chinese Academy of Sciences, 2013: 15–20.
http://cdmd.cnki.com.cn/Article/CDMD-80139-1013293679.htm [6] Subbarao M, Choi T S, Nikzad A. Focusing techniques[J]. Optical Engineering, 1993, 32(11): 2824–2836. doi: 10.1117/12.147706
[7] Marrugo A G, Millán M S, Abril H C. Implementation of an image based focusing algorithm for non-mydriatic retinal imaging[C]. Proceedings of the 2014 Ⅲ International Congress of Engineering Mechatronics and Automation, 2014: 1–3.
[8] 彭娟. 基本恒定类表面模型及操作算子的研究[D]. 桂林: 桂林电子科技大学, 2010: 11–20.
http://cdmd.cnki.com.cn/Article/CDMD-10595-1011256227.htm [9] 赵志彬, 刘晶红.基于图像处理的航空成像设备自动调焦设计[J].液晶与显示, 2010, 25(6): 863–868. http://www.cqvip.com/QK/97614A/201006/36601979.html
Zhao Zhibin, Liu Jinghong. Auto-focusing method for airborne image equipment based on image processing[J]. Chinese Journal of Liquid Crystals and Displays, 2010, 25(6): 863–868. http://www.cqvip.com/QK/97614A/201006/36601979.html
[10] 郭德伟. 基于新一代GPS的表面粗糙度规范与评定技术研究[D]. 桂林: 桂林电子科技大学, 2008: 1–30.
http://cdmd.cnki.com.cn/Article/CDMD-10595-2008193014.htm [11] 谢小甫, 周进, 吴钦章.基于无参考结构清晰度的自适应自动对焦方法[J].光电工程, 2011, 38(2): 84–89. http://www.wanfangdata.com.cn/details/detail.do?_type=perio&id=gdgc201102014
Xie Xiaofu, Zhou Jin, Wu Qinzhang. An adaptive autofocus method using no-reference structural sharpness[J]. Opto-Electronic Engineering, 2011, 38(2): 84–89. http://www.wanfangdata.com.cn/details/detail.do?_type=perio&id=gdgc201102014
[12] 蒋婷. 基于图像处理的自动对焦理论和技术研究[D]. 武汉: 武汉理工大学, 2008: 20–25.
http://cdmd.cnki.com.cn/Article/CDMD-10497-2008110864.htm [13] Liu Shuxin, Liu Manhua, Yang Zhongyuan. An image au-to-focusing algorithm for industrial image measurement[J]. EURASIP Journal on Advances in Signal Processing, 2016, 2016: 70. doi: 10.1186/s13634-016-0368-5
[14] 蒋凤林. 基于数字图像处理的自动调焦算法研究[D]. 哈尔滨: 哈尔滨理工大学, 2008: 9–25.
http://cdmd.cnki.com.cn/Article/CDMD-11914-2008172943.htm [15] 莫春红. 基于图像处理的自动调焦技术研究[D]. 西安: 中国科学院研究生院(西安光学精密机械研究所), 2013: 20–30.
http://cdmd.cnki.com.cn/Article/CDMD-80142-1014018705.htm [16] 刘兴宝. 基于数字图像处理的自动对焦技术研究[D]. 绵阳: 中国工程物理研究院, 2007: 1–30.
http://cdmd.cnki.com.cn/Article/CDMD-82818-2008032633.htm -
访问统计