# Estimation of ball position (3d reconstruction)

I have a white small ball in camera view. The ball is in front of camera but higher than camera (Yball > Ycam). View is compensated by undistort(). I try to calculate X and Y position of the ball relative to camera position. What I know:

- know exact distance from the optical center of the camera to the ball,

- know shift dX,dY of my ball in pixels from center of cam view,

- know focal length in pixels (fx and fy from camera matrix determined by camera calibration).

I try calculate physical X and Y position relative to camera using dx,dy,fx,fy,distance. If the position of the ball is near the center of the screen then I can accurately calculate the position using fx and fy. But I noticed, that if the ball is on the side, near the edge of the view (but physicial Y position and distance from camera are the same as previous), then the ball in image is higher. Here's an example:

1) Ball X coordinate is in center

2) Ball X coordinate high (near right side of image)

On the second example, 'top' coordinate changed from 433px to 396px, but ball is on the same physical Y as in previous example and at the same distance from the optical center. So if I use 'fy' (focal length y) to calculate Y position, my estimated position will be different.

Could You please help me, what am I doing wrong? How to calculate the position of the ball, what parameter did not take into account?