imageio: Not loading properly EXR file
While loading an exr file, the output is filled with 0’s and this warning appears:
WARNING:root:imageio.freeimage warning: loading color model R as Y color model
I cannot seem to find much information about this. The image is a single-channel float32 exr, the warning comes from Freeimage that basically says that the image will be a single channel image. Does imageio supports this particular case ? Sadly I cannot share the image, let me know what I can do to help debug this. It’s for an urgent work project so if I can go ahead and fix this I will
About this issue
- Original URL
- State: open
- Created 6 years ago
- Comments: 24 (10 by maintainers)
Commits related to this issue
- Update "CFA" images to support "Freeimage" OpenEXR reader. References imageio/imageio#356. — committed to colour-science/colour-demosaicing-tests-datasets by KelSolaar 5 years ago
So the code for
EXR_FLOAT
is 0x0001. I have generated an EXR F32 image with the following code:And loaded that image back into imageio, I get no error. Cannot reproduce it. It must be something due to the image metadata. Any idea how I can inspect that ?
You should not harcode the EXR_FLOAT value, but use
imageio.plugins.freeimage.IO_FLAGS.EXR_FLOAT
insteadSince pyav (ffmpeg) supports exr, I thought I give this issue a try and see if it got resolved in the process. Unfortunately it is not solved, but I thought I will leave this here for future reference.
The problematic EXR can be found in this comment: https://github.com/imageio/imageio/issues/356#issuecomment-417322343
and the issue can be reproduced using the following snippet:
The problem has been identified over in the freeimage repo; however, has not been fixed at the time of this writing:
(Source: https://sourceforge.net/p/freeimage/bugs/283/)
PyAV is also able to read EXR files; however, it too fails to read the EXR … for the same reason that freeimage fails to do so:
I had bugs with imageio/freemage when writing 32-bit FP EXR on Linux, and I’m not the only one, see https://github.com/imageio/imageio/issues/517
here’s an example where I wrote the same data as 32-bit TIFF and as EXR.
So either use TIFF, wait for the bug to be fixed, or write your EXR from Python with OpenCV (which supports RGB but not RGBA for EXR).
From the freeimage documentation: