Software Archive
Read-only legacy content
17061 Discussions

Finding Distance between Depth Camera and User's Face

Majid_N_
Beginner
318 Views

Hi,

 

In my project I have to know the Distance between the Depth Camera and the user's face

Is there any function or sample works that I can use in Unity to find the exact distance? I can measure the distance between the middle of two eye and using it for zoom in/out but I need the exact distance from camera and face.

 

Thanks

Majid

 

0 Kudos
2 Replies
Andradige_S_Intel
318 Views

You can access the Z (depth) information of all pixels 

Refer to PXCFaceData::DetectionData::QueryFaceAverageDepth in the reference manual

0 Kudos
samontab
Valued Contributor II
318 Views

If you are working in the color camera, you can project the depth camera to the color camera, and then just read the depth value at the face location.

Get the depth values projected at the color camera location with this (defined in pxcprojection.h):

PXCImage* PXCAPI CreateDepthImageMappedToColor(PXCImage *depth, PXCImage *color)

0 Kudos
Reply