Daniil-Osokin / lightweight-human-pose-estimation-3d-demo.pytorch

Real-time 3D multi-person pose estimation demo in PyTorch. OpenVINO backend can be used for fast inference on CPU.
Apache License 2.0
653 stars 137 forks source link

Distance from the camera #57

Closed Corbaci57 closed 3 years ago

Corbaci57 commented 3 years ago

Hello,

I am now trying to determine the distance of the person to the camera using the 3D data. Unfortunately, I do not understand how to interpret this data.

I have received the data as described in #28.

[[[ 64.97609 -25.123402 161.64394 ] [ 67.987206 -17.211044 178.11407 ] [ 59.18541 -29.42638 113.45152 ] [ 50.607834 -25.247658 162.74445 ] [ 40.232018 -26.389929 139.87444 ] [ 43.883087 -12.911152 128.71432 ] [ 52.757793 -9.818083 118.044266 ] [ 46.668602 1.8672419 89.46445 ] [ 37.637875 6.543922 55.960632 ] [ 74.69202 -24.63663 159.26927 ] [ 80.185265 -28.966888 135.4426 ] [ 77.59874 -25.048712 113.58676 ] [ 67.36782 -11.659477 113.28664 ] [ 59.383247 -3.6213398 78.08357 ] [ 50.41463 3.3975306 44.626457 ] [ 67.09124 -17.449127 178.04243 ] [ 66.5356 -20.184196 176.70605 ] [ 69.91624 -18.523632 178.19987 ] [ 70.737465 -24.518032 174.94388 ]]]

How do I have to process the data to be able to read the distance to the camera from it?

Daniil-Osokin commented 3 years ago

These are 3D coordinates of person joints (after applying extrinsics they will be in a world coordinate space, before they are in a camera coordinate space, camera is in (0, 0, 0)). So just calculate the distance you need.

Corbaci57 commented 3 years ago

how can I determine the correct extrinsics for my camera?

Daniil-Osokin commented 3 years ago

Extrinsics relate coordinate system with center in camera and world coordinate system. Usually one need coordinates in world space (corresponding to some point in the world). So you should set some point, which will be the origin of world coordinate system. Then you just calculate translation of camera center from this point and rotation between axes of world coordinate system and where camera points.

Corbaci57 commented 3 years ago

Thanks!