|
发布时间: 2019-11-16 |
图像处理和编码 |
|
|
收稿日期: 2019-03-18; 修回日期: 2019-05-13; 预印本日期: 2019-05-20
基金项目: 国家自然科学基金项目(61172144);辽宁省教育厅基金项目(LJ2017ZL003)
第一作者简介:
刘万军, 1959年生, 男, 教授, 主要研究方向为图像与智能信息处理。E-mail:2510687730@qq.com;
曲海成, 男, 副教授, 主要研究方向为图像与智能信息处理。E-mail:35419709@qq.com; 赵庆国, 男, 硕士研究生, 主要研究方向为图像与智能信息处理。E-mail:719022416@qq.com.
中图法分类号: TP391.41
文献标识码: A
文章编号: 1006-8961(2019)11-1893-13
|
摘要
目的 针对雾天图像高亮和雾浓区域中容易出现场景透射率值求取不准确,导致复原后的图像细节丢失、出现光晕现象、对比度和色彩难以满足人眼的视觉特性等问题,提出了一种融合引导滤波优化的色彩恢复多尺度视网膜算法(GF-MSRCR)和暗通道先验的图像去雾算法。方法 首先利用加权四叉树方法从最小通道图中快速搜索全局大气光值,再从图像增强角度应用GF-MSRCR算法初步估计场景透射率值,依据暗通道先验原理对最小通道图进行二次估测,根据两次求取结果按一定比例进行像素级图像融合,得到场景透射率估计值;利用变差函数修正估计值,经中值滤波进一步优化得到场景透射率的精确值,最后通过大气散射模型恢复雾天图像,调整对比度和恢复颜色后,得到了轮廓完整且细节清晰的无雾图像。结果 理论分析和实验结果表明,经本文算法去雾处理后的图像信息熵、对比度、平均梯度、结构相似性分别平均提升了7.87%、21.95%、47.73%和15.58%,同时运行时间缩短了53.22%,对近景、含小部分天空区域、含大片天空区域和含白色物体场景的多种类型雾天图像显示出较好的复原效果。结论 融合GF-MSRCR和暗通道先验的图像去雾算法能快速有效保留图像的细节信息、消除光晕,满足了人眼的视觉特性,具有一定的实用性以及普适性。
关键词
加权四叉树; GF-MSRCR; 暗通道先验; 图像融合; 变差函数; 中值滤波
Abstract
Objective With the development of high-density industrial economy, the air quality gradually declines and haze occurs frequently. Haze is an aerosol system formed by the interaction of human daily life and special climate. Large particles in the air could scatter and absorb light, resulting in image collected degradation, which seriously affects image post-analysis. In general, two kinds of algorithms, namely, physical model image defogging and image enhancement defogging, have been adopted to improve the effect of weather factors on image quality. The former is to construct atmospheric scattering model to compensate distortion and obtain a clear image. The common de-fogging algorithms based on the physical model of atmospheric scattering are dark channel prior de-fogging algorithm and polarization imaging de-fogging algorithm and so on. In the last few years, based on the atmospheric scattering model, experts from all over the world have studied the dark channel priori de-fogging. Based on the dark channel priori principle of image de-fogging, on the one hand, the algorithm cannot keep the edge information of the image in the region where the depth of field changes greatly, and a halo phenomenon occurs in the fog-free image; on the other hand, when the global atmospheric light value is close to the pixel luminance component of the foggy image, the color distortion will occur in the restored image. The latter is achieved by improving the quality of image details according to the characteristics of human vision. The representative algorithms include de-fogging algorithm based on histogram equalization, homomorphic filtering, wavelet transform, Retinex theory, and atmospheric modulation transfer function. The basic idea of histogram equalization-based de-fogging algorithm is to obtain uniform distribution of histogram and increase the contrast of the image. The homomorphic filtering based de-fogging algorithm divides the image into irradiating component and reflection component in the frequency domain and increases the contrast of the image by enhancing the high-frequency information of the image. The fog algorithm based on wavelet transform in time domain and frequency domain transformation locally can effectively extract information from the signal. The de-fogging algorithm based on Retinex theory describes color invariance because it has good effect on dynamic range compression, detail enhancement, color fidelity, and so on. The de-fogging algorithm based on the atmospheric modulation transfer function predicts the corresponding upflow transfer function and aerosol transfer function through the formula, obtains the atmospheric modulation transfer function from the product of the two, and then recovers the degraded image in the frequency domain. The attenuation caused by the atmospheric modulation function is compensated. The MSRCR algorithm considers the ratio between the trichromatic channels of the image, so the color distortion should be eliminated to enhance the local detail to a certainextent.However, the time complexity of the algorithm is high, and the operation is complex. However, the following problems persist: the high light region and the thick foggy areas of the images acquired under the fog condition, the inaccurate transmittance calculation often results in detail loss of restored image, halo phenomenon, and contrast and color that cannot meet human visual characteristics. This paper proposes an image defogging algorithm combining GF-MSRCR with dark channel prior. Method Weighted quad tree method is adopted to fast search the minimum channel graph to obtain the global atmospheric light value. The GF-MSRCR algorithm is used to preliminarily estimate the transmittance for the image enhancement. According to the dark channel prior theory, the minimum channel graph is estimated again. The pixel fusion is operated on the two above results with a certain proportion to determine the transmittance estimation value, which is further modified by variation function and by median filtering to acquire the precise transmittance value. Finally, the atmospheric scattering model is used to restore the foggy image and obtain haze-removed image with complete contour and clear details after contrast and color correction. Result A computer with a lab platform of Intel (R) Core (TM) i5-7300HQ CPU @ 2.50 GHz 8 GB RAM is used, and the lab environment is MATLAB R2015b under Windows 10. Four types of fog sky images including close-range, small part sky area, large sky area and white object scene are defogged. Theoretical and experimental results show that on one hand, more edge information and local details in the image could be preserved by the proposed algorithm; moreover, color could be restored with high fidelity. With the aid of modification of variation function on scene transmittance and the smooth and optimization of median filtering, the algorithm could accurately process bright areas, such as sky, and retain more edge details. After the restoration and adjustment of the close-range image, the contrast and hue are well restored. After the image restoration and adjustment in the small sky area, the visual effect is better. After image restoration and adjustment, the contrast and color of sky region are more natural. After the white object image is restored and adjusted, the clarity and color can satisfy the visual characteristics of the human eye. When the proposed algorithm is applied to an image, the subjective visual effect of fog removal becomes evident. Five evaluation indicators, namely, information entropy, contrast, structural similarity, average gradient, and running time, are used to compare the image defogging quality of different algorithms. In particular, the running time obviously decreases by 53.22% with increases in the information entropy by 7.87%, contrast by 21.95%, average gradient by 47.73%, and structural similarity by 15.58%. The algorithm shows good restoration results for scene images containing fog close shot, a small sky area, a large sky area, or white objects. Conclusion The image dehazing algorithm fusing GF-MSRCR and dark channel prior could quickly and effectively retain image details, eliminate halo, and satisfy human visual characteristics. The algorithm possesses certain practicability and universality. Future research would capture fog images in more complex scenes and restore foggy images.
Key words
weighted quad tree; GF-MSRCR; dark channel prior; image fusion; variation function; median filtering
0 引言
随着高密度工业经济的发展,空气质量逐渐下降,雾霾天气频繁发生。雾霾由人类日常生产生活与特殊气候交互形成,是一种气溶胶系统。空气中的大粒子对光进行散射和吸收,导致成像系统得到的图像退化,使日后图像分析受到严重影响[1]。图像去雾可改善天气因素对图像质量的影响,具有重要的实际应用意义。
现阶段,一般认为图像的去雾算法有两种常见类型:基于物理模型与基于图像增强[2]。其中,前者分析了雾天图像退化原理,构建大气散射模型,补偿畸变,得到清晰图像。在过去几年中,很多国家的专家学者在大气散射模型基础上,对暗通道先验原理的图像去雾进行了较为系统的研究。He等人[3]提出暗通道先验图像去雾,对于大多数雾天图像较为适用,但时间复杂度高,边缘效果亦不理想;Wang等人[4]对He等人的研究进行改进,提出基于物理模型和暗通道先验的单幅图像去雾,该算法在一定程度提高了运行效率,但结果不光滑;Sun等人[5]提出局部大气光去雾算法,快速去雾得以实现,但在大面积天空处仍得不到理想复原效果;针对以上问题,眭萍等人[6]提出一种基于暗通道先验与马尔可夫随机场的图像去雾,在大面积天空处的复原能力有一定提升,但处理饱和图像效果较差,复原图像出现过饱和及光晕现象;王凯等人[7]提出一种快速图像去雾,以暗通道先验为基础,增强了对比度,但易出现光晕伪影;刘坤等人[8]提出基于稀疏模型和特征提取的单幅图像去雾算法,结合稀疏特征与雾天退化模型得到去雾图像,但颜色存在一定的失真问题;曹绪民等人[9]为增强复原图像亮度、对比度以及饱和度,基于亮度与对比度补偿、饱和度增强,提出快速图像去雾方法,由于算法性能与原图像亮度信息有关,因而也易因亮度问题而不能较好处理浓雾和灰度图像。由上述研究及存在的问题可知,暗通道先验原理的图像去雾,一方面在图像景深变化较大区域,不能较好保边,使复原图像内出现光晕;另一方面当全局大气光值与有雾图像像素亮度分量接近时,复原图像会出现颜色失真情况。
基于图像增强的去雾算法实质是依据人眼视觉特性,改善图像细节质量实现去雾,以平衡直方图、同态滤波和视网膜算法(Retinex)等为代表算法。郑辉等人[10]提出一种图像增强算法,以小波频分的直方图均衡化为基础,从而在一定程度上优化了雾天图像降质状态,但由于增强不均匀导致图像没有达到较好视觉效果;田小平等人[11]提出一种彩色图像增强算法,以同态滤波为理论基础,使得图像可被均匀增强,但存在颜色失真的问题;马忠丽等人[12]提出优化的单尺度视网膜算法(SSR)进行图像去雾,算法结合边缘信息,对比度虽得到提升,但颜色过度饱和;Lee等人[13]提出Retinex的保色增强算法,除去雾气后,图像颜色柔和,但景深非连续区域易有光晕出现;汤春明等人[14]提出夜间图像去雾算法,抑制了光晕现象,但对浓雾中景物处理效果不佳,且时间复杂度高,不利于实时处理;李长领等人[15]提出交通图像去雾,以实时的多尺度视网膜算法(MSR)为基础,不能完全去雾;色彩恢复多尺度视网膜算法(MSRCR)[16]考虑图像三色通道之间的比例,较好消除颜色失真,一定程度增强局部细节,但算法时间复杂度较高,运算较复杂。
综上所述,基于物理模型或图像增强的图像去雾均有一定局限性。通过分析两者优缺点,本文提出一种融合GF-MSRCR(引导滤波优化的色彩恢复多尺度视网膜算法)和暗通道先验的图像去雾算法,即根据四叉树快速搜索法求取精确大气光值,利用暗通道先验去雾与改进的图像增强算法,分别计算透射率,再进行像素级融合,对所得结果采用变差函数(variation function)和中值滤波(median filtering)对其修正与优化,通过图像退化模型得到复原图像,调整对比度,引入颜色恢复因子对色彩畸变缺陷进行补偿,得到清晰明亮的无雾图像。
1 理论基础
1.1 大气散射模型
在计算机视觉和图像学中,多数雾天图像退化模型是从大气散射模型中衍生出来的,可表示为
$ \mathit{\boldsymbol{I}}(\mathit{\boldsymbol{x}}) = \mathit{\boldsymbol{J}}(\mathit{\boldsymbol{x}})\mathit{\boldsymbol{t}}(\mathit{\boldsymbol{x}}) + \mathit{\boldsymbol{A}}(1 - \mathit{\boldsymbol{t}}(\mathit{\boldsymbol{x}})) $ | (1) |
式中,
基于大气散射模型去雾算法需先估测
$ \mathit{\boldsymbol{J}}(\mathit{\boldsymbol{x}}) = \frac{{\mathit{\boldsymbol{I}}(\mathit{\boldsymbol{x}}) - \mathit{\boldsymbol{A}}}}{{\max \left( {\mathit{\boldsymbol{t}}(\mathit{\boldsymbol{x}}), {t_0}} \right)}} + \mathit{\boldsymbol{A}} $ | (2) |
当
1.2 暗通道先验去雾
多数图像非天空区域中,像素三颜色通道至少包含一个较低值[17]。对任何输入图像
$ {\mathit{\boldsymbol{J}}^{\rm{d}}}(\mathit{\boldsymbol{x}}) = \mathop {\min }\limits_{y \in \mathit{\boldsymbol{ \boldsymbol{\varOmega} }}(\mathit{\boldsymbol{x}})} \left[ {\mathop {\min }\limits_{C \in \{ {\rm{R}}, {\rm{G}}, {\rm{B}}\} } {\mathit{\boldsymbol{J}}^C}(\mathit{\boldsymbol{y}})} \right] $ | (3) |
式中,
$ \begin{array}{*{20}{c}} {\mathop {\min }\limits_{y \in \mathit{\boldsymbol{ \boldsymbol{\varOmega} }}(\mathit{\boldsymbol{x}})} \left[ {\mathop {\min }\limits_C \frac{{{\mathit{\boldsymbol{I}}^C}(\mathit{\boldsymbol{y}})}}{{{\mathit{\boldsymbol{A}}^C}(\mathit{\boldsymbol{y}})}}} \right] = }\\ {\mathit{\boldsymbol{t}}(\mathit{\boldsymbol{x}})\mathop {\min }\limits_{y \in \mathit{\boldsymbol{ \boldsymbol{\varOmega} }}(\mathit{\boldsymbol{x}})} \left[ {\mathop {\min }\limits_\mathit{\boldsymbol{C}} \frac{{{\mathit{\boldsymbol{I}}^C}(\mathit{\boldsymbol{x}})}}{{{\mathit{\boldsymbol{A}}^C}(\mathit{\boldsymbol{x}})}}} \right] + 1 - \mathit{\boldsymbol{t}}(\mathit{\boldsymbol{x}})} \end{array} $ | (4) |
式中,
$ \mathit{\boldsymbol{\bar t}}(\mathit{\boldsymbol{x}}) = 1 - \mathop {\min }\limits_{y \in \mathit{\boldsymbol{ \boldsymbol{\varOmega} }}(\mathit{\boldsymbol{x}})} \left[ {\mathop {\min }\limits_{\rm{C}} \frac{{{\mathit{\boldsymbol{I}}^C}(\mathit{\boldsymbol{y}})}}{{{\mathit{\boldsymbol{A}}^{\rm{C}}}}}} \right] $ | (5) |
事实上,对于较远处物体,由于雾气存在而有了更多层次感,所成图像可更好地符合人视觉的常规特性。由此,为式(5)引进一个在[0, 1]间的系数
$ \mathit{\boldsymbol{\bar t}}(\mathit{\boldsymbol{x}}) = 1 - \omega \mathop {\min }\limits_{y \in \mathit{\boldsymbol{ \boldsymbol{\varOmega} }}(\mathit{\boldsymbol{x}})} \left[ {\mathop {\min }\limits_C \frac{{{\mathit{\boldsymbol{I}}^C}(\mathit{\boldsymbol{y}})}}{{{\mathit{\boldsymbol{A}}^C}(\mathit{\boldsymbol{x}})}}} \right] $ | (6) |
1.3 MSRCR算法
Retinex理论是指人眼感知亮度要依据环境光在物体表面反射,算法数学表达式是
$ \mathit{\boldsymbol{I}}(\mathit{\boldsymbol{x}}) = \mathit{\boldsymbol{t}}(\mathit{\boldsymbol{x}})*\mathit{\boldsymbol{R}}(\mathit{\boldsymbol{x}}) $ | (7) |
式中,
对式(7)两侧取对数,可得
$ \mathit{\boldsymbol{R}}(\mathit{\boldsymbol{x}}) = \ln \mathit{\boldsymbol{I}}(\mathit{\boldsymbol{x}}) - \ln \mathit{\boldsymbol{t}}(\mathit{\boldsymbol{x}}) $ | (8) |
将图像
$ \mathit{\boldsymbol{t}}(\mathit{\boldsymbol{x}}) = \mathit{\boldsymbol{I}}(\mathit{\boldsymbol{x}}) \otimes \mathit{\boldsymbol{F}}(\mathit{\boldsymbol{x}}) $ | (9) |
式中,
$ \begin{array}{*{20}{c}} {{\mathit{\boldsymbol{R}}_{{\rm{MSR}}}}(\mathit{\boldsymbol{x}}, \mathit{\boldsymbol{y}}) = }\\ {\sum\limits_{n = 1}^N {{\omega _n}} \left\{ {\ln \mathit{\boldsymbol{I}}(\mathit{\boldsymbol{x}}, \mathit{\boldsymbol{y}}) - \ln \left( {{\mathit{\boldsymbol{F}}_n}(\mathit{\boldsymbol{x}}, \mathit{\boldsymbol{y}})*\mathit{\boldsymbol{I}}(\mathit{\boldsymbol{x}}, \mathit{\boldsymbol{y}})} \right)} \right\}} \end{array} $ | (10) |
式中,
MSRCR算法通过色彩校正系数对图像恢复颜色,算法数学表达式为
$ {\mathit{\boldsymbol{R}}_{{\rm{MSRC}}{{\rm{R}}_i}}}(\mathit{\boldsymbol{x}}, \mathit{\boldsymbol{y}}) = {\mathit{\boldsymbol{C}}_i}(\mathit{\boldsymbol{x}}, \mathit{\boldsymbol{y}}){\mathit{\boldsymbol{R}}_{{\rm{MS}}{{\rm{R}}_i}}}(\mathit{\boldsymbol{x}}, \mathit{\boldsymbol{y}}) $ | (11) |
式中,
$ \begin{array}{l} \mathit{\boldsymbol{I}}_i^\prime (\mathit{\boldsymbol{x}}, \mathit{\boldsymbol{y}}) = \frac{{{\mathit{\boldsymbol{I}}_i}(\mathit{\boldsymbol{x}}, \mathit{\boldsymbol{y}})}}{{\sum\limits_{j = 1}^S {{\mathit{\boldsymbol{I}}_j}} (\mathit{\boldsymbol{x}}, \mathit{\boldsymbol{y}})}}\\ {\mathit{\boldsymbol{C}}_i}(\mathit{\boldsymbol{x}}, \mathit{\boldsymbol{y}}) = \beta \ln \left[ {\alpha \mathit{\boldsymbol{I}}_i^\prime (\mathit{\boldsymbol{x}}, \mathit{\boldsymbol{y}})} \right] \end{array} $ | (12) |
式中,
1.4 线性引导滤波
引导滤波(GF)在多种计算机视觉中的应用有效且高效,具有降除噪声、细节平滑、边缘保留和增强,以及HDR(高频图像)压缩等功能,近几年在图像显著性检测和多尺度降噪中得到了广泛应用。线性引导滤波相较于高斯函数
$ \begin{array}{l} {\mathit{\boldsymbol{q}}_j}(\mathit{\boldsymbol{x}}) = f\left( {{\mathit{\boldsymbol{I}}_j}(\mathit{\boldsymbol{x}})} \right) = {a_k}{\mathit{\boldsymbol{I}}_j}(\mathit{\boldsymbol{x}}) + {b_k}\\ {a_k} = \frac{{\frac{1}{{{N_{{\omega _k}}}}}\sum\limits_{j \in {\mathit{\boldsymbol{\omega }}_k}} {I_i^2} (x) - \mu _k^2}}{{\sigma _k^2 + \delta }}, {b_k} = \left( {1 - {a_k}} \right){\mu _k} \end{array} $ | (13) |
式中,
$ {f_j}(\mathit{\boldsymbol{I}}(\mathit{\boldsymbol{x}})) = \frac{1}{{{N_{{\omega _k}}}}}\sum\limits_{k, j \in {\mathit{\boldsymbol{\omega }}_k}} {\left( {{a_k}*{\mathit{\boldsymbol{I}}_j}(\mathit{\boldsymbol{x}}) + {b_k}} \right)} $ | (14) |
2 融合GF-MSRCR和暗通道先验的去雾方法
2.1 总体思路
由上述分析可知,图像高亮区域像素点的暗通道先验透射率接近0,且图像深度变化在较大区域不能保持边缘,导致复原图像整体颜色失真,边缘信息损失,并出现光晕现象;MSRCR算法不但增强图像的局部细节,而且考虑了颜色的保真度,但算法本质是计算图像中3种颜色通道尺度关系,仅强调图像的一部分,并不考虑图像退化的原因,不是实质上的去雾,因此,单一暗通道先验或MSRCR均不能很好完成图像去雾。对此,本文提出了融合GF-MSRCR和暗通道先验的去雾算法,将图像增强技术和暗通道先验原理结合起来,算法主要分为3步:
1) 全局大气光值精准求取。应用加权四叉树搜索方法细分雾天图像最小化操作后的最小通道图,得到全局大气光精确值;
2) 场景透射率精确求取。利用GF-MSRCR和暗通道先验估计透射率,再通过变差函数和中值滤波对其校正优化,求得场景透射率精确值;
3) 图像复原及优化。通过大气散射模型获得复原图像,调节对比度,引入颜色恢复系数补偿色彩失真,得到清晰明亮的无雾图像。
算法流程如图 1所示。
2.2 全局大气光值的求取
传统去雾算法根据相关像素求得全局大气光,但其值易受雾天图像内高亮区域干扰,加权四叉树搜索法能较好降低或去除高亮区域对全局大气光的影响。
1) 对雾天图像
$ \mathit{\boldsymbol{W}}(\mathit{\boldsymbol{x}}) = \mathop {\min }\limits_{c \in \{ {\rm{R}}, {\rm{G}}, {\rm{B}}\} } \left( {{\mathit{\boldsymbol{I}}^c}(\mathit{\boldsymbol{x}})} \right) $ | (15) |
2) 利用加权四叉树搜索方法细分最小通道图,快速得出大气光值;
假设雾区在最小通道图上方,该区域平均亮度值较高,方差较小。根据上述假设,将雾天图像最小通道图按位置均分成4个矩形区域。
(1) 计算每个区域得分。令每个区域均值减去方差后差值为该区域得分
$ \begin{array}{l} {s_i} = {a_n}\left( {\mathit{\boldsymbol{W}}_i^{{\rm{avg}}}(\mathit{\boldsymbol{x}}) - \sigma _i^2} \right)\quad i = 1, 2, 3, 4\\ {a_n} = \left\{ {\begin{array}{*{20}{l}} {\max \left( {1.5 - 1/{2^{5 - n}}, 1} \right)}&{i = 1, 2}\\ 1&{i = 3, 4} \end{array}} \right. \end{array} $ | (16) |
式中,
(2) 迭代计算全局大气光值。将得分最高区域选作继续迭代的区域,按位置均匀划分成4个更小的区域,不断迭代,最终备选区域尺寸会较预先设定的上限值(
雾天图像分别经传统去雾算法和加权四叉树方法获得全局大气光的备选区域,如图 2所示。
2.3 场景透射率的精确求取
1) 将最小通道图
2) 将雾天图像
(1) 颜色空间转换。在RGB空间计算可能造成图像信息失真,因此在更接近人视觉系统的HSV空间操作。
(2) 通过GF-MSRCR计算HSV空间透射率
结合式(9)及式(14)计算可得
$ {\mathit{\boldsymbol{t}}_{\rm{V}}}(\mathit{\boldsymbol{x}}) = {f_j}\left( {{\mathit{\boldsymbol{I}}_{\rm{V}}}(\mathit{\boldsymbol{x}})} \right) = \frac{1}{{{N_{{\omega _k}}}}}\sum\limits_{k, j \in {\mathit{\boldsymbol{\omega }}_k}} {\left( {{\mathit{\boldsymbol{a}}_k}*{\mathit{\boldsymbol{I}}_{V, j}}(\mathit{\boldsymbol{x}}) + {b_k}} \right)} $ | (17) |
同理可得
(3) 在颜色空间将
3) 通过加权平均算法融合
$ \mathit{\boldsymbol{t'''}}(\mathit{\boldsymbol{x}}) = {\omega _1}\mathit{\boldsymbol{t'}}(\mathit{\boldsymbol{x}}) + {\omega _2}\mathit{\boldsymbol{t''}}(\mathit{\boldsymbol{x}}) $ | (18) |
式中,
4) 通过变差函数得到场景透射率修正值
$ \mathit{\boldsymbol{t''''}}(\mathit{\boldsymbol{x}}) = \left\{ {\begin{array}{*{20}{c}} {\min \left( {\max \frac{\Delta }{{|\mathit{\boldsymbol{I}}(\mathit{\boldsymbol{x}}) - A|}}, 1} \right) \times }&{}\\ {\max \left( {\mathit{\boldsymbol{t'''}}(\mathit{\boldsymbol{x}}), {t_0}} \right)}&{V < \mathit{\Delta} }\\ {\max \left( {\mathit{\boldsymbol{t'''}}(\mathit{\boldsymbol{x}}), {t_0}} \right)}&{V \ge \mathit{\Delta} } \end{array}} \right.\\ {V=\lambda \sqrt{\frac{(R-m)^{3}+(G-m)^{3}+(B-m)^{3}}{3}}} \\ {m=\frac{R+G+B}{3}} $ | (19) |
式中,
透射率修正前后结果如图 3所示。
5) 通过中值滤波
(1) 粗计算初始雾层
$ \mathit{\boldsymbol{M}}(\mathit{\boldsymbol{x}}) = \mathop {{\mathop{\rm med}\nolimits} }\limits_{y \in \mathit{\boldsymbol{ \boldsymbol{\varOmega} }}(\mathit{\boldsymbol{x}})} (\mathit{\boldsymbol{W}}(\mathit{\boldsymbol{x}})) $ | (20) |
(2) 计算边缘信息。最小通道图
$ \begin{array}{l} \mathit{\boldsymbol{EI}}(\mathit{\boldsymbol{x}}) = \\ \min \left( {\mathit{\boldsymbol{M}}(\mathit{\boldsymbol{x}}), {\mathit{\boldsymbol{I}}_{\min }}(\mathit{\boldsymbol{x}})} \right) - \mathop {\min }\limits_{y \in \mathit{\boldsymbol{ \boldsymbol{\varOmega} }}(\mathit{\boldsymbol{x}})} \left( {{\mathit{\boldsymbol{I}}_{\min }}(\mathit{\boldsymbol{y}})} \right) \end{array} $ | (21) |
(3) 计算除去边缘信息
$ \mathit{\boldsymbol{t}}(\mathit{\boldsymbol{x}}) = \mathit{\boldsymbol{t''''}}(\mathit{\boldsymbol{x}}) - \mathit{\boldsymbol{EI}}(\mathit{\boldsymbol{x}}) $ | (22) |
透射率优化前后结果如图 4所示。
2.4 图像复原
1) 式(2)结合求得的全局大气光值
2) 复原图像偏暗,为满足人眼视觉特性,需调试复原图像对比度,利用式(23)对复原图像对比度进行拉伸
$ \begin{array}{l} \mathit{\boldsymbol{I}}_{{\rm{adjust }}}^{\rm{c}} = \frac{{k \cdot \left( {\mathit{\boldsymbol{I}}_{{\rm{re}}}^c(\mathit{\boldsymbol{x}}) - \min \left( {\mathit{\boldsymbol{I}}_{{\rm{or}}}^c(\mathit{\boldsymbol{x}})} \right)} \right)}}{{\max \left( {\mathit{\boldsymbol{I}}_{{\rm{or}}}^c(\mathit{\boldsymbol{x}})} \right) - \min \left( {\mathit{\boldsymbol{I}}_{{\rm{or}}}^c(\mathit{\boldsymbol{x}})} \right)}}\\ c \in ({\rm{R}}, {\rm{G}}, {\rm{B}}) \end{array} $ | (23) |
式中,
3) 对比度调节后图像仍存在一定程度颜色失真,为此,引入式(12)补偿颜色失真缺陷,得到最终清晰明亮的复原图像。
对比度调节前后图像、色彩恢复后图像如图 5所示。
3 实验结果与分析
实验在Intel(R) Core(TM) i5-7300HQ CPU @2.50 GHz 8 GB RAM的电脑上进行,环境为Windows 10下的MATLAB R2015b。
实验参数取值:
1) 加权平均算法加权系数
2) 对比度调节因子
3.1 主观评价
本文算法对近景、含小片天空区域、含大片天空区域和含白色物体场景4种类型雾天图像进行去雾处理,中间过程效果如图 6所示。可以看出,场景透射率估计值在天空等高亮区域偏小,经变差函数修正后有一定改善,中值滤波优化的透射率图像整体非常平滑。
近景图像复原调整后,对比度和色调都得到很好恢复;含小片天空区域图像复原调整后,主观感受较舒适;含大片天空区域图像复原调整后,天空处对比度与色彩较柔和;含白色物体图像复原调整后,清晰度和颜色使人眼视觉特性得以满足。实验结果表明,将本文算法应用在一幅图像中,雾气去除的主观视觉效果表现得更加明显。能够较好地恢复图像中景深突变的边缘细节,由此可知,不同情况的雾天图像经本文算法处理后都有较理想的去雾结果。
雾天图像、文献[3]去雾图像、文献[8]去雾图像、文献[12]去雾图像、文献[15]去雾图像和本文算法去雾图像效果对比如图 7所示。
从4幅雾天图像去雾对比效果可以看出,文献[3]采用软抠图法处理边缘信息,对近景图像复原可得到较清晰的去雾效果,然而,图像丢失了景深突变区域中的草、花、窗、叶和墙等许多细节;对含小片天空区域、含大片天空区域和含白色物体场景图像去雾结果不理想,含小片与含大片天空区域图像内的天空,含白色物体场景图像内的云、树、山都有色彩畸变和边缘的细节内容丢失的情形。
文献[8]对大部分雾天图像都能获得良好的除雾效果,但是对图像中白云和山脉等含白色物体,以及较大片天空区域处理效果过于明亮,而对建筑物、街道、车辆和树木等处理效果较暗,致使信息严重丢失,效果并不理想。
文献[12]采用高斯滤波估计亮度分量,引入原始强度分量优化反射分量估计,可以快速去除海雾,获得良好的复原图像,但是在对图像中天空区域和含白色物体场景的高亮区域处理后,图像色调存在一定偏差,有过度饱和甚至失真的问题。
文献[15]将原雾天图像及其反转图像MSR变换、线性拉伸和幂次变换结果加权线性相加,达到图像去雾目的。去雾处理后,图像色彩保持较好,同时,边缘细节和主要轮廓也得到较好保留,但图像中的雾气并没有完全消除,导致近景图像中的树叶和墙壁、含小片天空区域图像中的树叶和天空、含大片天空区域图像中的建筑物和天空等累深突变区域没有得到较好的处理。此外,复原图像在诸如山区、树木和白云等白色物体处仍存在一定程度的雾气。
本文算法采用结合暗通道先验与GF-MSRCR对透射率进行估计,优化了图像边缘信息与局部细节的保留,色彩还原高保真,使用变差函数修正透射率值,再由中值滤波平滑该值,使算法可准确处理天空等明亮区域,更多边缘细节信息得到保留。如近景图像中的门窗、花草、墙壁、树枝和树叶;含小片天空区域图像中的树枝和树叶;含大片天空区域图像中的建筑、车辆和街道,以及含白色物体场景图像中的树林、山脉和白云等边缘信息都得到完整保留,较多局部细节也得到了保留。相较于其他算法,本文算法对雾天图像,特别是其中的天空等区域的去雾处理效果,在色彩、清晰度以及整体亮度上都更符合真实场景。
综上所述,本文算法恢复的图像边缘信息得到了更全面的保护,且对景深突变区域的处理更平滑,使得图像保留了更为清晰的局部细节,颜色保真度更高,在恢复近景以及含有天空等高亮区域的雾天图像方面都优于其他类型的去雾方法。
3.2 客观指标评价
实验比较多种算法去雾后图像质量,使用信息熵、对比度、结构相似性、平均梯度和运行时间5项指标评估。
图像清晰度与细节强度由信息熵
$ H = - \sum\limits_{i = 0}^{255} {{P_i}} \ln {P_i} $ | (24) |
式中,
不同算法对4幅图像去雾后信息熵大小比较见表 1。
表 1
不同算法信息熵
Table 1
Information entropy of different algorithm
从表 1中可以看出,对近景图像去雾后的复原图像,除本文算法信息熵增加外,其他算法均小于原雾天图像;对含小片天空区域图像去雾后的复原图像,文献[3]算法信息熵增加,本文算法信息熵略微降低,其他算法信息熵较明显降低;对含大片天空区域图像去雾后的复原图像,文献[12]算法和本文算法信息熵提高,其他算法信息熵均小于原雾天图像;对含白色物体场景图像去雾后的复原图像,除本文算法信息熵提高,其他算法
图像可视化程度使用对比度
$ C = \frac{\sigma }{{{{\left[ {\frac{{\frac{1}{{MN}}\sum\limits_{i = 1}^M {\sum\limits_{j = 1}^N {(\mathit{\boldsymbol{I}}(} } i, j) - \mu {)^4}}}{{{{\left( {{\sigma ^2}} \right)}^2}}}} \right]}^{\frac{1}{4}}}}} $ | (25) |
式中,
通过不同算法对4幅图像进行去雾得到结果图像对比度大小见表 2。
表 2
不同算法对比度
Table 2
Image contrast of different algorithms
对表 2中去雾后图像对比度进行分析可知,近景图像、含大片天空区域图像和含白色物体场景图像去雾后的复原图像,仅文献[3]算法和本文算法对比度高于原雾天图像,其他算法对比度均降低;对于含小片天空区域图像去雾后的复原图像,除文献[15]算法和本文算法对比度高于雾天图像,其他算法对比度均降低。通过文献[3]算法处理图像对比度虽然有所提高,但由于过处理度天空和白色等高亮区域,导致颜色失真,并产生光晕现象。对于不同情况雾天图像进行去雾处理,与原始雾天图像相比,本文算法所得图像对比度增加,可视性提高;其他算法对比度有不同程度减少,复原图像可视性降低。
图像相对清晰程度由平均梯度
$ \begin{array}{*{20}{c}} {\bar g = \frac{2}{{(M - 1)(N - 1)}}\sum\limits_{i = 1}^{M - 1} {\sum\limits_{j = 1}^{N - 1} \times } }\\ {\sqrt {\frac{{{{(I(i, j) - I(i + 1, j))}^2} + {{(I(i, j) - I(i, j + 1))}^2}}}{2}} } \end{array} $ | (26) |
不同算法对4幅图像去雾后平均梯度大小比较见表 3。
表 3
不同算法的平均梯度
Table 3
Average gradient of different algorithm
由表 3中各种算法的平均梯度可知,文献[3]算法、文献[8]算法和本文算法平均梯度较原雾天图像有明显提升,其他算法提升幅度较小;对含小片天空区域图像去雾后的复原图像,本文算法平均梯度提升幅度最大,文献[3]算法和文献[8]算法依次不同程度提升,其余算法平均梯度均小于原雾天图像;对含大片天空区域图像去雾后的复原图像,本文算法平均梯度值最大,除文献[3]算法,其他算法的平均梯度虽都有所提升,但均低于本文算法;对于含白色物体场景图像处理后的无雾图像,除文献[12]平均梯度低于原雾天图像,其他算法均有所提高。对不同情况下的雾天图像进行去雾处理,综合比较所有复原图像平均梯度,实验所选取的多种算法都能较完整恢复近景图像的局部细节;对于远景和含高亮区域的图像,本文算法较其他算法所得复原图像平均梯度提升更为明显,因此,本文算法边缘清晰度处理更好,保边效果明显。通过比较不同情况下雾天图像复原后的平均梯度值,本文算法去雾复原图像清晰度明显提升,层次更丰富,保边效果更佳,对有雾图像处理效果更优秀。
结构相似性
$ S = \frac{{\frac{1}{{MN + 1}}\sum\limits_{i = 1}^n {\sum\limits_{j = 1}^N {\left( {\mathit{\boldsymbol{I}}(i, j) - {\mu _1}} \right)} } \left( {\mathit{\boldsymbol{J}}(i, j) - {\mu _J}} \right)}}{{ {{\sigma _j}{\sigma _j}} .}} $ | (27) |
式中,
不同算法对4幅图像去雾后结构相似性大小比较见表 4。
表 4
不同算法结构相似性
Table 4
Structural similarity of different algorithms
由表 4中可以看出,对不同情况下的雾天图像进行去雾处理,综合比较所有复原图像,与其他算法相比,本文算法结构相似性的值较大,图像结构信息保留能力更优秀,去雾处理效果更加还原真实场景,符合人眼基本视觉特性。
如果在实际生产生活中应用算法,必须考虑其能否满足实时性需求。不同算法在对4幅图像去雾过程所用时间比较见表 5。
表 5
不同算法的运行时间
Table 5
Running time of different algorithm
显然,对不同条件下的雾天图像进行去雾处理,综合比较去雾算法运行所需时间,文献[12]算法运行耗时最长,文献[3]、文献[8]、文献[15]算法运行所需时间相对较短,本文算法运行耗时少于其他去雾算法。文献[3]采用需要大量浮点运算的soft matting方法精细透射率,大量运算限制了算法实时性;文献[8]的介质传输图应用雾天灰度图像稀疏特征优化,训练、学习稀疏字典得到其中的稀疏系数;文献[12]中亮度分量通过高斯滤波估计,边缘细节较好保存,但时间复杂度较大;文献[15]需将雾天图像与其反转图像分别进行线性和幂次等计算实现去雾;本文算法一方面,通过执行时间较短的加权四叉树搜索法求取全局大气光值;另一方面,通过时间复杂度较低的线性引导滤波优化传统MSRCR算法,二次估计场景透射率。另外,结合时间复杂度为O(1)的中值滤波器平滑场景透射率,降低了算法执行所需时间,与其他算法相比,运行效率明显提高。
4 结论
本文提出融合GF-MSRCR和暗通道先验的图像去雾算法,求取场景透射率估计值时结合了基于物理模型和图像增强去雾算法,图像边缘信息可被较多保存,实现色彩高保真还原;通过变差函数及中值滤波修正、优化透射率,使算法可准确处理天空等高亮区域,较好保持局部细节。实验表明,本文算法对多种类型的雾天图像去雾后,所得无雾图像轮廓清晰、细节完整、层次丰富、自然,且具有较低时间复杂度。对更加复杂场景下捕获雾天图像去雾复原将成为下一步的研究重点。
参考文献
-
[1] Wu D, Zhu Q S. The latest research progress of image dehazing[J]. Acta Automatica Sinica, 2015, 41(2): 221–239. [吴迪, 朱青松. 图像去雾的最新研究进展[J]. 自动化学报, 2015, 41(2): 221–239. ] [DOI:10.16383/j.aas.2015.c131137]
-
[2] Yu J, Xu D B, Liao Q M. Image defogging:a survey[J]. Journal of Image and Graphics, 2011, 16(9): 1561–1576. [禹晶, 徐东彬, 廖庆敏. 图像去雾技术研究进展[J]. 中国图象图形学报, 2011, 16(9): 1561–1576. ] [DOI:10.11834/jig.20110920]
-
[3] He K M, Sun J, Tang X O. Single image haze removal using dark channel prior[C]//Proceedings of 2009 IEEE Conference on. Computer Vision and Pattern Recognition, 2009. Miami, FL, USA: IEEE, 2009: 1956-1963.[DOI: 10.1109/CVPR.2009.5206515]
-
[4] Wang J B, He N, Zhang L L, et al. Single image dehazing with a physical model and dark channel prior[J]. Neurocomputing, 2015, 149: 718–728. [DOI:10.1016/j.neucom.2014.08.005]
-
[5] Sun W, Wang H, Sun C H, et al. Fast single image haze removal via local atmospheric light veil estimation[J]. Computers & Electrical Engineering, 2015, 46: 371–383. [DOI:10.1016/j.compeleceng.2015.02.009]
-
[6] Gui P, Bi D Y, Ma S P, et al. Single image defogging based on Markov random field[J]. Application Research of Computers, 2016, 33(9): 2844–2847. [眭萍, 毕笃彦, 马时平, 等. 基于马尔可夫随机场框架的单幅图像去雾[J]. 计算机应用研究, 2016, 33(9): 2844–2847. ] [DOI:10.3969/j.issn.1001-3695.2016.09.065]
-
[7] Wang K, Chen Z Y, Wu M, et al. Fast signal image dehazing method based on channel dark element information[J]. Application Research of Computers, 2017, 34(7): 2224–2227. [王凯, 陈朝勇, 吴敏, 等. 基于通道暗元素信息的快速单幅图像去雾方法[J]. 计算机应用研究, 2017, 34(7): 2224–2227. ] [DOI:10.3969/j.issn.1001-3695.2017.07.066]
-
[8] Liu K, Bi D Y, Wang S P, et al. Single image dehazing based on sparse feature extraction[J]. Acta Optica Sinica, 2018, 38(3): #0310001. [刘坤, 毕笃彦, 王世平, 等. 基于稀疏特征提取的单幅图像去雾[J]. 光学学报, 2018, 38(3): #0310001. ]
-
[9] Cao X M, Liu C X, Zhang J D, et al. Fast image defogging algorithm based on luminance contrast enhancement and saturation compensation[J]. Journal of Computer-Aided Design & Computer Graphics, 2018, 30(10): 1925–1934. [曹绪民, 刘春晓, 张金栋, 等. 基于亮度对比度增强与饱和度补偿的快速图像去雾算法[J]. 计算机辅助设计与图形学学报, 2018, 30(10): 1925–1934. ] [DOI:10.3724/SP.J.1089.2018.17000]
-
[10] Zheng H, Wu J. Image enhancement algorithm based on wavelet frequency division histogram equalization[J]. Modern Electronics Technique. [郑辉, 吴谨.基于小波分频与直方图均衡的图像增强算法[J].现代电子技术, 2010, 33(16): 149-150, 153.[DOI: 10.3969/j.issn.1004-373X.2010.16.046]]
-
[11] Tian X P, Cheng X, Wu C M, et al. Color image enhancement method based on homomorphic filtering[J]. Journal of Xi'an University of Posts and Telecommunications, 2015, 20(6): 51–55. [田小平, 程新, 吴成茂, 等. 基于同态滤波的彩色图像增强[J]. 西安邮电大学学报, 2015, 20(6): 51–55. ] [DOI:10.13682/j.issn.2095-6533.2015.06.011]
-
[12] Ma Z L, Wen J. Single-scale Retinex sea fog removal algorithm fused the edge information[J]. Journal of Computer-Aided Design & Computer Graphics, 2015, 27(2): 217–225. [马忠丽, 文杰. 融合边缘信息的单尺度Retinex海雾去除算法[J]. 计算机辅助设计与图形学学报, 2015, 27(2): 217–225. ]
-
[13] Lee H G, Yang S, Sim J Y. Color preserving contrast enhancement for low light level images based on Retinex[C]//Proceedings of 2015 Asia-Pacific Signal and Information Processing Association Annual Summit and Conference. Hong Kong, China: IEEE, 2015: 884-887.[DOI: 10.1109/APSIPA.2015.7415397]
-
[14] Tang C M, Dong Y C, Sun X, et al. Image restoration algorithm for single nighttime weakly illuminated haze image[J]. Journal of Computer-Aided Design & Computer Graphics, 2018, 30(3): 459–467. [汤春明, 董燕成, 孙欣, 等. 单幅夜间弱照度雾霾图像的复原算法[J]. 计算机辅助设计与图形学学报, 2018, 30(3): 459–467. ] [DOI:10.3724/SP.J.1089.2018.16308]
-
[15] Li C L, Song Y Q, Liu X F. Haze removal method for traffic images based on multi-scale retinex theory[J]. Journal of Computer Applications, 2015, 35(S2): 234–237. [李长领, 宋裕庆, 刘晓锋. 基于MSR理论的交通图像去雾霾方法[J]. 计算机应用, 2015, 35(S2): 234–237. ]
-
[16] Li Y F, He X H, Wu X Q. Improved enhancement algorithm of fog image based on multi-scale Retinex with color restoration[J]. Journal of Computer Applications, 2014, 34(10): 2996–2999, 3023. [李垚峰, 何小海, 吴小强. 改进的带色彩恢复的多尺度Retinex雾天图像增强算法[J]. 计算机应用, 2014, 34(10): 2996–2999, 3023. ] [DOI:10.11772/j.issn.1001-9081.2014.10.2996]
-
[17] Liu W J, Zhao Q G, Qu H C. Image defog algorithm based on variogram and morphological filter[J]. Journal of Image and Graphics, 2016, 21(12): 1610–1622. [刘万军, 赵庆国, 曲海成. 变差函数和形态学滤波的图像去雾算法[J]. 中国图象图形学报, 2016, 21(12): 1610–1622. ] [DOI:10.11834/jig.20161206]