# Find camera pose by knowing triangle coordinates

I have this concrete problem where I know the 3 coordinates of a triangle $$ABC$$ in a $$xyz$$ frame reference and I need to estimate the position $$P$$ and direction $$\vec{n_{p}}$$ of a stationary camera with known focal distance $$f$$. For this purpose I have the image from the camera where I know $$H$$, $$W$$ and the respective 2D positions $$a$$, $$b$$, $$c$$ in pixels. My questions:

• Is this possible by knowing only 3 points $$ABC$$?
• Does make difference if triangle $$ABC$$ is equilateral or not since I know the map $$ABC => abc$$?
• How to estimate $$P$$ and $$\vec{n_{P}}$$ relative to frame $$xyz$$?

I read already Camera Pose Estimation from Vanishing Points, Step by Step Camera Pose Estimation for Visual Tracking and Planar Markers and How to compute camera pose from Homography matrix? but sincerily I couldn't realize how to solve my problem.

No. No. You can't.

Not completely at least. With only three points, the math has two solutions. Your triangle could be tilted in one of two positions. Like picking a square root.

From a single frame, you might be able to tell and measure motion from a blur gradient, but that is difficult.

From multiple frames, calculating the position of the camera for each frame, the velocity is simply a matter of differentiation techniques on a finite sequence.

• I’m not trying to estimate velocity. $\vec{v_c}$ is the vector of camera direction. The camera position is stationary. – Duloren Jul 20 at 1:10
• I just renamed $\vec{v_c}$ to $\vec{n_c}$ in order to avoid any mistake – Duloren Jul 20 at 1:18
• @Duloren My mistake. Assuming you had four or more points, this is a best fit problem. Using your instrinsic model, the pixels will give you vector directions. Assuming the you have the coordinates of all the points, you have the distances beween them. It is a matter of solving for the position and aim by doing a best fit to the observed distances. Given the angle of two rays and a distance between them, it becomes a geometry problem as well. If this is a commercial application, I have started a software company just to solve this problem. Well, solving this is part of what it does. – Cedron Dawg Jul 20 at 2:13
• I see two tetrahedrons, one $Pabc$ by using camera position $P$ and the camera plane points $abc$ and other $PABC$ by using camera position $P$ and actual triangle coordinates $ABC$. Since I know the height of $Pabc$ (it is $f$) I think I can find everything else about Pabc. Btw, it is for research. – Duloren Jul 20 at 3:40
• Vectors and dot products and least square fits are your friends. Again, with three points you will not get a unique solution. Well, maybe if it is perfectly aligned and you are looking down the center, you will get a multiple root and a single solution. – Cedron Dawg Jul 20 at 4:04