hdrwrite with grayscale HDR image

2 visualizaciones (últimos 30 días)
gbos
gbos el 27 de Sept. de 2019
Respondida: Mahesh Taparia el 1 de Oct. de 2019
Good evening everyone,
I have an HDR image to save, but it's just a grayscale image. "hdrwrite" wants in input a 3D matrix, so right now I'm doing like this:
hdr(:,:,1) = imgHDR;
hdr(:,:,2) = imgHDR;
hdr(:,:,3) = imgHDR;
hdrwrite(hdr,'result.hdr');
It's working correctly but I feel like it's a waste of space. Why do I need to save 3 equals channel if it's just a grayscale image?
How can I save a grayscale radiance map (.hdr) and save some storage space?
Thank you for you help

Respuestas (1)

Mahesh Taparia
Mahesh Taparia el 1 de Oct. de 2019
Hi,
You can save storage space by storing the zeros in the other two dimensions in order to save memory. As per your code, you can use the below code:
Hdr=zeros(size(imgHDR,1),size(imgHDR,2),3);
Hdr(:,:,1)=imgHDR;
hdrwrite(Hdr,'result.hdr');
Hope it will help.

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by