# Perspective projection plane, calculating squares on the plane

Let's say I have a road I'm looking at from the top, have a square on it. Then I have a different location from which I look at the road, the square now is a convex quadrilateral.

https://i.imgur.com/VfKch8R.png

I have a square shaped texture I want to put inside this quadrilateral (which is a square with perspective distortion), I can use this method and it works perfectly : Finding the Transform matrix from 4 projected points (with Javascript)

Now if I have an image of a road and I select the edges of the quadrilateral on it to determine a perspective plane. How can I calculate the perspective projection of squares I draw onto the other sides of the image? The oculus point is not known. https://i.imgur.com/QhK5mNi.png

For the plane's equation I should be able to use any 3 edge points of the quadrilateral, where: based on the other post's step 6, I compute (x,y,z) of these points.

From there on I am very confused how to and what to do, mostly because I can't imagine how things would look.

Maybe it has to do something with rotation of the plane, which if not related would still be nice to know, because I draw the initial square based on a vector and rotate the texture accordingly, with a downwards looking vector it will look like this and I want to correct it (ignore the diagonals, also the arrow is not perfectly centered) https://i.imgur.com/IMftDpW.png

• What do you mean by “the other sides of the image?” – amd Jan 23 at 20:48
• Sorry, I forgot to upgrade the post and clear it up as I was on it. i.imgur.com/QhK5mNi.png This should describe it better, will add it to the post as well – Krend Jan 23 at 21:36
• Be very careful not to confuse homogeneous coordinates of points in a plane with world coordinates of points in the 3-D scene. They’re both triples of numbers, but they mean rather different things. In particular, the coordinates used in the construction of the homography are the former—they don’t really tell you anything about the 3-D world coordinates of points on the road. – amd Jan 23 at 23:17
• Thank you very much, now it makes sense why it didn't make sense in my head :) Found a gimmicky solution there :stackoverflow.com/questions/76134/… Unfortunately it is too slow for my use case, so I have to scrap it altogether. – Krend Jan 24 at 8:23
• Well gimmicky I say, but it actually is really good, might be able to just use a less accurate approximation from them – Krend Jan 24 at 9:14