2

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

Wilbus Fugu
  • 83
  • 2
  • 11
  • Have you tried normalizing the values between 0 and 1 before calling `tifffile.imsave`? (The example at https://pypi.python.org/pypi/tifffile is saving a matrix of values between 0 and 1) – bantmen Nov 03 '17 at 23:52
  • Have not tried normalizing as the example just initializes a random generator. In my case it is raw depth values from a kinect sensor and I can't think of why saving it as a `.tif' is scaling up the intensity. – Wilbus Fugu Nov 04 '17 at 05:51

0 Answers0