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. 

5 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.

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. 


Herunterladen 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.

Melden Sie sich an, um einen Kommentar zu hinterlassen.