# Thread: Perspective projections (focal length and vanishing points)

1. ## Perspective projections (focal length and vanishing points)

I am currently working on some homework which relates to perspective projects. I've been able to complete some of the questions but not others. I'd like to be pointed in the correct direction and have my reasoning corrected, if needed.

Say that we've given 4 points, p_0, p_1, p_2 and p_3, retrieved from a perspective projection of a 3D rectangle, where the sides aren't parallel. If the focal point is at the origin and the camera is looking down the negative z-axis:

1. How do we use the projected points to find the 2D vanishing points?
My idea is that create two lines from 2 points each and find their intersection. Do the same for the horizontal direction. Thus, we get 2 vanishing points.

2. If we have two rays from the focal point to one vanishing point each, will they be orthogonal?
I think not because if I compute the dot product of the above two vanishing points, I get a non-zero number.

3. Get the focal length.
I have no idea on how to begin. How can we possibly find the focal length w/o having the previous 3D coordinates?

4. Get the normal to the plane of the rectangle.
I have a feeling this relates to computing the normal by using the cross product. Do I simply take two of the above lines (intersecting ones) in 2D, add a z-coordinate of 1 and then compute the normal?

Note that I did not put specific numbers or examples, because I'd like to learn it by doing the homework. If someone could please guide me into the correct direction, I'd appreciate it. Thanks!

2. ## Re: Perspective projections (focal length and vanishing points)

Hey mrmackey.

Is your projection on to a 2D plane? If so then are you finding x' = x/z, y' = y/z or are you using some other transformation?

3. ## Re: Perspective projections (focal length and vanishing points)

Hi Chiro, thanks for the reply.

Yes, the projection is onto a 2D plane. The perspective matrix looks like:
[1 0 0 0]
[0 1 0 0]
[0 0 1/f 0]

So x' = fx/z and y' = fy/z. But without having the coordinates of the original 3D rectangle (x,y,z for 4 points), how can we make use of the above? At the moment, we have four points (x', y') in the 2D plane that were gotten after the 3D rectangle was projected. We are trying to find f (the focal length). We don't have x,y,z either.

4. ## Re: Perspective projections (focal length and vanishing points)

Well if we assume that the z coordinate is the same we basically get:

x' = (f/z)*x, y' = (f/z)*y and for four points this means:

x1' = (f/z)*x1, x2' = (f/z)*x2, x3' = (f/z)*x3, x4' = (f/z)*x4
y1' = (f/z)*y1, y2' = (f/z)*y2, y3' = (f/z)*y3, y4' = (f/z)*y4

We can also re-write (f/z) as cf where c = 1/z (which is a constant if they all lie on the same plane) or just a constant d.

You can then use this to get back your original points in terms of this constant f/z.

The only thing though is that without extra information both f and z could be varied to get the same value. So you could for example increase f while reducing the z coordinate of the original shape and you would still get the same result.

If you have any other constraints for how f and z are related then use that: otherwise you can't get a unique solution.

5. ## Re: Perspective projections (focal length and vanishing points)

Hi Chiro,

That's as far as I was able to get as well. But not being able to get a unique solution, or a unique value for f, I feel like I am missing something.

Nevertheless, I will continue trying to figure it out. And if I do, I'll report back.

Thanks for your help!

#### Search Tags

focal, length, perspective, points, projections, vanishing 