Undergrad Calculate object distance by using just the parallax angles

Click For Summary
The discussion revolves around calculating the distance to a vanishing point using parallax angles and the observer's height. The user seeks a formula to determine this distance based on angles derived from a grid image, noting that parallel lines appear to converge due to perspective. It is clarified that true parallel lines do not converge in reality, and the perceived convergence is an optical illusion. The conversation shifts to the need for two images for triangulation to accurately calculate distances, as seen in Apple's ARKit, which the user aims to replicate in a 3D simulation. Ultimately, the goal is to achieve realistic visual representation in the simulation, prompting inquiries about generic algorithms for modeling perspective accurately.
jay t
I have a simple paper with parallel grid lines and I know the height of the observer from the ground level.

Now when I snap the picture with my camera, the effect i get is what is seen in the image below. Even if the lines are parallel, the perception is that they converge in the middle.

When i draw lines on the lines of the page, i get angles.
GlUMV.gif


Is it possible that given the information below:

  1. The height of the observer from the ground
  2. The angles generated
That I can calculate the distance from the observer to this "convergance" point? Is there already some formula for this?

The goal is this: If there is some generic formula to calculate the distance from the observer to the convergence point, then I can use this formula in simulation program involving the calculation of small distances.
 
  • Like
Likes astrocat98
Physics news on Phys.org
I'm pretty sure the convergence point is always at infinity, so there's not much to calculate.
 
  • Like
Likes FactChecker
Hi thank you for responding. I do not understand. The red lines converge at a point in the gif image above. Which part is infinite?
 
jay t said:
Which part is infinite?
The distance to where the parallel lines appear to meet (because they never do), as measured on the plane on which they are drawn. Which, as I understand, is what you want to find.
Consider that if it were anywhere closer than infinity, it'd mean that looking farther would make the parallel lines appear to diverge.

The convergence in the gif is the vanishing point - its an illusion of perspective that appears on the plane of the image, and not a point on the physical (ground) plane:
1024px-Vanishing_Point.jpg

The actual lines stay parallel, and never converge.
By drawing the red lines on the gif, you drew on the image plane, which gave you the vanishing point. If you wanted to draw lines on the ground plane so that they appear to meet in a point, you'd need an infinitely long piece of paper.

This is, by the way, not parallax (what your thread title suggests). With parallax you're not dealing with parallel lines, and the angles you measure are how much they deviate from parallel.
 
If you actually measure the angles on lines that are not parallel, but meet at a point on the target, then you can do something. But you are actually using lines that never meet. As others have pointed out, if you made the measurements with perfect precision, you would get an infinite distance. So the only way you could get a finite distance as an answer would be if you made a measurement error and the associated distance would be an error.
 
Suppose you did have two straight lines from a target point to the foreground, one on your left and another on your right at known positions. Camera lenses distort angles. You would have to take that into account and it would be a can of worms.
 
Thank you for the input guys.

I am asking because i see Apple has released their new Augmented Reality library, and it does distance calculation by looking visually at an object.



Under the hood, they must be employing some algorithm to calculate something similar to the question i asked.

I think i will use the point where the red lines converge and mark it as my "vanishing point".
I guess if i could rephrase my question, i would ask ->

1. Is there a formula i can use to calculate the vanishing point based on the red colored angles?
2. Is this formula generic for ever situation. By this i mean: I have angles in the example above of a real image, so are these angles the same (or is the formula the same) for every real life scenario?

Apple's AR kit seems to be doing it. I just wanted to know how its done for the vanishing point.
 
Autofocus can tell the distance to the object in focus. That is not the same method as you are suggesting.
 
Last edited by a moderator:
  • #10
jay t said:
It seems that instead on 1 single Image, I need 2 images in order to do triangulation.
And either:
1) a known fixed relative position/orientation between the 2 images or
2) an accelerometer/ gyroscope to know how the camera position and orientation has changed between the two images.
 
  • #11
Awesome :)
ok. In my case, i will not need the gyroscope, because I already know the observer's position, height, and distance changes.
I also know the relative positions/orientation between the 2 images.

The only thing missing is.. i do not know if there is a generic algorithm to calculate the vanishing point..
 
  • #12
jay t said:
Awesome :)
ok. In my case, i will not need the gyroscope, because I already know the observer's position, height, and distance changes.
The gyro would be to know the exact direction that the camera is pointed in the second photo versus the first, not the position. Regardless of the positions that the two images are taken from, if the target is centered in both, you have nothing to work with unless you know how the camera orientation has changed.
 
  • #13
Ok. what if I have have all the variables? I know the exact direction the camera is pointed in 2nd photo vs the first. And i know exactly how the orientation has changed.
Then will I be able to calculate where the approximate vanishing point will be?

Remember the goal is to put this into a 3d simulation program. I literally know all the variables because I will be the one coding it.
I just want that inside the 3d world, the perspective look should behave the same way as in real world. Thats why I am wondering if there is some generic algorithm to accomplish this. In the image above i notice things look a "certain way" (as if lines converged even though i know they are not). So, is this behavior "generic" enough that some algorithm can be used model a 3d world which behaves like real life? I am not sure if i am clear to you guys in what i am asking...
 
  • #14
jay t said:
Remember the goal is to put this into a 3d simulation program. I literally know all the variables because I will be the one coding it.
I just want that inside the 3d world, the perspective look should behave the same way as in real world. Thats why I am wondering if there is some generic algorithm to accomplish this. In the image above i notice things look a "certain way" (as if lines converged even though i know they are not). So, is this behavior "generic" enough that some algorithm can be used model a 3d world which behaves like real life? I am not sure if i am clear to you guys in what i am asking...
While I'm not sure if your quest for vanishing point is the right direction to go (e.g., with two pictures you are actually doing parallax) - there are some equations on its wikipedia page.
 
  • #15
If you know all the variables in a simulation, then why can't you just directly calculate the distance from the viewpoint to the target? The usual problem in a 3D simulation is trying to get the visual to match the known geometry and distances, not the other way around.

PS. There are graphics packages that greatly help create the visual scene from the (x,y,z) coordinates of the objects, including z-buffering, occlusion, scaling, fading in distance, etc. Trying to do all that yourself from scratch is a huge task.
 
Last edited:
  • #16
I have rephrased the question above . I think you may have missed it because I am typing so much.. sorry about that.

I guess if i could rephrase my question, i would ask ->
1. Is there a formula i can use to calculate the vanishing point based on the red colored angles?
2. Is this formula generic for ever situation. By this i mean: I have angles in the example above of a real image, so are these angles the same (or is the formula the same) for every real life scenario?

So yes, i know all the variables, but I want to get a realistic as possible view in the simulation. Which is why, i just want to know if there is generic formula for calculating.

--> "The usual problem in a 3D simulation is trying to get the visual to match the known geometry and distances"

In my case, I am trying to make the simulation look visually almost exactly to reality. This project is more about the way things looks visually rather than calculating distances etc. Do, not worry about creating it from scratch. I will not be going totally from scratch with my code.
Sorry for stretching out the problem over so many lines...
 

Similar threads

  • · Replies 7 ·
Replies
7
Views
5K
  • · Replies 7 ·
Replies
7
Views
577
  • · Replies 29 ·
Replies
29
Views
6K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 7 ·
Replies
7
Views
980
  • · Replies 3 ·
Replies
3
Views
5K
Replies
12
Views
932
  • · Replies 8 ·
Replies
8
Views
2K
Replies
13
Views
4K
  • · Replies 1 ·
Replies
1
Views
4K