Saving information in planes[0]

Saving information in planes[0]

Hi so I am trying to store the depth data acquired by the camera to use as training data for my own classification. However, when looking at the data that I saved it looks like the crud file when I try to visualize the data, when it should look like the hand file. (Both files are attached).

I am using this code for every frame: 

PXCImage *depthImage = QueryImage(PXCImage::IMAGE_TYPE_DEPTH);
PXCImage::ImageData theData;
PXCImage::ImageInfo info;
int s;
for(int i =0;i<((info.width*info.height)-1);i++){
    stringstream ss (stringstream::in | stringstream::out);
    s = (int)theData.planes[0][i];
    ss <<s;

frameData is then saved to a text file. I used Matlab to visualize this data. The text file of the data is also attached (named oneFrame2_a.txt)

I would really appreciate any help. Am I saving the data incorrectly? Am I using the data incorrectly. How is the information in planes[0] actually formatted? I would love as much information as I can get. 

Downloadimage/png crud.png14.69 KB
Downloadimage/png hand.png37.68 KB
Downloadtext/plain oneframe2-a.txt224.39 KB
5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

The depth map is a 16 bits image, so you need to cast the pointer planes[0] into short* before dereferencing it:

s = (int)((short*)theData.planes[0])[i];

This now gives me values in the 10,000 ranges. What is the meaning of the numbers given? Are they a grayscale representation? Do I need to do any processing on top of them? I have attached the new text file I got. 


Downloadtext/plain oneframe3.txt380.02 KB

Hi Pavleen,

From a very quick visual check of your file it looks about right.  These are depth values so it looks like large parts of your image had nothing in the foreground and the background is limiting at 32001.


Values greater than 32000 are special values that mean that it's an undefined depth (too far, too close, saturated, ...)

The other values are the distance in milimeters.

Leave a Comment

Please sign in to add a comment. Not a member? Join today