Items with no label
3335 Discussions

All the xyz of ProjectDepthToCamera in pos3d are returned as zero

MJala
Novice
1,148 Views

I am not sure why all the x, y, z values happen to be zero in pos3d in the following code. Please suggest fixes:

/***

 

Reads the depth data from the sensor and fills in the matrix

 

***/

 

void SR300Camera::fillInZCoords()

 

{

PXCImage::ImageData depthImage;

 

PXCImage *depthMap = sample->depth;

 

depthMap->AcquireAccess(PXCImage::ACCESS_READ, &depthImage);

 

PXCImage::ImageInfo imgInfo = depthMap->QueryInfo();

 

cout << "inImg->QueryInfo() " << depthImage.format << endl;<p>  PXCPoint3DF32 * pos2d = new PXCPoint3DF32[depth_width*depth_height];

 

int depth_stride = depthImage.pitches[0] / sizeof(pxcU16);

for (int y = 0, k = 0; y < depth_height; y++) {

 

for (int x = 0; x < depth_width; x++, k++) {

 

pos2d[k].x = (pxcF32)x;

 

pos2d[k].y = (pxcF32)y;

 

pos2d[k].z = ((short *)depthImage.planes[0])[y* depth_stride + x];

 

}

 

}

 

 

//Point3DF32 * pos3d = NULL;

 

PXCPoint3DF32 * pos3d = new Point3DF32[depth_width*depth_height];

 

PXCPoint3DF32 * vertices = new PXCPoint3DF32[depth_width * depth_height];

 

Projection * projection = device->CreateProjection();

 

projection->ProjectDepthToCamera(depth_width*depth_height, pos2d, pos3d);

 

cout << "x is " << pos3d->x*1000 << endl;<p>  cout << "y is " << pos3d->y*1000 << endl;<p>  cout << "z is " << pos3d->z*1000 << endl;

}

0 Kudos
1 Solution
idata
Employee
266 Views

Hi MonaJalal,

 

 

We noticed that you opened another thread asking about this (https://communities.intel.com/thread/114468 https://communities.intel.com/thread/114468), we will investigate more about this issue, and we will reply in that thread to avoid confusions.

 

 

Have a nice day.

 

 

Regards,

 

Leonardo R.

View solution in original post

0 Kudos
1 Reply
idata
Employee
267 Views

Hi MonaJalal,

 

 

We noticed that you opened another thread asking about this (https://communities.intel.com/thread/114468 https://communities.intel.com/thread/114468), we will investigate more about this issue, and we will reply in that thread to avoid confusions.

 

 

Have a nice day.

 

 

Regards,

 

Leonardo R.
0 Kudos
Reply