Wow. This was a lot harder than I thought it'd be. Rendering folks seem to really like .exr files. Not sure why. imread
doesn't support it. All the matlab readers I found based on openexr
eventually either wouldn't compile or crashed at runtime. Finally I gave up trying to load directly and settled on converting the image to a .mat
file using python+opencv+numpy+scipy. Even that was fraught with exr specific troubles.
pip3 install opencv-python numpy scipy
then here's a one-liner to convert .exr
to a .mat
file with a im
variable containing the image.
OPENCV_IO_ENABLE_OPENEXR=1 python3 -c "import sys; import os;from scipy import io; import numpy as np; from cv2 import imread, IMREAD_UNCHANGED;im = imread(sys.argv[1], IMREAD_UNCHANGED).astype(np.float32); io.savemat(sys.argv[2],{'im':im});" myimage.{exr,mat}`
Ew.