# A Triangle homography is possible! I am a first?

#### mrStrange

Summary
Every triangle in 3d space have just one perspective projection on a plane. And vice versa.
We can get just one real triangle in 3d space by projection on plane.
I solve linear equation for getting rotation and position of triangle without rotation and translation matrix. And try it. Just need a AB, BC, AC lenght.
Somebody do this before?

This is demonstration with camera canon eos 600d. But I don't solve lens distortion yet.

Related Linear and Abstract Algebra News on Phys.org

Optimized

#### HallsofIvy

Science Advisor
Homework Helper
Clearly there are many different triangles "in space" that will project to the same thing on a plane. When you project from three dimensions to two, you "lose" information. There is no way to recover that information from the plane.

• nuuskur, fresh_42 and berkeman

#### Someone2841

One projection will have many 3D representations, so the "vice versa" is wrong.

#### mrStrange

Clearly there are many different triangles "in space" that will project to the same thing on a plane. When you project from three dimensions to two, you "lose" information. There is no way to recover that information from the plane.
I got transform and rotate

#### mrStrange

One projection will have many 3D representations, so the "vice versa" is wrong.
Yes no yes no. The video atached. And i have the equation. It is absolutely truth. Now i work with distortion, sensor size, aspect and focal lenght

#### fresh_42

Mentor
2018 Award
Yes no yes no. The video atached. And i have the equation. It is absolutely truth. Now i work with distortion, sensor size, aspect and focal lenght
Be careful with absolute truth if you might be wrong! "I know better" only proves stubbornness. The video is irrelevant, this is no proof which we could read, and what do you mean by
I got transform and rotate
It is very likely that you did not describe your question in an accurate way, such that there are loopholes in which crucial information is hidden.

A projection (in our case here) is a linear transformation $p\, : \,\mathbb{R}^3 \longrightarrow \mathbb{R}^2$ with $p^2=p$. It is immediately clear that $\operatorname{def}p=\dim \ker p \geq 1$. This is what @HallsofIvy meant by lost information. We have an entire free parameter in the set of all triangles which produce the same image. Hence "vice versa" is wrong as stated. You may have additional information to fix this free parameter, but you didn't tell us. At least we couldn't understand you.

Can you elaborate what
I got transform and rotate
means in terms of $p$? How are $v$ and $p(v)$ related? Will say: If you know the transformation and the rotation, then you might have a bijection in $\mathbb{R}^3$. In this case the projection is irrelevant as you already have the entire information without it.

Last edited:
• berkeman

#### mrStrange

Sorry. I don't know what you try to talk me about, but....
For the triangle in a 3d space. ABC. And the centroid M.
The point S is A center of perspective projection. We are know AB,BC,AC lenght. And for the ideal pinhole camera...
I got equation
SM^2 = (AB^2+BC^2+AC^2)*Kabc/(27*Kabm - 9*Kabc + 27*Kacm + 27*Kbcm);
Where Kabc,Kabm,Kacm,Kbcm some factors. I hid this.

So. I can get the Centroid distance. +SM, -SM.
-SM Just mirrored. And SA,SB,SC distances. Actually a got a plane with transform position and rotation with 4 points.
How I can make the presentation of my 2 years work? I don't want show the all equation.

Last edited:

#### Ibix

Science Advisor
I think the OP has a known triangle: "Just need a AB, BC, AC lenght". It's clearly impossible with an unknown triangle.

With a known triangle it's certainly impossible in special cases - there's three possible angles of rotation for an equilateral triangle, for example. More generally, if you fix two of the corners in space then the possible locations of the third point form a circle whose axis is the line joining the first two points. If the plane of that circle is perpendicular to the camera then the ray from the camera through the third point generally intersects the circle twice and there are two possible solutions.

You can probably handle those cases if you're using video by insisting that your answer be "near" your previous frame's answer. Care would be needed on initialisation in case of a starting pathological case.

Edit: since you can't actually fix the first two points in space, the locus of possible positions for the third point is rather complicated. I suspect that there are other cases with ambiguities.

Last edited:

#### mrStrange

