LDR圖像融合HDR: RamenTMO方法

參考文獻:

"Bilateral Filter Based Compositing for Variable Exposure Photography" by Shanmuganathan Raman and Subhasis Chaudhuri in Eurographics 2009 Short papers program

 

算法流程:

  1. Gamma變換計算歸一化的圖像隊列,範圍[0, 1]
  2. 計算圖像隊列中的最大最小值
  3. 計算雙邊濾波的sigma_s和sigma_r
  4. 對圖像隊列中的所有圖像計算其亮度圖像L
  5. 對亮度圖像L進行雙邊濾波得到L_filtered
  6. 計算權重和:
    1. 通過高頻圖像,計算單個圖像的權重:weight = abs(L - L_filtered) + C
    2. 計算所有圖像的權重和total
  7. 通過單個圖像的權重比計算混合圖像:imgOut = img(i) * weight / total
C = 70.0 / 255.0; %As reported in Raman and Chaudhuri
 
%number of images in the imageStack
[r, c, col, n] = size(imageStack);
 
K1 = 1.0; %As reported in Raman and Chaudhuri
K2 = 1.0 / 10.0; %As reported in Raman and Chaudhuri 
sigma_s = K1 * min([r, c]);
imageStackMin = min(imageStack(:));
imageStackMax = max(imageStack(:));
sigma_r = K2 * (imageStackMax - imageStackMin);
 
%Computation of weights for each image
total = zeros(r, c);
weight = zeros(r, c, n);
for i=1:n
    L = lum(imageStack(:,:,:,i));
    L_filtered = bilateralFilter(L, [], imageStackMin, imageStackMax, sigma_s, sigma_r);
    weight(:,:,i) = C + abs(L - L_filtered);
    total = total + weight(:,:,i);
end
 
%merging
imgOut = zeros(r, c, col);
for i=1:n
    for j=1:col
        tmp = imageStack(:,:,j,i) .* weight(:,:,i) ./ total;
        imgOut(:,:,j) = imgOut(:,:,j) + RemoveSpecials(tmp);
    end
end
 
%Clamping
imgOut = ClampImg(imgOut, 0.0, 1.0);

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章