-
获得原始的定标灯谱后,对定标灯谱中所有的光斑进行阈值筛选与中心定位,用于后续对光斑FWHM值的计算。
采用基于全局阈值迭代的方法[12]选取目标光斑,并对每个光斑进行轮廓提取,采用基于最小二乘法的椭圆拟合算法[13-14]计算每个光斑的中心点坐标。假设椭圆参数方程为:
$$ A{x}^{2}+Bxy+C{y}^{2}+Dx+Ey+1=0 $$ (1) 式中:A、B、C、D、E为系数。椭圆拟合返回信息为:椭圆的中心点
$ ({x}_{0},{y}_{0}) $ ,椭圆的大小(长轴a与短轴b),旋转角度$ \theta $ ,可表示为公式(2):$$ \left\{\begin{array}{c}{x}_{0}=\dfrac{BE-2CD}{4AC-{B}^{2}}\\ {y}_{0}=\dfrac{BD-2AE}{4AC-{B}^{2}}\\ a=\sqrt{\dfrac{2\left(A{{x}_{0}}^{2}+C{{y}_{0}}^{2}+B{x}_{0}{y}_{0}-1\right)}{A+C+\sqrt{{(A-C)}^{2}+{B}^{2}}}}\\ b=\sqrt{\dfrac{2\left(A{{x}_{0}}^{2}+C{{y}_{0}}^{2}+B{x}_{0}{y}_{0}-1\right)}{A+C-\sqrt{{\left(A-C\right)}^{2}+{B}^{2}}}}\\ \theta =\dfrac{1}{2}{\rm{arctan}}\dfrac{B}{A-C}\end{array}\right. $$ (2) 光斑的信息提取流程如图4所示。
-
根据光斑中心点坐标
$({x}_{0},{y}_{0})$ 计算空间及色散方向上的FWHM值。常用的含级数非线性拟合函数包括傅里叶函数(Fourier)、多项式函数(Polynomial)、正弦函数(Sum of Sine)、高斯混合模型(GMM)等,理论上通过改变参与拟合的项数,这些函数可以拟合任意类型的分布。采用高斯混合模型[10-11]作为拟合函数计算光斑的FWHM值。GMM是多个Gaussian的线性组合,通过改变模型中Gaussian的个数以及权重,可以使GMM满足任意类型的分布。GMM的公式表达为:
$$ p\left(x\right)=\sum\nolimits _{k=1}^{k}{w}_{k}\cdot g\left(x\left|{\mu }_{k}{\sum }_{k}\right.\right) $$ (3) 式中:k为GMM中Gaussian个数;
$ {w}_{k} $ 为每个Gaussian的权重,且$ 0{\leqslant w}_{k}\leqslant 1 $ ,$ {\displaystyle\sum }_{k=1}^{k}{w}_{k}=1 $ 。$ g\left(x\left|{\mu }_{k}{\displaystyle\sum }_{k}\right.\right) $ 为GMM中第k个Gaussian分布。当k=1时,GMM只有一个Gaussian,即为单高斯分布。为了验证GMM算法的优越性,对比了上述四种方法在低项数(N=1, 2, 3)下分别对三类光斑的像素深度分布曲线的拟合优度R2,如表1所示。
表 1 三类光斑在四种函数模型不同项数下的拟合优度
Table 1. R2 of three types of spots under the different terms of four functional models
Function model R2 of three types of spots Normal Slightly defocus Excessively defocus Fourier 1 0.91 0.97 0.82 2 0.98 0.98 0.98 3 0.99 0.98 0.98 Polynomial 1 0.02 0 0 2 0.52 0.73 0.82 3 0.59 0.73 0.83 Sum of sine 1 0.62 0.80 0.82 2 0.98 0.97 0.95 3 0.99 0.98 0.98 GMM 1 0.98 0.97 0.76 2 0.98 0.98 0.98 3 0.99 0.98 0.98 由表1可知,四种拟合函数对三类光斑的拟合优度R2均与项数N成正相关。当N=3时,四种拟合函数对三类光斑的拟合优度最高,拟合效果最好,拟合结果如图5(a)~(c)所示。
为了验证各函数模型的拟合精度,计算了当N=3时四种函数模型拟合光斑像素深度分布曲线所得的FWHM值,并与理论值进行对比,结果如表2所示。由表2可知,仅有GMM和Fourier两种方法对三类光斑的FWHM值计算误差在5%以内。
图 5 (a) Y方向上正常光斑拟合对比;(b) Y方向上微离焦光斑拟合对比;(c) Y方向上过度离焦光斑的拟合对比
Figure 5. (a) Fitting comparison of normal spots in the Y direction; (b) Fitting comparison of slghtly defocus spots in the Y direction; (c) Fitting comparison of excessively defocus spots in the Y direction
表 2 四种函数模型下三类光斑的FWHM值
Table 2. FWHM values of three types of spots under four functional models
Spot type FWHM
theoretical
valueFunction model GMM Fourier Sum of sine Polynomial Normal 5.4 5.3 5.2 4.9 9.4 Slightly
defocus6.5 6.4 6.6 6.6 8.4 Excessively
defocus10.6 10.1 10.4 10.4 11.3 通过分析大量光斑FWHM的拟合结果,并综合考虑函数曲线变化趋势与实际观测情况,最终选取GMM作为拟合函数,可以适用于不同离焦量下光斑的像素深度分布曲线拟合,对于单峰函数与双峰函数均有很好的拟合效果,且在较小离焦量时有更好的拟合精度,计算结果的误差在5%以内。
-
采用GMM拟合得到所有光斑对应的FWHM值,通过分析FWHM值分布情况对定标灯谱进行多目标图像清晰度评价。测量了系统处于正常与离焦情况下定标灯谱中所有光斑的FWHM值,分布情况如图6(a)、(b)所示。
图 6 (a)正常情况下所有光斑的FWHM分布图;(b)离焦情况下所有光斑的FWHM分布图
Figure 6. (a) FWHM distribution of all spots under the normal condition; (b) FWHM distribution of all spots in the defocus
从图6(a)中可以看出,当系统处于准焦位置下光斑FWHM值分布集中,且数量较多;从图6(b)中可以看出,当系统处于离焦情况下光斑FWHM值分布不均匀,且数量较少。
通过测量大量处于准焦位置时的光斑FWHM值,得出了正常情况下光斑沿空间方向的X-FWHM标准值约为8.1;沿色散方向的Y-FWHM标准值约为5.6。对于整幅定标灯谱,越多的光斑FWHM值接近标准值,表明了系统越接近准焦位置;反之则表明系统远离准焦位置。此外,光斑的识别数量
${{n}}_{\mathrm{p}}$ 同样可以反映定标灯谱的离焦情况。${{n}}_{\mathrm{p}}$ 随着系统离焦量的增大而减小,如表3所示。表 3 不同离焦量下光谱识别的光斑数量
Table 3. The number of spots identified by spectra at different defocus amount
Defocusing distance/μm 0 25 50 100 125 150 175 Number of spots 553 544 537 468 402 251 150 综上,定标灯谱中光斑FWHM值相对标准值的偏离程度及光斑识别数量
${{n}}_{\mathrm{p}}$ 可以作为定标灯谱图像清晰度评价的指标。离均差平方和(sum of squares of deviation from mean, SS)可以反映数值的总体离散程度,放大数据整体的平均偏差,计算公式为
$ SS=\displaystyle\sum {\left({x}_{i}-\overline{x}\right)}^{2} $ 。 在SS的基础上综合考虑了光斑数量${{n}}_{\mathrm{p}}$ ,将每幅定标灯谱识别光斑的数目放大到相同数值进行分析,得到定标灯谱的相对离均差平方和,记为RSS,计算公式如下:$$ RSS=\frac{{N}_{pi}}{{N}_{p0}}\sum {\left({x}_{i}-\overline{x}\right)}^{2} $$ (4) 式中:
$ {{N}}_{{p}{i}} $ 表示每幅定标灯谱识别的光斑数目;$ {{N}}_{{p}0} $ 表示系统处于准焦位置时定标灯谱的光斑识别量。则定标灯谱在空间及色散方向的相对离均差平方和分别为X-RSS,Y-RSS。通过定量移动电动调焦系统分析X-RSS、Y-RSS与离焦量Δf之间的对关系,如图7所示。由图7可知,X-RSS、Y-RSS变化趋势一致,且Y-RSS对离焦量Δf的变化更为敏感。因此,最终选用Y-RSS作为定标灯谱的多目标图像清晰度评价标准。
Y-RSS值越小,表明定标灯谱图中光斑的总体离散度越小,图像质量越好;值越大则表明定标灯谱中光斑总体质量越差,系统离焦量越大。
-
以电动调焦系统向远离CCD移动的方向为正向,靠近CCD移动的方向为负向,构建了Y-RSS与离焦量Δf的离焦函数模型,如图8所示。
该离焦函数模型的表达式为:
$$ \eta =\sum \nolimits_{i=0}^{8}{a}_{i}{\Delta f}^{i} $$ (5) 式中:
$ \mathrm{\eta } $ 表示Y-RSS。该离焦函数模型模型的拟合优度R2为0.99,拟合效果良好,且综合考虑了定标灯谱图中识别光斑的数量以及图像中所有光斑的FWHM值分布,可以实现系统不同离焦量下的定标灯谱图像清晰度评价。此外,利用上述模型对LAMOST进行离焦补偿时,还需要判断光谱仪的离焦方向。在某离焦量下拍摄定标灯谱图并计算得到Y1-RSS,正向移动电动调焦系统并拍摄此时的定标灯谱图,计算得到Y2-RSS,通过比较二者的大小来判断光谱仪的离焦方向:Y1-RSS<Y2-RSS,则光谱仪处于正离焦状态;Y1-RSS>Y2-RSS,则光谱仪处于负离焦状态;之后通过上述函数模型计算得到光谱仪的离焦量大小,通过电动调焦系统驱动球面镜前后移动实现LAMOST的离焦补偿。
-
为了说明所提出的基于多目标图像清晰度评价的离焦函数具有更好的稳定性与灵敏度,分别选取了传统四类图像清晰度评价方法中的Roberts[3-4]函数、DCT[6-8]函数、Entropy[5]函数与Vollaths[6-8]函数与文中的多目标评价方法(Multi-objective)进行对比。实验通过电动调焦系统获取不同离焦量下的定标灯谱,构建不同清晰度评价方法下的对焦评价曲线。由于对焦评价函数量纲各不相同,为了便于比较,将对焦评价函数值作归一化处理,结果如图9所示。
为了定量对比所提出的多目标图像清晰度评价方法与传统图像清晰度评价方法的性能,选取了清晰度对比率R,灵敏度
${{M}}_{\mathrm{S}\mathrm{E}}$ 、局部峰值数量α、对焦搜索区间β性能评价指标[15]进行对比分析,相关指标的定义如下。清晰度比率R的表达式为:
$$ R={{f}_{{\rm{max}}}}\left/ {{f}_{{\rm{min}}}}\right. $$ (6) 式中:
${{f}}_{\mathrm{m}\mathrm{a}\mathrm{x}}$ 、${{f}}_{\mathrm{m}\mathrm{i}\mathrm{n}}$ 分别表示图像清晰度评价函数的最大值与最小值。R越高,说明清晰度评价函数区分正焦与离焦图像的能力越强。灵敏度
${{M}}_{\mathrm{S}\mathrm{E}}$ 表示图像清晰度评价函数在最大值附近变化的剧烈程度。MSE越大,说明图像清晰度评价函数对图像的清晰度变化越敏感,就越容易对焦成功。灵敏度${{M}}_{\mathrm{S}\mathrm{E}}$ 的定义为:$$ {M}_{{\rm{SE}}}=\frac{{f}_{{\rm{max}}}-f({x}_{{\rm{max}}}+\Delta x)}{f({x}_{{\rm{max}}}+\Delta x)} $$ (7) 式中:
$f({x}_{{\rm{max}}}+\Delta x)$ 为图像清晰度评价函数最大值对应的横坐标${x}_{{\rm{max}}}$ 变化Δx后的函数值。选取Δx=60 μm。α表示图像清晰度评价函数的局部峰值数量,α越小,说明图像清晰度评价函数的抗干扰能力越强,稳定性越高。
对焦搜索区间β表示当图像清晰度评价函数值取0.9时的区间大小(以电动调焦系统的调节精度20 μm为一个单位)。搜索区间越小越容易达到准焦位置。
不同图像清晰度评价方法在上述四种指标上的对比结果如表4所示。
表 4 图像清晰度函数的评价指标对比
Table 4. The comparison of image definition function evaluation criterion
Method R MSE α β Roberts 1.41 0.18 0 3 DCT 1.67 0.55 0 3 Entropy 1.04 0.86 2 Vollaths 2.23 0.22 0 2 Multi-objective 108.30 0.17 0 3 由图9可知,当离焦量小于0时,所提出的多目标图像评价函数曲线在所有曲线的最下方,灵敏度最高;Vollaths函数次之;Roberts函数和DCT函数的灵敏度稍差于Vollaths函数;离焦量大于0时,DCT函数位于所有曲线下方,灵敏度最高;文中方法与Vollaths函数、Roberts函数灵敏度接近;Entropy函数则在全局上都表现很差,其趋势无法反映图像离焦量的变化,无法用于天文图像清晰度的评价。
表4中的定量评价指标对比表明:文中方法的清晰度对比率R远大于其他函数;灵敏度MSE均较小,无明显差距;局部峰值α与对焦搜索区间β除Entropy函数外,其他四个函数表现相当。
-
为了验证多目标图像清晰度评价函数的精度,选取了Roberts函数、DCT函数、Vollaths函数与文中方法进行误差对比,误差值均取正值,结果如图10所示。
由图10可知,Roberts函数、DCT函数与Vollaths函数的离焦诊断误差较大,在40~120 μm之间,难以用于实际观测中LAMOST光谱仪的离焦诊断;而文中方法对定标灯谱图像的离焦诊断误差均在10 μm以内,远小于其他评价函数的误差值,证明了文中方法相较于传统图像清晰度评价函数具有更高的精度。
综上所述,多目标图像清晰度评价函数具有更高的精度与清晰度对比率,能更好的区分正焦图像与模糊图像,且离焦诊断的误差在10 μm以内,可以满足实际观测中的技术需求。
Defocus diagnosis method of LAMOST spectrograph based on multi-object image definition evaluation
-
摘要: 研究表明,当温度产生一定变化时,会导致大天区面积多目标光纤光谱天文望远镜(LAMOST)光谱仪的内部器件产生热诱导变形,引起CCD靶面上的图像离焦模糊,降低了天文数据测量精度,也大大增加了16台光谱仪的日常维护难度。基于LAMOST运行前拍摄的定标灯谱数据,提出了一种基于多目标图像清晰度评价的离焦诊断方法。该方法通过对不同离焦量下的定标灯谱图像进行分析,提取了一定数量的光斑的半高全宽(FWHM)及其总体分布情况,建立多目标图像清晰度与系统离焦量之间的离焦函数模型,实现对LAMOST成像像质的离焦诊断,为后续智能化主动补偿技术的实现提供了技术支撑。介绍了LAMOST光谱仪的工作原理及结构,给出了光谱仪对调焦精度的需求;详细介绍了光斑FWHM值的测量原理与多目标图像清晰度评价函数的构建方法。与传统图像清晰度评价函数的对比结果显示,文中方法具有更高的清晰度对比率与精度,对定标灯谱图像的离焦诊断误差在10 μm以内,有效降低了人为局部诊断带来的误差,提高了16台光谱仪系统一致性,有望提高LAMOST日常运行效率与光谱仪的长期稳定性。
-
关键词:
- 天文技术与方法 /
- 多目标图像清晰度评价 /
- 离焦函数模型 /
- 离焦诊断 /
- 像质校正
Abstract: The research demonstrates that when the temperature changes a lot, the internal components of the large sky area multi-object fiber spectroscopic telescope (LAMOST) spectrographs will produce thermal-induced flexure, which will cause the image blurring of the CCD. Such image blurring reduces the measurement accuracy of astronomical data and greatly increases the difficulty of the daily maintenance of the 16 spectrographs.Therefore, a defocus diagnosis method for multi-object image definition evaluation is proposed based on the calibration lamp spectrum taken by LAMOST. By analyzing the spectrum image under the different defocusing amounts, the half-height full-width (FWHM) and its distribution of spots are obtained to establish the function model between the multi-target image definition and the defocusing amount of the system. It can realize the fast defocus diagnosis of the spectrum image quality of LAMOST and provide a reference for the realization of intelligent active compensation technology of LAMOST spectrograph. In this paper, the principle and structure of the LAMOST spectrograph are introduced, and the demand for the focusing precision of the spectrograph is given. And the measurement principle of FWHM value and the construction method of the multi-object image definition evaluation function are introduced in detail. Compared with the traditional image definition evaluation function, the results show that the proposed method has a higher definition ratio and accuracy. And the defocus diagnosis error of the spectral image is less than 10 μm, which effectively reduces the error caused by artificial diagnosis and improves the consistency of the 16 spectrographs. This method can also improve the daily operation efficiency and long-term stability of the LAMOST spectrographs. -
图 3 (a)正常光斑;(b)正常光斑在Y方向上的像素深度分布曲线;(c)微离焦光斑;(d)微离焦光斑在Y方向上的像素深度分布曲线;(e)过度离焦光斑;(f)过度离焦光斑在Y方向上的像素深度分布曲线
Figure 3. (a) Normal spots; (b) Pixel depth distribution curve about normal spots in the Y direction; (c) Spots of slightly defocus; (d) Pixel depth distribution curve about spots of slightly defocus in the Y direction; (e) Spots of excessively defocus; (f) Pixel depth distribution curve about normal spots in the Y direction
表 1 三类光斑在四种函数模型不同项数下的拟合优度
Table 1. R2 of three types of spots under the different terms of four functional models
Function model R2 of three types of spots Normal Slightly defocus Excessively defocus Fourier 1 0.91 0.97 0.82 2 0.98 0.98 0.98 3 0.99 0.98 0.98 Polynomial 1 0.02 0 0 2 0.52 0.73 0.82 3 0.59 0.73 0.83 Sum of sine 1 0.62 0.80 0.82 2 0.98 0.97 0.95 3 0.99 0.98 0.98 GMM 1 0.98 0.97 0.76 2 0.98 0.98 0.98 3 0.99 0.98 0.98 表 2 四种函数模型下三类光斑的FWHM值
Table 2. FWHM values of three types of spots under four functional models
Spot type FWHM
theoretical
valueFunction model GMM Fourier Sum of sine Polynomial Normal 5.4 5.3 5.2 4.9 9.4 Slightly
defocus6.5 6.4 6.6 6.6 8.4 Excessively
defocus10.6 10.1 10.4 10.4 11.3 表 3 不同离焦量下光谱识别的光斑数量
Table 3. The number of spots identified by spectra at different defocus amount
Defocusing distance/μm 0 25 50 100 125 150 175 Number of spots 553 544 537 468 402 251 150 表 4 图像清晰度函数的评价指标对比
Table 4. The comparison of image definition function evaluation criterion
Method R MSE α β Roberts 1.41 0.18 0 3 DCT 1.67 0.55 0 3 Entropy 1.04 0.86 2 Vollaths 2.23 0.22 0 2 Multi-objective 108.30 0.17 0 3 -
[1] Su Dingqiang, Cui Xiangqun, Wang Yanan, et al. Large-sky-area multi-object fiber spectroscopic telescope (LAMOST) and its key technology [C]//Proceedings of SPIE, 1998, 3352: 319250. [2] Shuo Huang, Hua Zou, Liu Tianjiao, et al. An active flexure compensation method for LAMOST spectrograph based on BP-Neural network [J]. Research in Astronomy and Astrophysics, 2020, 20(3): 18-25. [3] Zeng Haifei, Han Changpei, Li Kai, et al. Improved gradient threshold image sharpness evaluation algorithm [J]. Laser & Optoelectronics Progress, 2021, 58(22): 2211001. (in Chinese) [4] Xiong Rui, Gu Naiting, Xu Hongyan. An auto-focusing evaluation function adapted to multi-directional gray gradient change [J]. Laser & Optoelectronics Progress, 2022, 59(4): 0418001. (in Chinese) [5] Liu Bin, Qiao Qian, Zhang Zimiao, et al. 3D profile measurement based on depth from focus method using high-frequency component variance weighted entropy image sharpness evaluation function [J]. Infrared and Laser Engineering, 2021, 50(5): 20200326. (in Chinese) doi: 10.3788/IRLA20200326 [6] Li Chengchao, Yu Zhanjiang, Li Yiquan, et al. Sharpness evaluation of microscopic detection image for micro parts [J]. Semiconductor Optoelectronics, 2020, 41(1): 103-107, 113. (in Chinese) [7] Xiang Kui, Gao Jian. Research on the image definition evaluation algorithm in autofocus process [J]. Modular Machine Tool & Automatic Manufacturing Technique, 2019(1): 52-55. (in Chinese) [8] You Yuhu, Liu Tong, Liu Jiawen. Survey of the auto-focus methods based on image processing [J]. Laser & Infrared, 2013, 43(2): 132-136. (in Chinese) [9] Hou Yonghui, Zhu Yongtian, Hu Zhongwen, et al. Performance and sensitivity of low-resolution spectrographs for LAMOST [C]//Ground-based and Airborne Instrumentation for Astronomy III, SPIE, 2010, 7735: 177-185. [10] Xing Chengbin, Gong Shengsheng, Yu Xiaoliang, et al. Application of gaussian mixture clustering to moving surface fitting filter classification [J]. Infrared and Laser Engineering, 2021, 50(10): 20200501. (in Chinese) doi: 10.3788/IRLA20200501 [11] Tao Zhiyong, Liu Xiaofang, Wang Hezhang. Clustering algorithm of gaussian mixture model based on density peaks [J]. Journal of Computer Applications, 2018, 38(12): 3433-3437, 3443. (in Chinese) [12] Shan Deqiang, Hu Chao, Liu Feifei. Threshold analysis and center point extraction of spot images [J]. Computer & Digital Engineering, 2020, 48(7): 1753-1756. (in Chinese) [13] Zhang Jing, Wu Youyu. Locating algorithm of optical fiber spot center based on FPGA [J]. Laser Technology, 2017, 41(5): 769-774. (in Chinese) [14] Pan Deng, Li Yanli, Gao Dong, et al. Center extraction method of multiple and overlapping faculae based on ellipsefitting [J]. Acta Optica Sinica, 2020, 40(14): 1410001. (in Chinese) [15] Zhai YongPing, Zhou Dongxiang, Liu Yunhui, et al. Design of evaluation index for auto-focusing function and optimal function selection [J]. Acta Optica Sinica, 2011, 31(4): 0418002. (in Chinese) doi: 10.3788/AOS201131.0418002