I am importing depth data from Kinect V2 saved as .MAT
files using scipy.io.loadmat
into my python 3.5 code. When I print out the .MAT
data I get an uint16
array with values ranging from 0 - 8192
. This is expected as the Kinect V2 gives a 13 bit depth image data. Now, when I save this as a TIFF
file using
cv2.imwrite('depth_mat.tif' , depth_arr)
and read it using
depth_im = tifffile.imread('depth_mat.tif')
.The range of values are scaled up. In my original .MAT
file the maximum value is 7995
and after saving and reading the .TIFF
file the maximum value becomes 63728
. This throws off my calculations for mapping Kinect Depth to actual distance in real world. Any insight about this would help me a lot.
I have to do some image processing in between, hence it is necessary to preserve the original values. Also instead of using cv2.imwrite()
,if tifffile.imsave()
is used to save the .MAT
file, the image is entirely dark.
I am using python 3.5 on a Win 64 machine