# Relative distance to rotated object

An object (with center $O_{2}$) has been rotated by an angle $\alpha$. There are two images of the object taken by a camera (centered at $O_{1}$), and two points $x_{1}$ and $x_{2}$ that are actually belong to the same physical object's point in different positions.

Given values:

• rotation angle $\alpha$
• $x_{1}$ and $x_{2}$
• (possibly) focal length $f=O_{1}C$

...and I'd like to estimate the relative distance or depth for $X_{1}$ (how far it is from the camera plane), i.e., some value proportional to the real distance.

Now, if two object points are $(X_{1}, Y_{1})$ and $(X_{2}, Y_{2})$, then $X_{2}=X_{1}-Rcos\alpha$ and $Y_{2}=Y_{1}-Rsin\alpha$ where $R$ is rotation radius (unknown, because an object can be shaped arbitrary). So, $x_{2}$ depends on both distance and $R$, and I can't tell knowing only (supposedly large) $x_{2}$ whether the origin point is relatively close or just belongs to an extruded object part and is far away from rotation center. Update:

I do get the fact that two different objects could cast the same projection, yes. But is rotation no help at all here? For example, if the object has been displaced (by a known vector), from position $A$ to position $B$ that would give me enough information to calculate distance/depth as $d=\frac{|X_{B} - X_{A}|f}{|x_{A} - x_{B}|}$ (that would actually be absolute distance). Now, in case of rotation I could extract just $X$-component of transformation if I knew $R$ (rotation radius), that would make the problem the same as a displacement one. Unfortunately, $R$ is unavailable (can it be estimated from the image somehow? I don't think so), but on the other hand, I'm not looking for an absolute distance value (not sure if that makes the problem easier).

Update:

These are the values I'm looking for ($X_{1}H_{1}, X_{2}H_{2}$). • Do you know the points $x_1$ and $x_2$? Or do you only know the distances from $O_1$ to those points? – Brian Tung Apr 24 '15 at 0:49
• Yes, I know coordinates for $x_{1}, x_{2}$ – rocknrollnerd Apr 24 '15 at 8:20

If all you have is the camera image ($x_1$ and $x_2$), the distance $O_1C$, and the rotation angle $\alpha$, the point $X_1$ could be at almost any distance from the camera. Even knowing that the center of rotation is on the line $O_1C$ does not help much. If rotation through angle $\alpha$ around $O_2$ takes the point $X_1$ to $X_2$, you know all the angles of the isoceles triangle $\triangle X_1O_2X_2$, but you do not know its size. For example, here is such a triangle $\triangle X_1O_2X_2$ and another similar (same angles) but larger triangle, $\triangle X_1'O_2'X_2'$, farther away from the camera: The points $X_1'$ and $X_2'$ will produce exactly the same image in the camera as the points $X_1$ and $X_2$.

In fact, a dilation with center at $O_1$ takes $\triangle X_1O_2X_2$ to $\triangle X_1'O_2'X_2'$, that is, not only are $\triangle X_1O_2X_2$ and $\triangle X_1'O_2'X_2'$ similar, but $\triangle X_1O_1O_2$ and $\triangle X_1'O_1O_2'$ are similar (that is, $\angle X_2O_2O_1 = \angle X_2'O_2'O_1$) and $\triangle X_1O_1X_2$ and $\triangle X_1'O_1X_2'$ are similar as well. Therefore

$$\frac{|O_1X_1|}{|O_1X_2|} = \frac{|O_1X_1'|}{|O_1X_2'|}.$$

The distances measured from $O_1$ in the direction perpendicular to the camera image (parallel to $O_1C$) also are proportional, but since we do not scale up the triangle $\triangle x_1O_1x_2$ when we scale up $\triangle X_1O_2X_2$,

$$\frac{|x_1X_1|}{|x_1X_2|} \neq \frac{|x_1X_1'|}{|x_1X_2'|},$$

and we also will get inconsistent ratios if we measure the distances perpendicular to the camera's image. In the limit, as we view larger and larger objects at greater and greater distances, the ratios of distances will approach a constant, because $\frac{|CO_2'|}{|O_1O_2'|} \approx 1$ when $O_2'$ is very distant.

• I understand that I can't get actual measurements, right. But what about relative ones? For you image, does $\frac{d_{1}}{d_{2}}=\frac{d_{1}^{'}}{d_{2}^{'}}$ for all such triangles? If so, I'll be perfectly satisfied knowing some values (not necessary real distances) that satifsfy the same property. – rocknrollnerd Apr 24 '15 at 8:15
• Depending on how you measure $d_1$, $d_2$, $d_1'$, and $d_2'$, you may get equal ratios, or you may get ratios that are nearly (but not exactly) equal when you compare two possible locations of the rotated object that are very far away. (I made an error in a previous version of the answer; not only are the triangles $\Delta X_1O_2X_2$ and $\Delta X_1'O_2'X_2'$ similar, but their corresponding sides are parallel and make exactly the same angles with the line $O_1C$.) – David K Apr 24 '15 at 13:24
• I've edited my original question, could you please look it up? – rocknrollnerd Apr 24 '15 at 17:39
• The point of the last part of the (corrected) answer is that indeed you can determine the relative distances of $X_1$ and $X_2$ from the focal point. You can also find an approximation of the relative distances of those points from the camera image. The farther away the actual object is, the better that approximation is. Alternatively, if you know the distance to $O_2$ you can find all the points exactly, and if you can even guess an approximate distance to $O_2$ you can get an improved approximation. – David K Apr 24 '15 at 18:06
• Well... how do I determine those? 'Cause that was the actual point of the question, and no, I don't know any actual distance to any of object points (like $O_{2}$) – rocknrollnerd Apr 24 '15 at 21:21