# Finding proportions in perspective

Is it possible to find proportions of a plane in perspective? All drawing the tutorials I find on the subject presume that there’s a square object in the scene that you can reference to but what if there’s none? How do I find if the object is square if I only have 2 vanishing points?

For example these three planes are: square and two rectangles with 1.5x and 2x height but can I calculate the proportions without knowing this? Using a method from this video — How to Draw a Perfect Square and Cube in 2 Point Perspective — I was able to find the proportions using a geometrical approach but I wonder if that’s possible to do mathematically, by, idk, multiplying one tangent by another or something… ugh I forgot maths. It is possible that the question is more suited for math.stackexchange but they seem to discuss much more complex stuff in there

I guess you accept the ordinary radial projection where lines of sight between the station point and the target points draw the image as they punch the image plane. The transformation equations can be written directly with quite simple vector algebra.

If you are not interested in any general level poetry of your subject you can jump to to title “Something concrete”.

If the image plane is the XY plane in the ordinary rectangular XYZ coordinate system the transformation formulas are especially simple: The observer is at the station point which has coordinates Sx, Sy and Sz. He stares a target point which has coordinates Tx, Ty and Tz. The sight line punches the image plane (=XY) at point X=Px, Y=Py, Z=0

Elementary vector algebra gives equation E1. The vector from the station point to the image point is a shortened version of the vector from the station point to the target. The shortened version (=blue arrow in the image) can be written as g(TS) where g is a number which depends on how far from the image plane the station point and the target are.

Equation E1 says simply that if one flies at first from the origin to the station point and then towards the target so that the translation vector from the station point is g(TS) he reaches the image point.

Equation group E2 has the same as exploded to 3 equations between the coordinates.

The 3rd equation in group E2 comes from the fact that the image is in the XY plane, the Z-coordinate of the image point is zero. The multiplier g can be calculated from the 3rd equation. it’s presented in E3.

So, using g = Sz/(Sz-Tz) in the 2 first equations in group E2 we can calculate the coordinates of the image point with no exotic things such as matrix algebra which very easily kicks ordinary punters away from trying to read academic or engineering texts of computer graphics.

But you did not want this elementary projection law, you wanted to find the actual target coordinates or at least the distances between some of them (=the side lengths) when the image points are given.

Reversing the projection law above is not possible only by having the image, because infinitely many points at the same line between the station point and the target have the same image. You must know something more than only the image.

There’s a comment which suggests you to use Excel Solver to search a station point and target points which fit the given image points. That’s an usable idea. But you must assume a couple of things to make unique solution possible. The assumptions can be made of the forms of the patterns that the targets points together make. Or simply you assume where the station point is and the surface where the target points are placed on.

You cannot solve the surface where the target is, not even if you knew the station point. If your polygons are on a plane the placement and tilting of the plane in relative with the station point and image plane can be decided only based on some known forms of the target. If it happens that you know one of the shapes is originally a square that’s of course a good constraint, but programming it to Excel solver at the same time with equation group E2 to a single error formula which should be minimized really needs a person who really knows what he does. I skip it.

Tricky perspective problems like yours are presented now and there in GDSE. This resembles your case: How to revert to perspective transform?

I’m afraid no really ingeniously simple solutions will appear because perspective transforms need much other data than the image to be uniquely reversible. But do not take that granted. A real genius can show something that the rest of us do not know.

Mathematics Stack Exchange site contains several discussions of advanced techniques. A couple of examples: https://math.stackexchange.com/questions/1691895/inverse-of-perspective-matrix

https://math.stackexchange.com/questions/3577395/reverse-perspective-matrix-to-find-2d-coordinate-with-known-height

Both of them needs university level math knowledge to be understood.

Reversing the projection equation group E2 is especially simple, so simple that no numeric equation solver nor tricky math is needed if you select the coordinates of the station point and decide the target is on the XZ plane (= y- coordinates of the target points are zero)

It can resolve cases where the target is horizontal and the image of it was shot with a camera which looks horizontally (=vertical image plane).

With these assumptions you calculate the coordinates Tx and Tz of the target points from the coordinates of image points as follows (g, Tx, Tz solved from group E2 by assuming Ty=0):

At first the distance factor g = 1-(Py/Sy). The coordinates are:

Tx = (Px-Sx(1-g))/g

Tz = -Sz(1-g)/g ; NOTE: Pz = 0.

As said, this is useless for reversing your image example because you do not know the station point nor the plane where your shapes were drawn on. If you assumed some station point coordinates these equations would give some non-rectangular shapes which would have your image as their perspective drawing if the shapes were in XZ plane.

You see later graphical methods how to restrict possible imaging details by making more assumptions.

Something concrete:

If you know the shapes in your image are rectangular and one of them is a square you can try to stretch the image in Photoshop Edit > Transform > Distort. I know it’s not documented to be a perspective inversion, but if it generates a square and rectangles, they very likely have also right proportions: A commentator has already said that this is not a graphical solution, it’s a shot in the dark. He’s right. But that shot have a possibility to hit.

If your image is so good that the vanishing points are possible to draw when the canvas is extended you can reconstruct the original shapes in a 3D CAD program.

See this old case:

How to construct a cube in 3-point perspective

There the original is constructed to complete a started 3-point perspective drawing of a cube which had already drawn one edge and 3 vanishing points. You can find in 3D the placement of the station point and the orientation of the cube in relative with the image plane.

Your image in the question seems to have only one vanishing point. It greatly simplifies the case, but leaves it ambiguous. Three vanishing points and knowing the image is made of a cube nail the place of the station point in relative with the image plane. Your image allows more possibilities.

The number of possibilities can be reduced by making assumptions. I assume the original shapes are in the same plane and they are rectangular. This is not restrictive enough. To get the right rectangles one must assume one of the shapes is a square.

I have this old image drawn for another case. It shows how to construct a 1-point perspective image of a cube. It can be used to make things clearer also in your case. If you have a square it could well be the top or bottom side of a cube: The place of the vanishing point shows how much above and aside of the square the station point must be.

One can also decide how far in front of the image plane the station point must be if he knows the proportions of one original rectangle.

I made this coarse manual tracing of your image. The blurry bitmap edges are replaced by 6 exact ones which point to the assumed vanishing point and by other 6 edges which are parallel (=no vanishing point): By applying the one point perspective image construction scenario we can build the next composition: The plane of the originals (=green) is placed at the edge of the assumed image of a square to utilize the squareness assumption as easily as possible. Just that edge in the image must also be an edge of the original square.

The plane of the originals is perpendicular with the image plane and in parallel with those edges of the images that do not converge towards any vanishing point.

The station point must be somewhere in the green line which starts from the assumed vanishing point and is perpendicular with the image plane.

I have drawn a fake station point. A fake sight line (=dotted) is drawn from the fake SP to a corner of the image of the assumed square.

The blue line contains somewhere an original corner point of the square because it’s perpendicular with that image line of the square which happens to be also one edge in the original square.

The place of the actual corner of the original square is easily found with a circle R=the known side of the square. The actual station point can be found by drawing a long line starting from the corner of the image of the square, going through the found corner of the original square and ending to the green line: Now the original shapes can all be reconstructed by drawing sight lines which start from the station point and connect the originals-plane and the corners of the shape images: A straight on the face image of the original shapes without any extras is this: It resembles the claimed rectangles in the question. It’s not perfect due the poor tracing based on assumptions that can be bullshit.

The vanishing point is surely guessed quite much off due the blurry corners of the shapes in the given bitmap image. The guess “it has only one vanishing point” can can also be bullshit. More general solution will be shown later.

Reversing 1-point perspective image graphically in 2D

If one of the shapes in the image is a 1-point perspective image of a square or a known rectangle the reconstruction of the originals is as easy in 2D as in 3D CAD program. The placement of the station point can be found by drawing with no calculations. The assumed square (=blue) or the known rectangle is drawn just behind the image plane. The distance how far in front of the image plane the station point is placed can be found by drawing a single line (=magenta) either to the top view or to the side view. The station point is on the green line which starts from the vanishing point. The side view can be as far away in the right as needed to fit all images (=red) to the same drawing.

The elevation of the station point is directly the distance from the vanishing point to the plane of the original.

More general case

As said earlier, the assumption there’s only one vanishing point can be inaccurate. But the reconstruction of the original is still easy if the image contains one shape which is known to be originally a square, no matter it’s image has 2 vanishing points. Even more general cases can be resolved if we know enough of the original image. Let’s see what to do if it’s known that one of the shapes in the original is a square and its image has 2 vanishing points.

Earlier there was a link to a case where the place of the station point was reconstructed from 3 known vanishing points of an image of a cube. That method cannot be used as is because 2 vanishing points leave a circle of possible places for the station point. But a square has more 90 degrees angles than the corners – the diagonals are also perpendicular and their vanishing points surely are different than the vanishing points of the sides. That gives another constraint which nails the placement of the station point. An example: We have the red 4-gon. It’s an image of a square – I drew it to test the perspective drawing method. The image is already rotated for convenience so that vanishing points V1 and V2 have same Y-coordinate. Then we can call the y-coordinate “elevation” and the straight line through V1 and V2 is the horizon line. The actual original square can be in XZ-plane which we call ground and and XY plane is the image plane. Let’s insert more points: Let the corner A sit on the ground. Then we have one point less to be projected. The diagonals have no parallels, but their vanishing points Va and Vb should be on the horizon line because the diagonals of the original are on the ground (=XZ-plane)

It’s easiest in 3D to find the place of the station point. My earlier adventures and also the common projection theory tell that the lines from the station point to the vanishing points of the image of a square should be perpendicular. That doesn’t give to us more than the station point should be on the circle which has diagonal V1…V2.

As said earlier the diagonals of the original square also are perpendicular. Thus the lines from the station point to vanishing points Va and Vb also should be perpendicular.

NOTE: There’s actually no need to have a square. As well you can have 2 separate rectangles with different orientations i.e. they have different vanishing points. And actually any known 2 angles which have non-parallel edges are enough because you can construct 2 circles which have these angles as inscribed angles (refer elementary plane geometry texts, for ex this: https://caddellprep.com/subjects/common-core-geometry/central-inscribed-angles/)

In the next image I have decided the side of the image plane where the station point should be and drew 2 horizontal half-circles with diagonals V1…V2 and Va…Vb. The station point should be in the crossing of the half circles: After using the crossing of the arcs as the station point and drawing the sight lines to the ground through the corners of the image (A was already on the ground) the blue shape was able to be drawn as the original: The straight on the face view shows that the shape is quite a good square: The drawing is not the best possible because the half circles in this CAD program seem to use a kind of polygon approximation in rendered scenes. It makes the crossing point not so sure. The side lengths of the found square varied 0,1%. In pro CAD programs there should be possible to make constrained sketches, where exact crossings are calculated with full accuracy.

In addition there’s not explored what this method would produce if the assumed image of a square actually was an image of another 4-gon than a square. Some research is needed to find is it possible to reveal “it was not a square originally, you got a square only because you assumed it’s a square”.

Finally there’s plenty of room for reasoning how to proceed if the original doesn’t have a square or rectangles at all, but some other known shape. One possibility is to use the next elementary fact:

The 90 degrees angle between the lines drawn from the station point to vanishing points reflected the fact that the original lines were perpendicular. The angle between the lines drawn from the station point to vanishing points should be the same as the angle between the original lines, no matter are the originals perpendicular or not.