A novel tone mapping algorithm(matlab)

%%
%2019-A novel tone mapping algorithm 
%2020年6月28日-2020年6月28日
clc
clear
img=hdrread('Oxford_Church.hdr');
%转为XYZ空间
X=0.412453*img(:,:,1)+0.357580*img(:,:,2)+0.180423*img(:,:,3);
Y=0.212675*img(:,:,1)+ 0.715160*img(:,:,2)+ 0.072169*img(:,:,3);
Z=0.019334*img(:,:,1)+ 0.119193*img(:,:,2)+ 0.950227*img(:,:,3);
xyz=cat(3,X,Y,Z);
base=imguidedfilter(xyz,xyz,'NeighborhoodSize',9, 'DegreeOfSmoothing',0.5);
detail=img-base;
%base层调整
r=base(:,:,1)*1.007245+base(:,:,2)*0.011136+base(:,:,3)*(-0.018381);
g=base(:,:,1)*(-0.318061)+base(:,:,2)*1.314589+base(:,:,3)*0.003471;
b=base(:,:,1)*0+base(:,:,2)*0+base(:,:,3)*1;
Base=cat(3,r,g,b);
RGBBase=imguidedfilter(img,img,'NeighborhoodSize',9, 'DegreeOfSmoothing',0.5);
figure;imshow(RGBBase);
%输出
result=(img-RGBBase)*2+RGBBase;
figure;imshow(img);
figure;imshow([base detail]);
gamma=0.4;
result=result.^0.4;
figure;imshow(result);

A novel tone mapping algorithm(matlab)_第1张图片

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