www.gusucode.com > IPCV_Eval_Kit_R2019a_0ce6858工具箱源码程序matlab > IPCV_Eval_Kit_R2019a_0ce6858/code/demo_files/I2_01_1_HDR.m

    %% 僴僀 僟僀僫儈僢僋 儗儞僕 僀儊乕僕偺庢埖偄

clear;clc;close all;imtool close all

%% 僴僀 僟僀僫儈僢僋 儗儞僕 僀儊乕僕偺撉崬傒
hdr_image = hdrread('office.hdr');   % m x n x 3 single

max(hdr_image(:))
min(hdr_image(:))

imtool(hdr_image);      % 1.0 埲忋偼朞榓

hdr_image(66,637,3)     % 3.2813
hdr_image(66,634,:)     % 0.4492, 0.5898, 0.7656

%% 僩乕儞儅僢僺儞僌 (uint8傊)
rgb = tonemap(hdr_image);

%% 寢壥偺昞帵
figure;imshow(rgb);

rgb(66,637,3)          % 嵟戝抣偼255傊儅僢僺儞僌偝傟偰偄傑偡


%% 堦楢偺儘乕僟僀僫儈僢僋儗儞僕夋憸僼傽僀儖傪巊偭偨椺
files = {'office_1.jpg', 'office_2.jpg', 'office_3.jpg', ...
         'office_4.jpg', 'office_5.jpg', 'office_6.jpg'};
       
% 奺夋憸偺憡懳業岝抣
expTimes = [0.0333, 0.1000, 0.3333, 0.6250, 1.3000, 4.0000];

% 嵟傕柧傞偄僀儊乕僕偲嵟傕埫偄僀儊乕僕娫偺拞娫偺業岝抣傪丄
% 僴僀 僟僀僫儈僢僋 儗儞僕偺寁嶼偵懳偟偰丄婎杮業岝偲偟偰巊梡
hdr = makehdr(files, 'RelativeExposure', expTimes );
hdr1 = makehdr(files, 'RelativeExposure', expTimes ./ expTimes(1));

imtool(hdr,[0 5])
D = imabsdiff(hdr,hdr1);
imtool(D)


rgb = tonemap(hdr);
rgb1 = tonemap(hdr1);

figure; imshow(rgb)
figure; imshow(rgb1)

D = imabsdiff(rgb,rgb1);
imtool(D)

% Copyright 2014 The MathWorks, Inc.