Make HDR image from Raw images

13 vues (au cours des 30 derniers jours)
gbos
gbos le 25 Sep 2019
Modifié(e) : Vahila Kayithi le 27 Déc 2019
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 commentaires
Ted Shultz
Ted Shultz le 25 Sep 2019
Can you explain what you can't make work? You can't open the files? You get unexpected results?
gbos
gbos le 25 Sep 2019
Modifié(e) : gbos le 30 Sep 2019
Yeah, sorry. I updated the OP. This is the problems I have with the tiff files.
About the DNG, I cannot manage to use them because the are single precision matrixes and I cannot find a way to convert them to uint32 for example.
EDIT: I tried also with 16 bit PNGs and it's not working. The camera response is completely random and doesn't make any sense. Any clue?

Connectez-vous pour commenter.

Réponses (1)

Vahila Kayithi
Vahila Kayithi le 27 Déc 2019
Modifié(e) : Vahila Kayithi le 27 Déc 2019
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:

Produits


Version

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by