Items with no label
3335 Discussions

Getting Position Data of Persons

DCunn2
Beginner
1,620 Views

I'm currently working with the PersonTracking Module of the SDK R2 with the SR300. Now I need to get the exact Position with the distance to the camera.

Is it possible to get the distance between Camera and the Persons in the room to place an avatar in Unity where the Person stands in reference to my Position?

0 Kudos
1 Solution
MartyG
Honored Contributor III
289 Views

My own Unity avatar project may be a useful reference.

https://www.youtube.com/watch?v=T_V8SNwLTrY 'My Father's Face' Tech Trailer 7 - YouTube

In my project, the camera is attached to the parent object of the avatar and moves with it. But there was a time during development when the main camera was in a fixed position, detached from the avatar. So when I leaned in towards the camera, the avatar would walk off into the distance, becoming smaller as it walked across the room further away from the fixed camera, and become larger when I turned the avatar around and walked it back towards the camera position.

View solution in original post

0 Kudos
8 Replies
MartyG
Honored Contributor III
290 Views

My own Unity avatar project may be a useful reference.

https://www.youtube.com/watch?v=T_V8SNwLTrY 'My Father's Face' Tech Trailer 7 - YouTube

In my project, the camera is attached to the parent object of the avatar and moves with it. But there was a time during development when the main camera was in a fixed position, detached from the avatar. So when I leaned in towards the camera, the avatar would walk off into the distance, becoming smaller as it walked across the room further away from the fixed camera, and become larger when I turned the avatar around and walked it back towards the camera position.

0 Kudos
DCunn2
Beginner
289 Views

Ok, this looks nice. Did you use the sr300 or the r200 ? I'm not sure if it's possible with the sr300.

I don't know if i understand you right. Is the camera attached to your head in the real world then ?

0 Kudos
MartyG
Honored Contributor III
289 Views

It was developed with the F200, the direct predecessor of the SR300. The camera is on my desk about 0.8 m in front of me.

0 Kudos
DCunn2
Beginner
289 Views

Ok, Thank you for the Help ! I hope i can get this to work within Unity with the sr300.

Have a nice day !

0 Kudos
MartyG
Honored Contributor III
289 Views

You're welcome, please come back to the forum any tme you have questions. Have a great day too!

0 Kudos
DCunn2
Beginner
289 Views

Hello Marty,

I'm currently trying this within Unity and now i came up to a problem where i don't know further.

I wrote a Script which uses the PersonTracking Module but since it is in preview state i can only make use of the 2D Methods like

get2DBoundingBox of a Person. So my Question is, is it possible to also get the depth data within that BoundingBox so that i

know how far away a Person is ?

0 Kudos
MartyG
Honored Contributor III
289 Views

I haven't worked with Person Tracking or with 2D bounding boxes (I only use 3D bounding boxes in Unity). So I'm afraid I don't know what to suggest.

When I needed to track the proximity of a person in Unity (not with Person Tracking), my approach was to have an object (e.g an Empty GameObject) track the proximity of the RL person and update the position of the virtual object as the tracked person moved. I would then compare the X-Y-Z position coordinates of that tracking object to another set of XYZ coordinates to work out how close the two locations were to each other.

So I would do a sum such as '(coordinate of position A) - (coordinate of position b). If the result was minus then the person was behind me, and if the result was a positive number then the person was in front of me (approaching). And if the result is 0 then the two are at exactly the same position, since subtracting a coordinate value from the a coordinate value of the same amount (e.g 1200 - 1200) always = 0.

Using this system, I created a mechanism where a game's AI could tell if the player and a computer-controlled character were within hearing distance of each other.

0 Kudos
DCunn2
Beginner
289 Views

Thanks for the fast response ! Thanks for the hint, but i can't compare the positions because i don't have the Z value of the Coordinate.

Is there a way to get the depth value of a distinct region or point. Then i could just take the average of the depth values and observe how they differ.

0 Kudos
Reply