0

I have a depth image taken from Kinect V2 which is given below. I want to extract the pixel value x at any specific coordinate and its depth value in Matlab. I used the follwing code in Matlab but it gives me 16-bit value. However, I'm not sure is it pixel value or depth value of pixel x.

im=imread('image_depth.png');
val=im(88,116);
display(val);

Result
val= (uint16) 2977

Would someone please help me that, how to extract both pixel and depth value in Matlab?

Depth Image

Community
  • 1
  • 1
Faisal Sajjad
  • 239
  • 2
  • 4
  • 13

2 Answers2

1

The image name hints it is a depth map. The color map is stored usually in separate file usually in different resolution and with some offset present if not aligned already. To align RGB and Depth images see:

and the sub-link too...

The image you provided peaks with color picker the same 0x000B0B0B color for the silhouette inside. That hints it is either not Depth map or it has too low bit-width or the SO+Brownser conversion lose precision. If any pixel inside returns the same number for you too then the depth map is unusable.

In case your peaks returns 16 bit value it hints RAW Kinect depth values. If the case see:

Otherwise it could be just scaled depth so you can convert your x value to depth like:

depth = a0 + x*(a1-a0)

where <a0,a1> is the depth range of the image which should be stated somewhere in your dataset source ...

Spektre
  • 49,595
  • 11
  • 110
  • 380
0

From your description, and the filename, the values at each location in your image are depth values.

If you need actual color values for each pixel, they would likely be stored in a separate image file, hopefully of the same dimension.

What you are seeing here is likely the depth values normalized to a displayable region with MATLAB or your picture viewing software.

You will need to look at the specs to see how a value like 2977 converts to the physical world (e.g. cm). Hopefully it is just a scalar value you can multiply to get that answer.

informaton
  • 1,462
  • 2
  • 11
  • 20