8 Replies Latest reply on May 5, 2017 12:26 PM by realD

    Getting Position Data of Persons


      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?

        • 1. Re: Getting Position Data of Persons

          My own Unity avatar project may be a useful reference.


          '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.

          • 2. Re: Getting Position Data of Persons

            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 ?

            • 3. Re: Getting Position Data of Persons

              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.

              • 4. Re: Getting Position Data of Persons

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

                Have a nice day !

                • 5. Re: Getting Position Data of Persons

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

                  • 6. Re: Getting Position Data of Persons

                    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 ?

                    • 7. Re: Getting Position Data of Persons

                      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.

                      • 8. Re: Getting Position Data of Persons

                        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.