# calculate 3d pose of sphere based on 2d ellipse

Hello all,

at the moment I'm using OpenCV to detect balls in an image by finding the 2d ellipse of the balls.

I now need to find out the exact position of the ball in world coordinates - I know the radius of the balls. If the ball is lying close to the optical center of the camera then the position is quite accurate - but if the ball moves to the borders of the image, the position has a growing error, because of the perspective distortion of the camera - the ball is seen from the side for example.

I read several papers about this problem and there seems to be a solution (http://www.mie.utoronto.ca/labs/ciml/projects/rob_vision/Tony.pdf on page 4) but I'm not sure how to implement this.

My current idea:

1. remove radial distortion from the image (I have the intrinsic parameters of the camera)

2. detect the ellipse in the image

3. use some magic maths as written in the paper to estimate the 3d pose

Has anyone some expirience with this? I hope someone can point me in the right direction.

Thanks a lot!