Formulas for calculating the 3D rotation angles (yaw, pitch, roll) from a disks 2D projection on the image plane.

449 Views Asked by At

I'm writing an image processing algorithm, which should determine the 3D rotation angles and the centre (optional) of a disk from its 2D projection (ellipse) on the image plane.

What is the relationship between the parameters (semi-minor axis, semi-major axis, centre and the angle between the semi-major axis and the horizontal axis of the image) of the ellipse and the rotation angles of the circle?

I've found this paper, in which the authors gave quite an extensive deduction on this topic, however I — a non-mathematician — couldn't comprehend it. Could you explain it to me?

This is how far I got:

  1. I create a synthetic image of the ellipse, by rotating a circle drawn to the middle of an image by using the function from this stackowerflow topic.
  2. I obtain a solid version of the elliptic curve by floodfilling it with the openCV floodFill.
  3. I calculate the covariance matrix from the coordinates of the non zero pixels of the image using the numpy cov function on those coordinates.
  4. From the covariance matrix I calculate (using function 4 from the previously linked paper) the normal to the circle rotated in 3D, which is then not a unit vector (as it's longer than 1) and by calculating its angles, they don't match the original angles I used to rotate the original circle (in point 1).

Where is the mistake, how do I get the yaw pitch and roll angles?