Print

发布时间: 2020-03-16
摘要点击次数:
全文下载次数:
DOI: 10.11834/jig.190201
2020 | Volume 25 | Number 3




    图像处理和编码    




  <<上一篇 




  下一篇>> 





改进双边滤波Retinex的多聚焦图像融合
expand article info 常戬, 任营, 贺春泽
辽宁工程技术大学, 葫芦岛 125105

摘要

目的 针对传统Retinex算法存在的泛灰、光晕、边界突出以及高曝光区域细节增强不明显的现象,将Retinex和多聚焦融合的思想融合在一起,提出一种基于Retinex的改进双边滤波的多聚焦融合算法。方法 首先根据图像情况在像素级层次将反射图像分解为最优亮暗区域两部分,然后利用线性积分变换和邻近像素最优推荐算法,将原始图像与最优亮区域多聚焦融合得到图像T,再将图像T与最优暗区域重复以上步骤得到图像S,最后利用引导滤波进行边界修复得到最终图像。结果 选择两组图像girl和boat进行实验,与SSR(single scale Retinex)、BSSR(Retinex algorithm based on bilateral filtering)、BIFT(Retinex image enhancement algorithm based on image fusion technology)和RVRG(Retinex variational model based on relative gradient regularization and its application)4种方法进行对比,本文方法在方差和信息熵两方面表现出明显优势。在均值方面,比BIFT和RVRG分别平均提高16.37和20.90;在方差方面,比BIFT和RVRG分别平均提高1.25和4.42;在信息熵方面,比BIFT和RVRG分别平均提高0.1和0.17;在平均梯度方面,比BIFT和RVRG分别平均提高1.21和0.42。对比BIFT和RVRG的实验数据,证明了本文方法的有效性。结论 实验结果表明,相比较其他图像增强算法,本文算法能更有效抑制图像的泛灰、光晕和边界突出现象,图像细节增强效果特别显著。

关键词

Retinex算法; 引导滤波; 最优亮暗区域; 邻近像素最优推荐算法; 改进双边滤波

Improved multifocus image fusion algorithm for bilateral filtering Retinex
expand article info Chang Jian, Ren Ying, He Chunze
Liaoning Technical University, Huludao 125105, China

Abstract

Objective Many image processing models and algorithms in the field of image processing exist at present. Retinex algorithms and multifocus image fusion algorithms in the field have become the most widely used image processing algorithms because of their simplicity, efficiency, and easy implementation. However, Retinex algorithms and multifocus image fusion algorithms have limitations on image processing. This study aims to combine the algorithm with the ideas of Retinex and multifocus image fusion algorithms to achieve image enhancement. In view of the traditional Retinex algorithms, graying, halo, and boundary phenomena are considered, as well as the problem in which the details of high-exposure area is not enhanced. The traditional multifocus image fusion algorithms must capture multiple images of different focus points in the same scene, extract the focus area from multiple images of different focus points, and operate the focus area for multifocus fusion. Extracting the repeated operations of multiple image focus areas for the multifocus fusion algorithm is necessary. This study proposes a multifocus image fusion algorithm based on Retinex the improved bilateral filtering of Retinex. Method The Retinex algorithm is used to improve the process of estimating illumination images. The effects of image space proximity similarity and pixel similarity on the enhancement effect are fully considered. The improved kernel function of the traditional Retinex algorithm is enhanced to obtain an improved bilateral filter function. First, the improved bilateral filtering function is used to estimate the illumination image, and the influence of the illumination image on the visual effect is reduced or suppressed, and then the reflected image of the essence of the response image is obtained. Furthermore, the optimal parameters of the optimal bright and dark regions are calculated at the pixel level of the reflected image, and the optimal parameters are brought into the algorithm to find the optimal solution. The optimal solution can be used to decompose the reflected image into the optimal bright region and the optimal dark area. In combination with the idea of multifocus image fusion algorithms, the original image is introduced at the same time, which can ensure the enhancement effect of the image and preserve the detail and quality in the original image, so that the enhancement effect is more obvious and clear. The original image, optimal bright region image, and optimal dark region image are multifocus fusion, and the linear integral transform and adjacent pixel optimal recommendation algorithm are used to obtain a smooth and accurate steering map. The steering filter is used to further smooth the steering map. Using the processed guide map as a basis, the original image and optimal bright region are fused according to different focal lengths to obtain an image T. The image T is repeated with the optimal dark region image to obtain the process image S by the aforementioned experimental steps and finally utilized. The pilot filter performs boundary repair on the process image S to obtain a final result image. Result Pictures of a girl and a boat, which were selected for comparison experiments, with single-scale Retinex algorithm, bilateral filter-based Retinex algorithm, BIFT algorithm (Retinex image enhancement algorithm based on image fusion technology), and RVRG algorithm (Retinex variational model based on relative gradient regularization and its application). The proposed algorithm shows obvious advantages in variance and information entropy, specifically with the average of 16.37 higher than that of BIFT, and the average is increased by 20.90 compared with RVRG. The average increase is 1.25 higher compared with BIFT in terms of variance, which is an average increase of 4.42 compared with that of RVRG. In terms of information entropy, the average increase is 0.1 compared with that of BIFT, which is an average increase of 0.17 compared with that of RVRG. In terms of average gradient, the average increase was 1.21 compared with that of BIFT, which was an average increase of 0.42 compared with that of RVRG. Experimental data comparing BIFT and RVRG demonstrate the effectiveness of the proposed algorithm. The details in the original image and the dark portion of the right side of the car body in the image of the girl are significantly enhanced, and the details of the bright areas in the original image are well-preserved while being enhanced. The overall pixel value of the image is low and the visual effect is darker in the image of the boat. After the enhancement, the outline of the character is clear, the water surface is distinct, and the reef texture enhancement effect is remarkable. Conclusion The extensive experiments show that due to the uncertainty of the process of acquiring images and the complexity of image information, the traditional algorithms are inevitably limited and the enhancement effect cannot meet the high-quality requirements of image preprocessing. Compared with the traditional algorithms, the combination of Retinex and multifocus fusion algorithms proposed in this paper has a better image enhancement effect. Compared with the single-scale Retinex, bilateral filter-based Retinex, BIFT, and RVRG, the reconstructed image is superior to the contrast algorithm at the subjective and objective levels. The objective evaluation parameters of the resulting image are greatly improved, especially in terms of information entropy. The algorithm in this paper can effectively suppress image graying, halo, and boundary prominent phenomena. The contrast is significantly enhanced and has a good enhancement effect on uneven illumination images and low contrast images, making it superior to other contrast algorithms in image enhancement and robustness. The image detail enhancement effect is particularly remarkable because it serves as the foundation for the subsequent image processing.

