TadasBaltrusaitis / OpenFace

OpenFace – a state-of-the art tool intended for facial landmark detection, head pose estimation, facial action unit recognition, and eye-gaze estimation.
Other
6.93k stars 1.85k forks source link

how to get the head pose rotation in world coordinate with the head being the origin #851

Open superkevinr opened 4 years ago

superkevinr commented 4 years ago

Hi, I have used your API for head pose estimation. It was a great job you guys have done. But in my case I need to get the pitch, yaw and roll of the head with respect to head itself. But the result returned by OpenFace is rotation with respect to the camera, which means the head's location will affect the head pose result. Could you please suggest any solutions to convert the result from camera being the origin to head being the origin? Thank you so much!

TadasBaltrusaitis commented 4 years ago

The head pose returned by OpenFace should be with respect to camera plane rather than the camera and location should not affect it (in theory). That means if you are looking forwards it should be close to zero no matter where in the image you are.

However, due to issues of landmark detection (and some landmarks getting occluded partially as the face is not in the center of the image) and only approximation of camera calibration parameters this will not always be accurate.

Previously (some years ago), OpenFace did return the head orientation with respect to the camera, however this has changed in more recent versions.

Risskov commented 4 years ago

The head pose rotations are in world coordinates (as it also says in the documentation), so looking at the camera gives different outputs depending on the location in the image.

There is a function 'GetPoseWRTCamera' that gives coordinates with respect to the camera, but I am also interested in getting the same for the gaze. Would it be enough to change the 'GetPose' call in 'GazeEstimation' to 'GetPoseWRTCamera', or is more work needed?

TadasBaltrusaitis commented 4 years ago

I believe I replied to your follow up question in a separate thread.