# Locating vertices of a known triangle in $3D$ from a single image

Suppose you have a labelled triangle with known side lengths, and you take one image of this triangle using a known pinhole camera (i.e. the focal length is known), from a point with known coordinates, and also the orientation of the camera is known. How can you find the coordinates of the three vertices of the triangle? And are these coordinates unique, or is it possible that a single image will corresponds to more than one possible set of coordinates for the three vertices ?

My Attempt: Since the triangle vertices are labelled we have a known correspondence between the vertices and their images. If the vertices are $$P_A, P_B, P_C$$, and their images are $$Q_A, Q_B, Q_C$$, then

$$P_A = P_0 + t_1 R Q_A$$

$$P_B = P_0 + t_2 R Q_B$$

$$P_C = P_0 + t_3 R Q_C$$

note that since the focal length of the pinhole camera is known, then $$Q_A, Q_B, Q_C$$ are known vectors. Also, since the position of the pinhole and the orientation of the camera is known, then vector $$P_0$$ and matrix $$R$$ are also known. The unknowns are the scalars $$t_1, t_2, t_3$$ and the vectors $$P_A, P_B, P_C$$. This is where knowledge of the side lengths comes into play. The sides are $$a = \| P_B P_C \| , b = \| P_A P_C \|$$ , and $$c = \| P_A P_B \|$$. From the expressions above, and using the fact the $$R$$ is a rotation matrix, so it does not change of the length, then

$$a^2 = (t_3 Q_C - t_2 Q_B)^T (t_3 Q_C - t_2 Q_B )$$

$$b^2 = (t_3 Q_C - t_1 Q_A )^T (t_3 Q_C - t_1 Q_A)$$

$$c^2 = (t_2 Q_B - t_1 Q_A)^T (t_2 Q_B - t_1 Q_A )$$

which are three quadratic equations in the three unknowns $$t_1, t_2, t_3$$ , that can be solved simultaneously by numerical methods.

Once $$t_1,t_2, t_3$$ are found, then we're done, because now we can compute the coordinates $$P_A, P_B, P_C$$.

Here is how I constructed the two triangles: First, I made the viewport in the bottom left, labeled "Front", a perspective view, which is (I am pretty sure) equivalent to your pinhole camera. [The standard is the "parallel" view, which is used for CAD drawing.] The camera position is at $$(0,-100, 0)$$ and the lens length is 50. These do not change for any of the images.
Then I made the blue triangle that is leaning forward toward the camera, with vertices $$(-10, 0, 0), (10, 0,0),$$ and $$(0, -10, 10)$$.
I drew the line from our camera position through the top point of the blue triangle, $$(0, -100, 0)$$ to $$(0, -10, 10)$$. All points on this line will be in the same image in the pinhole camera. Then I merely made a new red triangle by rotating the blue one back until the top point fell on this line. In this case, the new point is $$(0.000,7.561,11.951)$$ estimated.