Key words

Retinex algorithm; guided filtering; optimal bright and dark regions; generalized random walk; improved bilateral filtering

0 引言

目前,数字图像处理科学与技术在利用其他学科研究成果的同时,也在逐步向其他学科领域渗透,已成为人类获取信息的重要来源及利用信息的重要手段。在信息社会中,图形处理无论在理论上还是在实践中,都有着巨大潜力。图像增强技术在图像受到外界因素影响时起到重要作用,通过图像增强算法可以保留图像纹理信息,丰富图像细节特征,增强图像细节视觉效果。图像增强已经成功地应用在天文学、生物学、核医学、法律实施、国防和工业领域中(冈萨雷斯和伍兹,2017)。

传统的图像增强算法主要分空间域和频率域。空间域内增强包括灰度变换、直方图均衡化增强、中值滤波法、均值滤波法等;频率域内增强包括小波变换、哈尔变换、图像金字塔、统计插值法、匹配掩模法等,以上传统滤波方法只针对特定类型的图像增强,并不能普遍适用于复杂情况。针对上述缺点,Land(1977)提出了Retinex理论,Retinex由retina和cortex两个单词组成,即视网膜和皮层,该算法模仿人类视觉系统,实现了图像增强效果。40多年来,众多研究人员不断发展和丰富Retinex算法,从最初的单尺度SSR(single scale Retinex)(Kiragu和Mwangi,2012)发展到多尺度MSR(multi-scale Retinex)(Okuno和Nishitani,2009)、从单色的增强算法发展到带色彩恢复的多尺度视网膜增强算法MSRCR(MSR with color restoration)(Parthasarathy和Sankaran,2012),还有很多研究人员提出基于Retinex模型的增强算法,除了主要用于解决光照不均和色偏等问题外,该算法也广泛应用于雾霾图像(李喆等,2019)和水下图像等图像处理任务中,获得了高对比度的图像增强效果(谢凤英等,2019)。多聚焦算法的提出克服了光学镜头景深有限的问题,将多幅聚焦范围不同的图像中的清晰区域或像素提取出来,显示在一幅图像中(袁娅婷,2018)。彭真明等人(2014)提出基于多尺度稀疏字典的多聚焦图像超分辨融合算法,对图像清晰度进行度量,并利用多尺度稀疏字典对度量后的清晰区域进行超分辨重建。利用稀疏字典需要准备多尺度稀疏字典的需求,需要大量同一类型的图像生成满足稀疏表示的字典。将多聚焦算法的思想应用到Retinex算法中,将单幅图像的明暗区域的最优解图像分解成聚焦范围不同的图像,再通过这几幅图像融合成最终的最优解图像。Retinex虽然能解决一些图像增强问题,但也存在某些问题,例如图像像素灰度级剧烈变化时会产生光晕现象;图像存在噪声时,Retinex算法不仅没有抑制噪声,而且还会放大噪声,给下一步的图像处理带来不便;此外,尽管Retinex算法对图像有很明显的增强效果,但是当图像明亮度不高时还会出现泛灰现象。多聚焦融合算法必须在同一场景下拍摄不同聚焦点的多幅图像,通过分析这些图像,分割出高清晰度的聚焦区域,再按照一定融合规则获得结果图像,多聚焦算法对图像拍摄的质量有非常高的要求,具有一定的局限性。

