在实际应用中,如果有至少两张图像,而这几张曝光都不好,那么怎样将他们融合在一起从而得到一张曝光较好的图像呢?
HDR(high dynamic range)或者叫WDR(wide dynamic range)是一个方向,2007年Mertens提出了从多曝光融合方向解决这个问题,下图解释两者区别
opencv提供了这个算法的接口
import cv2
mergeMertens = cv2.createMergeMertens()
exposureFusion = mergeMertens.process(images)
cv2.imwrite("exposure-fusion.jpg", exposureFusion * 255)
- YUV与RGB
YUV有多种格式,在此YUV指YCbCr,参考这个
原来CbCr指的是RGB中BR信号和亮度信息(Y)的差值
exposure fusion
论文 exposure fusion 2007 Mertens
挖坑
DeepFuse
17年的论文
the long exposure image (image captured with high exposure time) has better colour and structure information in dark regions and short exposure image (image captured with less exposure time) has better colour and structure information in bright regions.
长短曝光的对于亮暗区颜色和细节的侧重,和我们的问题相似
基于Y通道,feature extraction layers, a fusion layer and reconstruction layers
-
feature extraction layers
通过tied-weights setting, 不同的输入可以学习到除了亮度以外不变的量,即细节纹理等等,好像很有道理。和RetinexNet一样的思想 -
fusion layer - add最优秀(可以给我的uresnet添加这些操作)
文章说concate后通过增加宽度和迭代次数,即通过更多的参数也可以达到add相同的效果
- MEF SSIM loss function
文章说他这个叫no-inference image quality measure
,好像挺吸引人的
- SSIM
SSIM竟然是个等式2333,长见识了
C(contrast):对比度通过方差表示,离差(样本距离均值的值)的平方
L(luminance):亮度,均值表示
S(structure):结构,怎样评判图像的结构呢?他使用离差除以方差
离差:对于图像离差可以凸显出图像有差异的部分,咦,这不就是类似评判对比度。不是很懂,下面这个说是均值,方差和协方差/方差,那么协方差是什么?
- 协方差:协方差也是方差啊,衡量两个特征之间的相关性
- 相关系数:协方差/方差,归一化的相关系数,[-1,1]
上面大概了解了SSIM在干什么,但是我还是有个疑问,那就是离差
会是负的,正负相关对于我们来说不都是希望优化到0吗?正负平均了以后会有影响吗?
SSIM还有其他项,他们之间都是以均值为基础的,最后算出来的范围是[0,1]
就像上述等式,计算出来的结果是等于
的,一知半解。。。。
为了取得CS的最优,局部L无关紧要。。。
上面的‘|’是截屏不是公式的一部分
def w_fn(self, y):
"""
Return the weighting function that MEF-SSIM defines
We use the power engery function as the paper describe: https://ece.uwaterloo.ca/~k29ma/papers/15_TIP_MEF.pdf
Arg: y (torch.Tensor) - The structure tensor
Ret: The weight of the given structure
"""
out = torch.sqrt(torch.sum(y ** 2))
return out
- Cb/Cr fusion (Prabhakar et al. [18])
The fused chrominance value is obtained by weighing two chrominance values with subtracted value from itself. The value of is chosen as 128. The intuition behind this approach is to give more weight for good color components and less for saturated color values.
- Application to Multi-Focus Fusion
可以用在景深合成上