Software Archive
Read-only legacy content
17061 Discussions

How to measure distance using F200 real sense camera

manish_k_2
Beginner
2,015 Views

Hi All,

I am trying to use F200 real sense camera to measure distance of my different body points like eyes, shoulder joints etc., but don't know how to proceed. Any leads or code sample would be highly appreciated.

Thanks in advance.

Regards,

Manish

 

0 Kudos
1 Solution
samontab
Valued Contributor II
2,015 Views

Hi, if you want to make some custom detections, you can use OpenCV.

This video explains how to get the raw data into OpenCV:

https://www.youtube.com/watch?v=wIkIdjN6Oyw

View solution in original post

0 Kudos
11 Replies
samontab
Valued Contributor II
2,015 Views

Well, you have 3D points, so you can just use the euclidean distance between them.

Note that the depth is perpendicular to the sensor.

0 Kudos
Dominik_L_
Beginner
2,015 Views

samontab wrote:

Well, you have 3D points, so you can just use the euclidean distance between them.

Note that the depth is perpendicular to the sensor.

Can you may tell me why the depth is perpendicular to the sensor? Where does this information come from?

Thanks in advance!

0 Kudos
samontab
Valued Contributor II
2,015 Views

Here you can see the coordinates definition:

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

If you compare the Z value (from the X, Y, Z values returned by queryVertices) with the depth distance from the raw stream in mm, it matches.

At least when I compared then some time ago, one of those values was a floating point number (e.g. 3.23) and the other was the integer part of it (e.g. 3). Make sure to use the more accurate one if this is still the case.

0 Kudos
manish_k_2
Beginner
2,015 Views

Thanks a lot Sebastian for quick and elaborate reply. I am quite new to real-sense technology so just wanted some more help. My requirement is to find two things

1) Detect different body points like eyes, shoulders etc.

2) Once first part is done then find its distance from device.

There are few samples at Intel website like DF_BlobViewer.cs which talks extreme points like top, right, left but it doesn't talk about detecting body points.  It will be great help if you can point us to some samples doing above things (sorry for my silly questions).

Regards,

Manish

 

0 Kudos
samontab
Valued Contributor II
2,016 Views

Hi, if you want to make some custom detections, you can use OpenCV.

This video explains how to get the raw data into OpenCV:

https://www.youtube.com/watch?v=wIkIdjN6Oyw

0 Kudos
manish_k_2
Beginner
2,015 Views

Thanks again Sebastian. The video is really helpful.

0 Kudos
samontab
Valued Contributor II
2,015 Views

You are welcome!, I'm glad it helps.

0 Kudos
Ce_L_
Beginner
2,015 Views

Hello, I'm new to RealSense. My question is quite same to yours. I want to use the module of Person Tracking (in the SDK R5) to track a person and measure the distance from the person's joints to the R200.  However, it doesn't work. Can you give me some help or samples?
Thank you very much.

0 Kudos
samontab
Valued Contributor II
2,015 Views

If you have the X, Y, Z coordinates of the joints, then you can get the distance by just calculating the norm of that vector since the origin is at the R200.

0 Kudos
Ying_C_
Beginner
2,015 Views

If I use R200 to measure the distance from the camera to a big object like a car, what is the effective range?

Thanks!

0 Kudos
Joseph_W_1
Beginner
2,015 Views

Regarding distance measurement, with person tracking on the R200 camera enabled, could one use a combination of  QueryCenterMass() and Vector3.Distance() to get distance from camera?

This comment from samontab got me to thinking about this:

samontab wrote:

If you have the X, Y, Z coordinates of the joints, then you can get the distance by just calculating the norm of that vector since the origin is at the R200.

X, Y Z coordinates can be obtained from skeleton joints, but as can be seen from my blog posting here, working with skeleton joints thus far has been problematic: https://software.intel.com/en-us/forums/realsense/topic/685380

At some point skeleton joints will likely work better (e.g. in a future SDK release), but as a fall back I was looking through the SDK for a simpler, more reliable way to get a reasonably accurate "ballpark" distance measurement from camera to a person body.

PXCMPersonTrackingData.PersonTracking.QueryCenterMass returns a PointCombined struct from which the world coordinate point for the center mass can be obtained. Based on samontab's comment, I tried the following:

PXCMPersonTrackingData.PersonTracking.PointCombined centerMass = trackedPersonData.QueryCenterMass();
Vector3 centerMassVector3 = new Vector3( centerMass.world.point.x, centerMass.world.point.y, centerMass.world.point.z );
distanceToCenterMass = Vector3.Distance( origin, centerMassVector3 );

The resulting distance value seems to be reasonably accurate if one uses meters as the unit of measurement.

However, I just very recently started working with the R200 and RealSense SDK, so I may be misinterpreting the use of world coordinates here and was hoping someone could clarify that. Additionally, if the measurement *is* correct in meters, where was that unit of measure defined in the SDK?

0 Kudos
Reply