针对上述不足,本文提出一种基于Retinex的改进双边滤波的多聚焦融合算法,有效改善了Retinex算法出现泛灰和光晕现象的问题,本文算法只需单幅图像,将其分解出最优亮暗图像进行处理,极大解决了拍摄过程中的误差问题,解决了多聚焦算法需要多幅图像的局限性问题,同时也解决了一般融合算法中产生的边界突出现象。实验结果图像的增强效果大幅提升,纹理细节处理更丰富,并有效保留了边缘信息。

1 相关算法

1.1 Retinex算法

Retinex算法的基础是认为物体颜色是由光线的反射能力而不是反射强度的绝对值决定的,该算法认为图像分为反射图像$\mathit{\boldsymbol{R}}\left({x, y} \right)$和光照图像$\mathit{\boldsymbol{L}}\left({x, y} \right)$两部分,即

$ \mathit{\boldsymbol{S}}\left( {x,y} \right) = \mathit{\boldsymbol{R}}\left( {x,y} \right) \times \mathit{\boldsymbol{L}}\left( {x,y} \right) $ (1)

式中,$\mathit{\boldsymbol{S}}\left({x, y} \right)$$\mathit{\boldsymbol{R}}\left({x, y} \right)$$\mathit{\boldsymbol{L}}\left({x, y} \right)$分别表示原始图像、反射图像、光照图像。$\mathit{\boldsymbol{L}}\left({x, y} \right)$可由$\mathit{\boldsymbol{S}}\left({x, y} \right)$卷积高斯核函数$\mathit{\boldsymbol{F}}\left({x, y} \right)$表示。

将式(1)变换到对数域估计光照图像,将乘法运算转换为加法运算,且对数域的结果更接近于人眼的感知能力,传统Retinex算法利用高斯核函数估计光照图像,消除光照图像对原始图像的影响,具体公式为

$ \mathit{\boldsymbol{S'}}\left( {x,y} \right) = {\log _a}\mathit{\boldsymbol{S}}\left( {x,y} \right) - {\log _a}\left[ {\mathit{\boldsymbol{F}}\left( {x,y} \right) \oplus \mathit{\boldsymbol{S}}\left( {x,y} \right)} \right] $ (2)

$ \mathit{\boldsymbol{F}}\left( {x,y} \right) = \rho + {{\rm{e}}^{ - \frac{{{x^2} + {y^2}}}{{{\sigma ^2}}}}} $ (3)

式中,$a$一般赋值为10,$ \oplus $为卷积符号,$\sigma $为高斯环绕尺寸,$\rho $为归一化参数,${\rm{e}}$为常量。

1.2 多聚焦算法

多聚焦融合是图像融合领域的重要组成部分,多聚焦融合算法可分为3个层次:决策级、特征级、像素级。目前最常用的是像素级的多聚焦融合,像素级多聚焦融合又可以分为空域和频域两种方式,空域方法包括加权平均、分块融合、像素值取大或取小的融合方法,该类方法的最大缺点是产生块效应。频域方法包括多分辨率融合、金字塔融合和小波融合等。该算法思想是从多幅图像中提取聚焦部分,按照一定的融合规则融合到结果图像中以获得清晰图像。

2 本文算法

本文算法利用改进的双边滤波估计原始图像的反射图像,避免结果图像的光晕现象,根据图像亮暗区域分布情况,将结果图像分解成最优亮暗区域,然后分别将原始图像和最优区域图像利用线性积分变换求出导向图(Nayar和Nakagawa,1990),可从聚焦图像中分割出来的部分精确对齐,并用导向滤波(方帅等,2012)使导向图边界光滑,利用邻近像素最优推荐算法(Ma等,2017)根据导向图多聚焦原始图像和最优亮区域得到结果图像,得到的结果图像和最优暗区域,重复以上过程得到最终图像。本文算法流程如图 1所示。具体步骤如下:

图 1 本文算法流程图
Fig. 1 Algorithm flow chart

1) 输入原始图像,利用改进的双边滤波估计光照图像。

2) 利用步骤1)中估计的光照图像求得表达物体本质的反射图像。

3) 根据图像亮暗分布,将图像分割成亮区域和暗区域两部分,并计算各自的信息熵。以信息熵基准求出最优参数。

4) 得到亮区域最佳参数和暗区域的最佳参数,求得亮区域最优图像和暗区域最优图像。

5) 将原始图像、亮区域最优图像代入线性积分变换得到导向图。

6) 利用邻近像素最优推荐算法,根据导向图进行图像分割,分割后图像进行加权融合。

7) 利用导向图对多聚焦融合得到图像T

8) 将图像T、暗区域最优图像代入线性积分变换得到导向图。

9) 利用邻近像素最优推荐算法,根据导向图进行图像分割,分割后图像进行加权融合。

10) 利用导向图对多聚焦融合得到图像S

2.1 光照图像估计

传统Retinex利用高斯核函数估计光照图像,得到的结果图通常会出现泛灰和光晕现象,为了改善以上不足,提出用改进的双边滤波代替高斯核函数,从而避免产生泛灰和光晕现象。改进的双边滤波是结合图像空间邻近度和像素相似度的滤波器,可以在有效保持边缘信息的同时,有效抑制泛灰和光晕现象,具体为

$ {\mathit{\boldsymbol{I}}_D}\left( {i,j} \right) = \frac{{\sum\limits_{k = 1}^j {\mathit{\boldsymbol{I}}\left( {k,l} \right) \times W\left( {i,j,k,l} \right)} }}{{\sum\limits_{k = 1}^l {W\left( {i,j,k,l} \right)} }} $ (4)

式中,${\mathit{\boldsymbol{I}}_D}\left({i, j} \right)$为输出图像,$\mathit{\boldsymbol{I}}\left({k, l} \right)$为原始图像,$W\left({i, j, k, l} \right)$为空间邻近度和像素相似度的核函数,具体为

$ \begin{array}{*{20}{c}} {W\left( {i,j,k,l} \right) = }\\ {\exp \left( { - \frac{{{{\left( {i - k} \right)}^2} + {{\left( {j - l} \right)}^2}}}{{2\delta _d^2}} - \frac{{{{\left\| {{\mathit{\boldsymbol{I}}_D}(i,j) - \mathit{\boldsymbol{I}}(k,l)} \right\|}^2}}}{{2\delta _r^2}}} \right)} \end{array} $ (5)

式中,$\mathit{\boldsymbol{I}}\left({k, l} \right)$为原始图像,${\mathit{\boldsymbol{I}}_D}\left({i, j} \right)$为估计得到的光照图像,$\delta _d^2$为距离参数,$\delta _r^2$为亮度参数。本文针对双边滤波的空间邻近度的参数进行改进,以求达到更好的保持边缘梯度的效果,计算公式为

$ \begin{array}{*{20}{c}} {W\left( {i,j,k,l} \right) = \left( {1 - \sqrt {\frac{{{{(i - k)}^2} + {{(j - l)}^2}}}{p}} } \right) \times }\\ {\exp \left( {\frac{{{{\left\| {{\mathit{\boldsymbol{I}}_D}(i,j) - \mathit{\boldsymbol{I}}(k,l)} \right\|}^2}}}{{2\sigma _r^2}}} \right)}\\ {\sqrt {{{(i - k)}^2} + {{(j - l)}^2}} \le p} \end{array} $ (6)

式中,$p$为滤波器的窗口参数。根据像素点与窗口中心像素值的距离决定平滑权重系数。若像素点邻近滤波器窗口时,根据欧几里得距离调节权重参数;若距离较远,则将权重参数置为零,消除对距离较远的像素点的影响,使得处理后的图像有更好的动态特性,有效保持边缘梯度,Retinex增强效果显著提高。

2.2 分解最优亮暗区域

利用改进的双边滤波估计出光照图像后,根据图像像素亮暗分布情况,将结果图像分成亮、暗区域两部分,根据图像信息熵选取最优亮暗区域参数,最终得到最优亮暗区域,分别对亮暗区域进行分步融合,可根据算法获取亮暗区域处理效果好的像素区域。如图 2所示,最优暗区域对房前黑暗的部分处理效果明显,最优亮区域对房屋的主墙壁细节保留完整。原图中的天空云彩部分的层次感是最优亮暗区域无法保留的,所以本文算法选择将原图、最优亮区域和最优暗区域一起融合,最大程度增强图像。

图 2 分解最优亮暗区域
Fig. 2 Separation of optimal light and dark areas ((a)original image; (b)optimal dark area; (c)optimal bright area)

2.3 多聚焦融合

本文将Retinex图像增强模型和多聚焦融合思想相结合,首先将原始图像利用改进的双边滤波估计光照图像,消除光照图像对原始图像的影响,再根据图像像素亮暗分布情况分割,将输出的最优亮、暗区域图像和原始图像进行多聚焦融合,获取最优的像素块,将其融合后的图像利用导向滤波平滑边缘,使结果图像更为平滑自然。

本文利用线性积分变换,以原始图像为参照,计算最优亮区域与原始图像的焦距得到导向图。其中,线性积分变换为

$ \begin{array}{*{20}{c}} {\nabla \mathit{\boldsymbol{I}}\left( {i,j} \right) = }\\ {\sqrt {\begin{array}{*{20}{c}} {\mathit{\boldsymbol{I}}(i,j) + \mathit{\boldsymbol{I}}(i - 1,j) + \mathit{\boldsymbol{I}}(i,j + 1) + }\\ {\mathit{\boldsymbol{I}}(i,j - 1) - 4\mathit{\boldsymbol{I}}(i,j)} \end{array}} } \end{array} $ (7)

式中,$\mathit{\boldsymbol{I}}\left({i, j} \right)$是输入图像。本文算法将像素之间的可变间距设置为1,以像素间的关联性来达到希望的实验精度,得到更好的实验效果。即

$ \begin{array}{*{20}{c}} {SUML(\mathit{\boldsymbol{I}}(x,y),R) = \sum\limits_{i = x - N}^{i = x + N} {\sum\limits_{j = y - N}^{j = y + N} \nabla } \mathit{\boldsymbol{I}}(i,j)}\\ {\nabla \mathit{\boldsymbol{I}}\left( {i,j} \right) \ge 0} \end{array} $ (8)

式中,$R$为窗口半径。本算法将$T$阈值设置为0(付忠良,2000),得到精准导向图,若设置过大,会导致导向图模糊,细节丢失严重,为保证导向图精确对齐,设置为0(Nayar和Nakagawa,1994)。

随机游走是一种基于图论的半自动图像分割方法,本质上是归一化分割(Grady,2006)。基本思想是将图像看成由固定的顶点和边组成的连通带权的无向图,从未标记点随机漫步,首次到达各类标记顶点的概率代表了未标记归属于标记类的可能性,把最大的概率所在的类的标签赋给未标记点,完成分割(茅正冲和韩毅,2018)。邻近像素最优推荐算法根据导向图将聚焦区域从原图中按像素位置取出(王梅和李玉鑑,2013),具体为

$ \begin{array}{*{20}{c}} {{\mathit{\boldsymbol{S}}_{i,j}} = \mathit{\boldsymbol{S}}\left( {{v_i},{v_j}} \right) = }\\ {\left\{ {\begin{array}{*{20}{l}} {{y_{i - p,j}}}&{\left( {{v_i},{v_j}} \right) \in {\varepsilon _\chi } \wedge {v_j} \in \zeta }\\ {{\omega _{i - p,j - p}}}&{\left( {{v_i},{v_j}} \right) \in {\varepsilon _\chi }} \end{array}} \right.} \end{array} $ (9)

式中,${v_i}$表示标签像素点,${v_j}$表示其余像素点,$\zeta $是标签,${\mathit{\boldsymbol{\omega }}_{i - p, j - p}}$是像素之间相似性权重,${y_{i - p, j}}$是标签与像素之前的权重, ${\varepsilon _\chi }$表示图像标签像素外,像素之间的相似关系。能量值$E$的计算公式为

$ E = \frac{1}{2}\sum\limits_{\left( {{v_i},{v_j}} \right) \in \mathit{\boldsymbol{\varepsilon }}} {{S_{i,j}}} {\left( {f\left( {{v_i}} \right) - f\left( {{v_j}} \right)} \right)^2} $ (10)

式中,$f\left(\cdot \right)$函数目标是寻求最小化能量,此函数根据矩阵有效计算能量值$E$

以导向图参照利用邻近像素最优推荐算法对最优亮区域和原始图像进行分割,融合后图像会产生明显的融合块效应,融合边界明显效果不自然,利用导向滤波对融合后的图像进行导向滤波,可有效消除融合后融合边界明显的问题。

3 实验结果和分析

3.1 融合边界实验

为了更好说明本文算法的优越性,将本文算法与BIFT算法(Retinex image enhancement algorithm based on image fusion technology)对room图像的增强结果进行比较(常戬等,2018),结果如图 3所示。BIFT算法中,房前位置亮度较低且存在泛灰问题,本文算法房子前的位置对比度明显提高,纹理更为清晰,边缘保留效果好,对细节的增强更为突出。本文算法中,天空云彩位置的层次更为突出,本文算法对边缘梯度保持效果大大提升。表 1是BIFT算法与本文算法对room图像增强的参数对比。从表 1可以看出,BIFT算法平均梯度高于本文算法,在均值和方差基本持平的情况下,本文算法的信息熵提高了0.33。信息熵表示图像信息的丰富度,是一个衡量图像融合的重要指标。综合以上分析,本文算法求得局部最优解,将原始图像分解为最优亮、暗区域,利用多聚焦融合思想分别融合原始图像、最优亮区域图像和最优暗区域图像的局部最优区域,极大增强了图像的对比度和细节信息,比BIFT算法得到了更好的视觉效果。

图 3 不同BIFT算法和本文算法对room图像增强的对比结果
Fig. 3 Results of comparison of room image enhancement
((a) BIFT; (B) ours)

表 1 BIFT与本文算法对room图像增强参数对比
Table 1 Comparison of parameters between BIFT algorithm and ours for room image enhancement

下载CSV
图像 参数
均值 方差 信息熵 平均梯度
原图 84.93 77.95 7.54 8.43
BIFT算法增强 120.93 72.11 7.62 24.76
本文算法增强 120.19 71.35 7.95 16.94
注:加粗字体表示最优结果。

本文算法将原始图像运用Otus阈值分割算法计算分割阈值,根据该阈值得到最优亮、暗区域两部分;利用线性积分变换和邻近像素最优推荐算法分别提取图像中的最优区域,根据引导图像加权融合,最后利用引导滤波修复边界得到结果图像。本文算法极大限度地将信息丰富度高的区域融合,达到提高结果图像的增强效果。

3.2 实验结果分析

为验证本文算法的有效性和鲁棒性,分别对girl(429×284像素)和boat(584×385像素)两组图像用本文算法与BIFT算法、RVRG算法(Retinex variational model based on relative gradient regularization and its application)(智宁等,2017)进行实验。图像融合质量评价标准包括主观和客观评价标准(刘玉红,2018),人作为图像信息的最终接受者,其主观评价是最可靠的标准,但是与主观评价标准相比,客观评价标准更稳定,且便于与其他算法结果相对比。本文选择主观评价与客观评价相结合的方法,选取均值、方差、信息熵和平均梯度4个参数作为客观评价标准。

1) 均值。均值反映图像的亮暗程度,均值越大,图像越亮;均值越小,图像越暗。计算公式为

$ ME = \frac{{\sum\limits_{i = 1}^M {\sum\limits_{j = 1}^N f } (i,j)}}{{M \times N}} $ (11)

式中,$M \times N$表示图像大小。

2) 方差。方差反映图像的对比度。计算公式为

$ MS = \sum\limits_{i = 0}^M {\sum\limits_{j = 0}^N {{{\left| {f\left( {{x_i},{y_j}} \right) - \mu } \right|}^2}} } $ (12)

式中,$\mu $为平均灰度值。

3) 信息熵。信息熵是衡量图像信息丰富度的重要标准(Shannon,1941),熵值越大,图像信息越丰富,图像越清晰;熵值越小,图像细节丢失越严重。计算公式为

$ IE = - \sum\limits_{i = 0}^{L - 1} {{P_i}} \ln \left( {{P_i}} \right) $ (13)

式中,${P_i}$是图像像素值出现的概率,$L$为灰度级数,通常范围是0~255。

4) 平均梯度。平均梯度反映图像的清晰度,平均梯度越大,图像越清晰;平均梯度越小,图像越模糊。计算公式为

$ \begin{array}{*{20}{c}} {AG = \frac{1}{{M \times N}} \times \sum\limits_{i = 1}^M {\mathop \sum \limits_{j = 1}^N } }\\ {\sqrt {\frac{1}{2}\left( {{{(f(i,j) - f(i + 1,j))}^2} + {{(f(i,j) - f(i,j + 1))}^2}} \right)} } \end{array} $ (14)

式中,$M \times N$表示图像大小。

图 4图 5分别是SSR(single scale Retinex)、BSSR(retinex algorithm based on bilateral filtering)、BIFT、RVRG和本文算法等5种算法对girl和boat图像增强的结果图。从主观视觉观察图 4图 5,可以看出单尺度Retinex结果图像存在泛灰和光晕现象,整体亮度偏低。在光照不均匀的图像中,像素灰度级变化陡峭的位置容易出现光晕现象,例如图 4女孩的头顶位置。基于双边滤波的Retinex算法BSSR用双边滤波代替传统的高斯核函数,相较SSR算法改善了泛灰现象,但结果图像还是存在对比度低的现象,如图 5中人物只突显了人物轮廓但增强效果不明显。RVRG实验结果整体模糊,轮廓损失严重,图 4中女孩身体部分对比度低,亮度不够,图 5中水面过平滑,有过增强的效果,未能保留水波纹理细节。图 4图 5的参数对比如表 2表 3所示。

图 4 5种算法对girl图像增强的结果图
Fig. 4 Results of five algorithms for girl image enhancement
((a) original image; (b) SSR; (c) BSSR; (d) BIFT; (e) RVRG; (f) ours)
图 5 5种算法对boat图像增强的结果图
Fig. 5 Results of five algorithms for boat image enhancement
((a) original image; (b) SSR; (c) BSSR; (d) BIFT; (e) RVRG; (f) ours)

表 2 5种算法对girl图像增强参数对比
Table 2 Comparison of parameters of five algorithms for girl image enhancement

下载CSV
图像 参数
均值 方差 信息熵 平均梯度
原图 52.59 66.50 6.73 4.52
SSR算法增强 89.74 53.21 7.48 8.60
BSSR算法增强 110.28 64.39 7.77 10.63
BIFT算法增强 93.57 66.08 7.68 8.74
RVRG算法增强 89.71 63.53 7.61 11.07
本文算法增强 112.30 67.31 7.82 9.91
注:加粗字体表示最优结果。

表 3 5种算法对boat图像增强参数对比
Table 3 Comparison of parameters of five algorithms for boat image enhancement

下载CSV
图像 参数
均值 方差 信息熵 平均梯度
原图 40.53 26.09 6.37 3.14
SSR算法增强 91.11 31.21 6.96 6.06
BSSR算法增强 124.43 40.06 7.35 8.31
BIFT算法增强 128.80 53.95 7.70 12.57
RVRG算法增强 121.59 50.16 7.64 11.81
本文算法增强 140.80 55.22 7.76 13.81
注:加粗字体表示最优结果。

综合上述分析,本文算法采用改进的双边滤波代替高斯核函数,改善了传统Retienx模型的泛灰现象,根据图像像素值将原始图像分割成最优亮、暗区域分别处理,可抑制图像融合时由于亮暗区域像素灰度级差距较大产生的边缘效应。同时,利用线性积分变换得到导向图,导向图可将细节部分都显示出来,对图像的细节增强有突出作用。然后,利用导向图采用邻近像素最优推荐算法分割图像,再用导向滤波平滑融合后的图像,使融合效果更为自然。在与其他算法的客观指标比较中,在均值、方差、信息熵方面,本文算法都得到5种算法中的最优值,得到的衡量参数也都远优于其他算法。在平均梯度方面,本文算法也取得很好的增强效果,无论主观还是客观评价标准,本文算法在亮度提升、对比度增强、信息丰富程度和清晰度等方面都得到了显著提高。

3.3 算法复杂度分析

在同等实验条件下对各算法的复杂性进行分析。估计光照图像的复杂度决定了算法的运算效率,SSR和BSSR算法均在估计光照图像时运算频率达到最高值。BIFT算法利用高斯加权双边滤波估计光照图像,通过改进双边滤波中与光照强度相关的参数调整像素点间的亮暗差异程度。所以BIFT、SSR和BSSR算法具有相同的时间复杂度,但BIFT算法中的高斯加权函数运算复杂度较高,使其空间复杂度增大,与传统的SSR和BSSR算法相比,对图像的增强程度相对提高。本文算法为达到更好保持边缘梯度的效果,采用改进双边滤波代替高斯核函数进行光照图像估计,对双边滤波的空间邻近度的参数进行改进,在一定出程度上提升了运算效率。

为了更直观地对比各算法的运算效率,本文对各算法进行了耗时测试,结果如表 4所示。从表 4可以看出,与BIFT算法相比,本文算法运算时间短,客观对比数据有大幅提升。由于本文算法在计算导向图时需要进行多次迭代运算,因此耗时比RVRG算法时间稍长。在相差时间不多的情况下,本文算法处理结果的各项数据均有所提高,实验效果提升显著。综合比较各算法的实验结果和复杂性分析情况,本文算法在时间消耗差异不大的情况下,有效消除了泛灰、光晕、边界突出以及高曝光区域细节增强不明显等现象,在处理细节上改善效果明显。

表 4 不同算法对girl和boat图像增强耗时
Table 4 Time-consuming of girl and boat images enhancement by different algorithms  

下载CSV
/s
算法 girl图像 boat图像
SSR 1.44 0.76
BSSR 2.68 1.49
BIFT 24.02 13.74
RVRG 12.5 2.01
本文 13.78 2.79

4 结论

结合Retinex模型和多聚焦融合思想,提出一种基于Retinex的改进双边滤波的多聚焦融合算法,并通过实验验证了算法的可行性,得到以下结论:1)在估计光照图像的过程中充分考虑图像空间邻近相似度和像素相似度的影响,对高斯核函数进行改进,提出改进的双边滤波,避免出现泛灰和光晕现象,以得到更能反映图像本质的反射图像; 2)利用导向滤波对融合后的图像进行处理,解决融合后图像边界突出现象,使图像的增强效果得到进一步提升; 3)Retinex模型和多聚焦融合思想的结合对图像增强效果明显,克服了图像对比度不足和细节增强不充分问题; 4)相同条件下,相较于传统的Retinex、BIFT、RVRG算法,本文算法图像增强效果更好, 在均值、方差、信息熵和平均梯度方面都取得很好结果; 5)本文算法在图像分割的细节处理上仍存在不足,在今后的研究中,将考虑运用卷积神经网络进行图像分割来改进实验效果,进一步提升图像细节信息的获取; 6)本文算法对图像的增强效果显著,可应用于人工智能、摄像测量、工业控制等多个领域,适用范围和应用场景广泛。

