Software Archive
Read-only legacy content
17061 Discussions

Depth Measurement

mathieu_a_
Beginner
469 Views

Hi,

I'm trying to read depth measurement, I tried using sample->depth.
But I can`t figure out the depth format/how to interpret the data.

I'm trying to analyse all the depth for a single frame and find the closest point in the frame.

Any help would be appreciated.

0 Kudos
5 Replies
samontab
Valued Contributor II
469 Views

Ignore any value of 0, and then get the smaller value in the frame. That's the closest point.

0 Kudos
mathieu_a_
Beginner
469 Views

I'm using the following code to print the 250th depth value, but I can`t figure out the unit used to represent the depth.

PXCCapture::Sample *sample = sm->QuerySample();
PXCImage *depthFrame = sample->depth;
PXCImage::ImageData imgData = {};
unsigned short* points_buf;

depthFrame->AcquireAccess(PXCImage::ACCESS_READ, PXCImage::PIXEL_FORMAT_DEPTH_RAW, &imgData);
			
points_buf = (unsigned short*)imgData.planes[0];
if (sample->depth)
{
	pxcCHAR line[256];
			
	swprintf_s<sizeof(line) / sizeof(line[0])>(line, L"Depth=%d", points_buf[250]);
	UpdateStatus(line);
}

/* Resume next frame processing */
sm->ReleaseFrame();

 

0 Kudos
samontab
Valued Contributor II
469 Views

That format is device specific. Try using either PIXEL_FORMAT_DEPTH or PIXEL_FORMAT_DEPTH_F32. Those are in mm.

Have a look here:

https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/index.html?pixelformat_pxcimage.html

0 Kudos
qyan
Beginner
469 Views

   I want to convert the 16-bit depth data to millimeter.what is the formula? Is that " *0.0001"? Thank you for helping me!

0 Kudos
qyan
Beginner
469 Views

samontab wrote:

Ignore any value of 0, and then get the smaller value in the frame. That's the closest point.

 

   I want to convert the 16-bit depth data to millimeter.what is the formula? Is that " *0.0001"? R200 /outdoor.Thank you for helping me.

0 Kudos
Reply