How do I Access Channels beyond the First 3 or 4 in an OpenEXR Image?
I'm using OpenCV for Android like this to try to load an EXR image:
String testImgPath = "/storage/sdcard0/test2.exr"; Mat mRgba = Highgui.imread(testImgPath, Highgui.CV_LOAD_IMAGE_ANYCOLOR|Highgui.CV_LOAD_IMAGE_ANYDEPTH);
Regardless of the combination of flags I use with imload, I never see a channel count greater than 3 (CV_32FC3), but I know for a fact my test image contains 9 channels. There are 3, 3-channel images embedded within it. How can I load these extra channels?
Thanks, Jason
Hi, I know this topic is quite old, but i have a similar problem:
If an EXR is loaded, mat.channel() shows me only 3 channels that means that I cannot access the alpha channel. Saving an png with alpha as exr ends up in an exr without an alpha channel.
Is there a restiction in the implementation?
Thanks for your help.
Maybe when you read an EXR image, the resulting mat is similar to multi-dimensional mat.
What do you have when you print this ?
Hi Eduardo, your code shows me resolution (dims) of my exr. It printed out 2 values. 4096, 4096. This is the image resolution of my file. I got no other data.
Jason asked also on stackoverflow and he got an answer:
http://stackoverflow.com/questions/25...
It seems that OpenCV can only read the image as RGB.
Pritty sad because I think that OpenCV is quite easy to use. Loading an OpenEXR into a QT Framework based app is not so easy.