Mobile app version of vmapp.org
Login or Join
Si6392903

: Perspective geometry: How to put an item in a projection according to distance I have the following image of a road The image represents a road 100 meters long, as viewed from a camera 1

@Si6392903

Posted in: #Perspective

I have the following image of a road



The image represents a road 100 meters long, as viewed from a camera 1 m high.

I want to place a car 50 meters ahead of me in the middle lane but I can't quite figure out how to calculate where to put it. I can calculate the expected width it will have using the view angle and then according to that figure out it's location on the road, but I'm hoping there's something simpler.

Example:



Any tips on how to do this?

10.04% popularity Vote Up Vote Down


Login to follow query

More posts by @Si6392903

4 Comments

Sorted by latest first Latest Oldest Best

 

@Merenda852

Simply:


Make a rectangle with a horizontal line in the middle.
Apply the perspective transform to have the rectangle overlap your road.
The middle line in the rectangle with perspective is where your 50m line is.

10% popularity Vote Up Vote Down


 

@Bethany839

If you can calculate it, you understand the scenario. That makes to you possible as well draw it. In Illustrator or Inkscape you can have any scaling without losing the accuracy. I have constructed an example, how apparent heights ( actually distances to the horizon line) can be drawn:




The observer
the place of the apparent drawing paper. All heights are marked here. The top of the vertical blue line is the top edge of the paper and the bottom end of the same line is the bottom of the paper.
a line to the horizon
the end of your lane
a simple object


The next image is a construction of the heights. The widths are quessed except the object 5 is drawn like it were rectangular and parallel with the lane. Thats why the edges are directed to the same escape point than the sides of the lane.


For exact widths you need a top view projection that you use to measure the apparent widths in the same way as I measured the heights.

This all is a very old theory that was in wide use before the year 1500. If you want to do it easily, goto 3D. Even free SketcUP can help yo create realistical perspectives. There's no urgent need to construct complex 3D models. You can place there only coarse mock-ups and then make a careful illustration over the SketcUP screenshot. In addition very rich selection of things (everyday stuff, buildings, animals....) is freely downloadable straight into your scene from SketchUP's 3D warehouse.

In Illustrator there's the Perspective Grid tool which is handy if you work in 2D, want consistent looking perspective but are not especially interested to make too many measurements from different projections. It's as accurate as measurements, if you adjust it properly (tricky!!!!) to yor scene and have some calibration objects that have realistic 2D dimensions.

Your current case:



This is the principle without any scale. You are in point A. The apparent place of your image B is unknown, So is C, where the lane edges disappear from the image. The only known distance is 100 meters from A to D. Unfortunately that's not enough to reconstruct your case, because your image has very low resolution. We cannot reliably decide how wide the far end of your whole track is in the image.

Lets assume you can measure it better. Let you have got the far end of your whole 3 lane track have width T (pixels, millimeters or other units) in your image.



Then we can calculate the apparent distance of the image.

The apparent distance AB = T * (100m / the real width of the track)

We assume that your camera doesn't have any distortion.

If you can decide T, then you probably can mark the escape point, too by continuing the right and left edges of your track. They meet at the escape point and there's also your horizon.

Now we can calculate how much below the horizon is the apparent ground at 50m distance. The real altitude difference is 1m, as you told.

the altitude difference from the horizon to ground in the image is

= (1m/50m) * AB = 0,02 * (100m / the real width of the track) * T

Lets assume your T= 8 pixels and your total track width is 8 meters. Then the ground at 50m in front of you has altitude 2 pixels below the horizon in the image.

That's not very inspiring result. If the car happens to be 2m wide, its width in the image would be 4 pixels. If you work in photoshop, you have generously 3 smaller brush sizes to paint the details.

To have artistically interesting output you should consider to draw the car to much less distant position.

10% popularity Vote Up Vote Down


 

@Alves566

Your road is 100 meters long and you want to find 50 metres, so we are basically looking for a way to divide the road in half. That's quite easy. Just draw in the diagonals of a rectangle and they should intersect in the center, in perspective as well as in plan:



There is also a neat trick to divide the depth of a rectangle by projecting the divided width onto the diagonal and then to the depth, like this:



In your case, unfortunately, the center is positioned way off in the distance. The perspective must be rather distorted - the road almost ends in a point (I have taken the liberty to invert your image and continue the lines):



You could just shorten your road to change the perspective, but you could also look into constructing it more precisely from a plan and an elevation. It is good practice i guess, but if you need a fast result it might be easiest to use some free 3D software like SketchUp or Blender to make a basic sketch.

10% popularity Vote Up Vote Down


 

@Nimeshi706

You would need to set up a scale before the perspective projection. If you convert the known scale to the perspective, you can have markers for distance.

(This is not an accurate scale / just eyeballed)

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme