[db:标题]
摘要:对于多图像的多曝光融合,在相机的应用中较为广泛,我们同时也可以认为这是另外一种的HDR算法,目前能够找到最为详细的和效果还不错的也包含本文所描述的
在SSE图像算法优化系列二十九:基础的拉普拉斯金字塔融合用于改善图像增强中易出现的过增强问题(一)一文中我们曾经描述过基于几种高频融合法则的拉普拉斯金字塔融合算法,那里是主要针对2副图像的。实际的应用中,我们可能会遇到多帧图像的融合过程(图像都是对齐后的),特别是多帧不同曝光度的图像的融合问题,在相机的应用中较为广泛,我们同时也可以认为这是另外一种的HDR算法。
这方面最经典的文章是2007年Tom Mertens等人发表的《Exposure Fusion》一文,用简单的篇幅和公式描述了一个非常优异的合成过程,虽然在2019年Charles Hessel发表了一篇《Extended Exposure Fusion》的文章中,提出了比Exposure Fusion更为优异的合成效果,但是代价是更高昂的计算成本,而Exposure Fusion也已经相当优秀了,本文主要简单记录下个人的Exposure Fusion优化过程。
Exposure Fusion的思路也非常之简单,输入是一系列图像对齐后的大小格式相同的图像,输出是一张合成的多细节图。那么在进行计算之前,他需要做以下的准备。
1、对每副图像按照某些原则计算每融合的权重。文章里提出了3种权重。
(1) 对比度:
Contrast:we apply a Laplacian filter to the grayscaleversion of each image, and take the absolute value ofthe filter response [16]. This yields a simple indicatorCfor contrast. It tends to assign a high weight to important elements such as edges and texture.
对应的matlab代码非常简单:
% contrast measure
function C = contrast(I)
h = [0 1 0; 1 -4 1; 0 1 0]; % laplacian filter
N = size(I,4);
C = zeros(size(I,1),size(I,2),N);
for i = 1:N
mono = rgb2gray(I(:,:,:,i));
C(:,:,i) = abs(imfilter(mono,h,'replicate'));
end
我们可以认为就是个边缘检测。
(2)饱和度
Saturation:As a photograph undergoes a longer exposure, the resulting colors become desaturated andeventually clipped. Saturated colors are desirable andmake the image look vivid. We include a saturationmeasureS, which is computed as the standard deviation within the R, G and B channel, at each pixel。
% saturation measure
function C = saturation(I)
N = size(I,4);
C = zeros(size(I,1),size(I,2),N);
for i = 1:N
% saturation is computed as the standard deviation of the color channels
R = I(:,:,1,i);
G = I(:,:,2,i);
B = I(:,:,3,i);
mu = (R + G + B)/3;
C(:,:,i) = sqrt(((R - mu).^2 + (G - mu).^2 + (B - mu).^2)/3);
end
也是非常简单的过程。