I think the OP has a known triangle: "Just need a AB, BC, AC lenght". It's clearly impossible with an unknown triangle.

With a known triangle it's certainly impossible in special cases - there's three possible angles of rotation for an equilateral triangle, for example. More generally, if you fix two of the corners in space then the possible locations of the third point form a circle whose axis is the line joining the first two points. If the plane of that circle is perpendicular to the camera then the ray from the camera through the third point generally intersects the circle twice and there are two possible solutions.

You can probably handle those cases if you're using video by insisting that your answer be "near" your previous frame's answer. Care would be needed on initialisation in case of a starting pathological case.

Edit: since you can't actually fix the first two points in space, the locus of possible positions for the third point is rather complicated. I suspect that there are other cases with ambiguities.
Nope. I got it by one frame. Video is a just presentation. Just look to equation what i posted early. Factors is the multiplied Cosines of some angles. Sorry for my English.

#### mrStrange

But. Pinhole cameras don't exist in real world. I must get all camera parameters from all cosines from this equation. And it is very hard. Because I don't know equation for angle relations in a tetrahedron. I got little one, but it useless for me.

#### Ibix

Science Advisor
Nope. I got it by one frame. Video is a just presentation. Just look to equation what i posted early. Factors is the multiplied Cosines of some angles. Sorry for my English.
Here's a concrete example where it will go wrong, if I understand your method.

Place your pinhole (the point where all rays from the triangle vertices cross) at the origin, facing in the +x direction.
Place one triangle vertex at (x,y,z)=(10, 2, 0)
Place the second triangle vertex at (10, -1, 0)
Place the third triangle vertex at (11.717, 0, 1.025)

Repeat, but this time with the third vertex at (8.131, 0, 0.711)

It's easy to show that the triangles are rotated copies of each other, so can be two images of the same triangle. It's also easy to show that they produce the same dot pattern on your screen, so you cannot differentiate these two cases from just the positions of the dots - you need some auxiliary information.

Edit: if you need precise figures, the x coordinates of the two third vertices are $$L\cos^2\theta\left( 1\pm\sqrt{1-\frac{1-r^2/L^2}{\cos^2\theta}}\right)$$and the z coordinates are the x coordinates multiplied by $tan\theta$. I used $L=10$, $r=2$ and $\theta=5^\circ$, but any values should work as long as $\tan\theta<r/L$ and you use $L$ for the x coordinate of the first two triangle vertices.

Edit 2: The above is an implementation of this:

More generally, if you fix two of the corners in space then the possible locations of the third point form a circle whose axis is the line joining the first two points. If the plane of that circle is perpendicular to the camera then the ray from the camera through the third point generally intersects the circle twice and there are two possible solutions.

Last edited:
• WWGD and berkeman

#### mrStrange

Place your pinhole (the point where all rays from the triangle vertices cross) at the origin, facing in the +x direction.
My pinhole at the origin, but foward direction (perpendicular sensor direction) is z+. I don't know how to rotate basis.

But you right about infinite triangle variations if the ray from pinhole lies on a triangle plane. And triangle projection looks like the line.
this is just an exception))

Last edited:

#### mrStrange

By the way. I got another equation.
For the triangle in the space ABC and point S (center of perspective projection) true equality:
3*SM = SA*CosMSA + SB*CosMSB + SC*CosMSC;
Where M the centroid of ABC
You can check it.

#### mrStrange

Here's a concrete example where it will go wrong, if I understand your method.

Place your pinhole (the point where all rays from the triangle vertices cross) at the origin, facing in the +x direction.
Place one triangle vertex at (x,y,z)=(10, 2, 0)
Place the second triangle vertex at (10, -1, 0)
Place the third triangle vertex at (11.717, 0, 1.025)

Repeat, but this time with the third vertex at (8.131, 0, 0.711)
Please, I want to check it. I don't understand. I work with +z direction. Its give me a real result of any rotation and position.
Checking my equation a serios limitations. Top angles should not be too small, Double type of variable give me the fault.

#### Ibix

Science Advisor
Just read my coordinates as (z,y,x) instead of (x,y,z).

### Want to reply to this thread?

"Triangle homography is possible! I am a first?"

### Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving