Make HDR image from Raw images
5 次查看(过去 30 天)
显示 更早的评论
Hello,
I'm using MatLab to blend some images and create and HDR radiance map. I'm using the new functions from MatLab 2019 to get the response function and create the HDR image.
Everythings works well with JPG (both grayscale and color), but I can't manage to make it work with Raw images. I have these file formats: CR2, DNG, Tiff. I'd like to make it work with at least one of them, so I can make an HDR radiance map with more than 8 bit depth.
Any help?
Thank you
EDIT:
First, I use the Tiff class to read the 16bit image:
t = Tiff(path,'r');
im = read(t);
Here I already have a weird problem because "im" is a 4D matrix. I don't know why but I have the 3 channels and then a matrix that's completely blank (every cell value is 2^16-1).
Anyway, I delete the last matrix so I have a 3D matrix. I use this matrix to compute the camera response function but I get weird results. This is the response function:
Since it's an uncompressed tiff, I think the response function should be linear. Also this response is just plain wrong anyway.
Here the code I'm using:
%% Collection of photos
setDir = fullfile('images','tt_*');
imds = imageDatastore(setDir);
figure(1);
montage(imds);
%% Response Function
crf = camresponse(imds,'ExposureTimes',[1/60,1/250,1/1000]);
range = 0:length(crf)-1;
%Response function plots for every channel
figure(2); hold on;
if(size(crf,2) == 3)
%RGB Image
plot(crf(:,1),range,'--r','LineWidth',2);
plot(crf(:,2),range,'-.g','LineWidth',2);
plot(crf(:,3),range,':b','LineWidth',2);
legend('R-component','G-component','B-component','Location','southeast');
else
%Grayscale Image
plot(crf(:,1),range,'-k','LineWidth',2);
end
xlabel('Log-Exposure');
ylabel('Pixel Value');
title('Camera Response Function');
grid on;
axis('tight');
hold off;
2 个评论
Ted Shultz
2019-9-25
Can you explain what you can't make work? You can't open the files? You get unexpected results?
回答(1 个)
Vahila Kayithi
2019-12-27
编辑:Vahila Kayithi
2019-12-27
IamgeDataAStore object can be created directly from the .tif files by specifying the 'FileExtension' to '.tif'. Can you try running your code by creating the IamgeDataAStore object from .tif files instead of using Tiff class to read them?
Refer to this link to create IamgeDataAStore object from .tif files:
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!