HDR图像增强算法:PQ Curve &ReinHard

流程如下:

  1. FFMPEG 提取16bit图像
  2. 运用EOTF将16bit图像进行变换
  3. 色调映射,imgTMO = ReinhardTMO(out);
  4. 色彩校正,imgColor = ColorCorrection(imgTMO,1.2);
  5. gamma校正,imgOut = GammaTMO(imgColor, 2.2, 0, 1);
%% EOTF linearization 
function C = transformEOTF(CV_full, isQuantify, nb)
% CV_full is the component¡¯s full range digital code value
% N: nonlinear Img
% L: linear img
% C: luminance cd/m2
if strcmp(isQuantify, 'Quantify')
    bits= nb;
    maxV = 2^ bits;
    N = CV_full ./ (maxV-1);
else 
    N = CV_full;
end
 
m1 = 2610/4096* 1/4; %0.1593017578125
m2 = 2523/4096*128;  %78.84375
c1 = 3424/4096;     %0.8359375=c3-c2+1
c2 = 2413/4096*32;  %18.851625
c3 = 2392/4096*32;  %18.6875
inv_m2 = 1/m2;
inv_m1 = 1/m1;
Npower = N.^ inv_m2;
tmp = 0*Npower;
numerator = max((Npower - c1), tmp);
denominator = c2 - c3 .* (Npower);
L = (numerator ./ denominator) .^ inv_m1;
 
C = 10000 * L;
% plot(N,L);
end
function imgOut = ColorCorrection(img, cc_s)
% 色彩校正
if(cc_s < 0.0)
    cc_s = 0.5;
end
L = lum(img);
imgOut = zeros(size(img));
 
for i=1:size(img, 3)
    imgOut(:,:,i) = ((img(:,:,i) ./ L).^cc_s) .* L;
end
function imgOut = GammaTMO(img, TMO_gamma, TMO_fstop, TMO_view)
% gamma 校正
% TMO_gamma = 2.2;
% TMO_fstop = 0.0;
invGamma = 1.0 / TMO_gamma;
exposure = 2.^TMO_fstop;
%clamping values out of the range [0.0,1.0]
imgOut = ClampImg((exposure .* img).^invGamma, 0, 1);

if(TMO_view)
    imshow(imgOut);
end

原始图像

处理后图像

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值