7- Thin Lense

In computational photography, it's common to make what's known as a thin lens assumption. So a thin lens assumption is basically the drawing that I just showed you before. Where we say okay, for given lens with a given focal point, it's going to image some object at let's say distance, d0, at some distance di, or, or for d for image, back. And the question is can we predict, from the focal point what the relationship is between d0 and di? Well obviously the answer is yes, or I wouldn't have been wasting all this film.

Or, I waste your time. So here's a thin film lens diagram taken from the slides by a Forsyth for their textbook, and we're going to use that to derive the relationship between distance in the world. And which we're going to call here z, away from the, the center of the lens, to the distance z prime, which is where the image will be focused, and the focal length, f. First, just to be clear, here is some point p that's at some height y, since we're just going to look at that side. We're going to assume that it's projected at some point p prime, that is, y prime. Off of here. And here is our focal length, f. All right? The idea is that all parallel rays are going to intersect f. Okay? Which is why this one goes back here this way as well. All right? So when we have all sorts of parallel lines and that are going through the same point, it's easy to reason about what's going on here using similar triangles. So here we have our similar triangle.

And it basically says that y is to z as y prime is to z prime. Two things to note here. First of all, I only use the magnitude of z and z prime, because we're only going to worry about the length. And I probably could have used the magnitude of y prime, but just to make it clear that the y value is inverted, I set negative y prime as being a positive value. So if y is positive, then y prime would be negative. If y is negative, then y prime would be positive and thus the negative sign. All right, so that's our first similar triangle. Our next similar triangle is here. And that says, and this one's a little bit trickier. Again, the ratio between y prime and y is the same as the ratio between z minus f, so that's this amount, right?

All of z minus f, is to f. So y is to f. All right. So just look that a little bit. So y prime, size of y prime is to y as z prime minus f is to f. So that gives us a second set of similar triangles. Combining these two formulas gives us this formula. Not rocket science here, we're just setting the two left hands sides are the same, so we set the two right hand sides equal to the same. We continue, we play around with the math a little bit. And we get this very simple formula.

That 1 over the magnitude of z prime plus 1 over the magnitude of z equals 1 over f. That's the thin lens equation, and any points that satisfy that equation are in focus, okay. So if my film plane, on a thin lens assumption or a thin lens model. If my film plane is z prime away from the lens for a focal length f, then everything that is z away will be in focus. So by moving the lens in and out a little bit from my film plane, I change where in the world things are in focus. So I can change the z prime easily. I can move the, the lens in and out from where my film plate is and that changes the points out in the world that are in focus. There's a cool little thin lens app. It took me four times to say that before I got it right. It's posted here on the Web and it just lets you sort of play around with how you change the geometry of what's going to happen.