image-processingcomputer-visiondepth-buffer

Interpreting unsigned short depth map values


I'm trying to test my algorithm on the lineMOD object detection dataset. According to the author, the depth values are stored as unsigned short values. I've managed to load the depth values into a cv::Mat but I would like to convert them to the typical float representation [0,1].

At first I assumed that I just have to divide with the maximum unsigned short but this doesn't seem to be the case since the maximum value I find seems to be 3399 while there are a lot of zeros in the depth map. I suppose the zeros mean that the specific pixel is a point that is too far for the depth camera to detect.

Is it possible that these unsigned shorts represent millimeters? If not, how should I convert the depth values before applying the transforms that generate the point cloud?


Solution

  • I guess the pixel values are not millimeters, rather some relative values, because it is easier for a depth camera to get relative depth values than accurate millimeter values, the values even might not be linear. Consult the author to get more information.

    You may try a few options:

    1. Consult the author to fully understand what does the depth value mean, then do the conversion accordingly.
    2. Find out what is the actual pixel range among a single image, or among all of your images, say [534, 4399], scale it to [0.1, 1.0], set those zeros to be 0.0
    3. Simply scale the full range of unsigned short [0 ~ 65535] to [0.0, 1.0]