Calculate object distance by using just the parallax angles

In summary, the conversation discusses the concept of perspective and how it affects the perception of parallel lines. The speaker asks if there is a formula to calculate the distance from the observer to the point where the parallel lines appear to converge, also known as the vanishing point. The goal is to use this formula in a simulation program. The conversation also mentions Apple's AR kit and how it uses triangulation to calculate precise measurements. The speaker confirms that they have all the necessary variables to calculate the vanishing point, and they are looking for a generic algorithm to achieve this in a 3D simulation program.
  • #1
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
  • #2
I'm pretty sure the convergence point is always at infinity, so there's not much to calculate.
 
  • Like
Likes FactChecker
  • #3
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?
 
  • #4
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.
 
  • #5
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.
 
  • #6
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.
 
  • #7
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.
 
  • #8
Autofocus can tell the distance to the object in focus. That is not the same method as you are suggesting.
 
  • #9
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...
 

Related to Calculate object distance by using just the parallax angles

What is parallax and how does it relate to calculating object distance?

Parallax is the apparent shift in an object's position when viewed from different angles. In order to calculate the distance to an object using parallax, we need to measure the angles at which the object appears from two different points of observation.

What are the two angles needed to calculate object distance using parallax?

The two angles needed are the baseline angle (the angle between the two points of observation) and the parallax angle (the angle at which the object appears to shift).

How can we measure the baseline angle and parallax angle?

The baseline angle can be measured by physically measuring the distance between the two points of observation. The parallax angle can be measured by taking two pictures of the object from the two points and using trigonometry to calculate the angle.

What is the formula for calculating object distance using parallax angles?

The formula is distance = baseline length / tangent(parallax angle).

What are the limitations of using parallax to calculate object distance?

Parallax can only be used for objects that are relatively close to Earth. It also requires accurate measurements of both the baseline angle and parallax angle, which can be difficult to obtain. Additionally, parallax does not account for any potential movement of the object, which can affect the accuracy of the calculated distance.

Similar threads

Replies
7
Views
4K
  • Precalculus Mathematics Homework Help
Replies
3
Views
969
  • Introductory Physics Homework Help
Replies
7
Views
306
  • Astronomy and Astrophysics
Replies
29
Views
4K
  • Astronomy and Astrophysics
Replies
4
Views
2K
  • Precalculus Mathematics Homework Help
Replies
1
Views
605
Replies
13
Views
3K
  • Precalculus Mathematics Homework Help
Replies
4
Views
1K
Back
Top