A New Tone Mapping Operator Based on Twolayer Model(matlab)

%%
%2019-A New Tone Mapping Operator Based on Twolayer Model 
%2020年6月28日-2020年6月28日
clc
clear
img=hdrread('Bottles_Small.hdr');
[m,n,channel]=size(img);
%Luminance Layer Acquisition 
Lave=exp(mean2(log(0.001+img)));
Lwa=img./Lave;
L_wmax=max(max(img));
Lwa_max=L_wmax/Lave;
L=1./(log10(Lwa_max+1)).*((log(Lwa+1)./log(5))./(1+exp(-(log(Lwa)./log(5)))));
%Contrast Layer Acquisition 
f=fspecial('average',5);
Ladapted=imfilter(img,f,'conv','replicate');
V=exp(-(1/1.44).*(img./Ladapted));
alpha=1.1;
C=(img./Lave)./(alpha.*V+img./Lave);
%Operator Fusion
Ld=L.*C;
%gamma校正
gamma=0.4;
outimg=Ld.^gamma;
figure;imshow(outimg);

你可能感兴趣的:(HDR图像学习)