I have generated some depth maps using blender and have saved z-buffer values(32 bits) in OpenEXR format. Is there any way to access values from a .exr file (pixel by pixel depth info) using OpenCV 2.4.13 and python 2.7? There is no example anywhere to be found. All I can see in documentation that this file format is supported. But trying to read such a file results in error.
new=cv2.imread("D:\\Test1\\0001.exr")
cv2.imshow('exr',new)
print new[0,0]
Error:
print new[0,0]
TypeError: 'NoneType' object has no attribute '__getitem__'
and
cv2.imshow('exr',new)
cv2.error: ..\..\..\..\opencv\modules\highgui\src\window.cpp:261: error: (-215) size.width>0 && size.height>0 in function cv::imshow
I might be a little late to the party but; Yes you can definitely use OpenCV for that.
cv2.imread(PATH_TO_EXR_FILE, cv2.IMREAD_ANYCOLOR | cv2.IMREAD_ANYDEPTH)
should get you what you need