参考文献

  • Chang J, Liu W, Bai J H. 2018. A Retinex image enhancement algorithm based on image fusion technology. Computer Engineering and Science, 40(9): 1624-1635 (常戬, 刘旺, 白佳弘. 2018. 基于图像融合技术的Retinex图像增强算法. 计算机工程与科学, 40(9): 1624-1635) [DOI:10.3969/j.issn.1007-130X.2018.09.015]
  • Fang S, Yang J R, Cao Y, Wu P F, Rao R Z. 2012. Local multi-scale Retinex algorithm based on guided image filtering. Journal of Image and Graphics, 17(7): 748-755 (方帅, 杨静荣, 曹洋, 武鹏飞, 饶瑞中. 2012. 图像引导滤波的局部多尺度Retinex算法. 中国图象图形学报, 17(7): 748-755) [DOI:10.11834/jig.20120702]
  • Fu Z L. 2000. The making of method for image threshold selection. Journal of Image and Graphics, 5(6): 466-469 (付忠良. 2000. 图象阈值选取方法的构造. 中国图象图形学报, 5(6): 466-469) [DOI:10.3969/j.issn.1006-8961.2000.06.004]
  • Gonzalez R C, Woods R E. 2017. Digital Image Processing. Ruan Q Q and Ruan Y Z, trans. 3rd ed. Beijing: Publishing House of Electronics Industry: 4-17 (冈萨雷斯, 伍兹. 2017.数字图像处理.阮秋琦, 阮宇智, 译. 3版.北京: 电子工业出版社: 4-17)
  • Grady L. 2006. Random walks for image segmentation. IEEE Transactions on Pattern Analysis and Machine Intelligence, 28(11): 1768-1783 [DOI:10.1109/TPAMI.2006.233]
  • Kiragu H, Mwangi E. 2012. An improved enhancement of degraded binary text document images using morphological and single scale Retinex operations//Proceedings of 2012 IET Conference on Image Processing. London: IET: 112-112[DOI:10.1049/cp.2012.0420]
  • Land E H. 1977. The Retinex theory of color vision. Scientific American, 237(6): 108-128 [DOI:10.1038/scientificamerican1277-108]
  • Li Z, Li J Z, Hu Y J, Zhang Y. 2019. Mixed prior and weighted guided filter image dehazing algorithm. Journal of Image and Graphics, 24(2): 170-179 (李喆, 李建增, 胡永江, 张岩. 2019. 混合先验与加权引导滤波的图像去雾算法. 中国图象图形学报, 24(2): 170-179) [DOI:10.11834/jig.180450]
  • Liu Y H. 2018. Research on Image Enhancement and Quality Assessment Based on Biological Visual Perception Mechanism. Chengdu: University of Electronic Science and Technology of China (刘玉红. 2018. 基于生物视觉感知机制的图像增强及质量评价的研究. 成都: 电子科技大学)
  • Ma J L, Zhou Z Q, Wang B, Dong M J. 2017. Multi-focus image fusion based on multi-scale focus measures and generalized random walk//Proceedings of the 36th Chinese Control Conference. Dalian, China: IEEE: 5464-5468[DOI:10.23919/ChiCC.2017.8028223]
  • Mao Z C, Han Y. 2018. Automatic image segmentation algorithm based on random walk. Transducer and Microsystem Technologies, 37(6): 142-145 (茅正冲, 韩毅. 2018. 基于随机游走的自动图像分割算法. 传感器与微系统, 37(6): 142-145) [DOI:10.13873/j.1000-9787(2018)06-0142-04]
  • Nayar S K, Nakagawa Y. 1990. Shape from focus: an effective approach for rough surfaces//Proceedings of 1990 IEEE International Conference on Robotics and Automation. Cincinnati: IEEE: 218-225[DOI:10.1109/ROBOT.1990.125976]
  • Nayar S K, Nakagawa Y. 1994. Shape from focus. IEEE Transactions on Pattern Analysis and Machine Intelligence, 16(8): 824-831 [DOI:10.1109/34.308479]
  • Okuno T, Nishitani T. 2009. Efficient multi-scale Retinex algorithm using multi-rate image processing//Proceedings of the 16th IEEE International Conference on Image Processing. Cairo: IEEE: 3145-3148[DOI:10.1109/ICIP.2009.5414428]
  • Parthasarathy S, Sankaran P. 2012. Fusion based multi scale Retinex with color restoration for image enhancement//Proceedings of 2012 International Conference on Computer Communication and Informatics. Coimbatore: IEEE: 1-7[DOI:10.1109/ICCCI.2012.6158793]
  • Peng Z M, Jing L, He Y M, Zhang P. 2014. Superresolution fusion of multi-focus image based on multiscale sparse dictionary. Optics and Precision Engineering, 22(1): 169-176 (彭真明, 景亮, 何艳敏, 张萍. 2014. 基于多尺度稀疏字典的多聚焦图像超分辨融合. 光学精密工程, 22(1): 169-176) [DOI:10.3788/OPE.20142201.0169]
  • Shannon C E. 1941. Mathematical theory of the differential analyzer. Studies in Applied Mathematics, 20(1/4): 337-354 [DOI:10.1002/sapm1941201337]
  • Wang M, Li Y J. 2013. An improved random walk algorithm for image segmentation. Computer and Modernization, (8): 1-6 (王梅, 李玉鑑. 2013. 一种改进的随机游走图像分割算法. 计算机与现代化, (8): 1-6) [DOI:10.3969/j.issn.1006-2475.2013.08.001]
  • Xie F Y, Tang M, Zhang R. 2019. Review of image enhancement algorithms based on Retinex. Journal of Data Acquisition and Processing, 34(1): 1-11 (谢凤英, 汤萌, 张蕊. 2019. 基于Retinex的图像增强方法综述. 数据采集与处理, 34(1): 1-11) [DOI:10.16337/j.1004-9037.2019.01.001]
  • Yuan Y T. 2018. Research on Filtering Based Multi-Focus Image Fusion Algorithm. Xi'an: Northwest University (袁娅婷. 2018. 基于滤波的多聚焦图像融合算法研究. 西安: 西北大学)
  • Zhi N, Mao S J, Li M. 2017. Variational Retinex model based on an extension of TV regularization with relative gradient and its applicationRetinex. Journal on Communications, 38(11): 65-75 (智宁, 毛善君, 李梅. 2017. 基于相对梯度正则化的Retinex变分模型及其应用. 通信学报, 38(11): 65-75) [DOI:10.11959/j.issn.1000-436x.2017212]