In my last article, I posted this photo and asked you to identify what’s wrong with it:
As it turns out, this is actually a really easy question to answer– the background of the photo is in focus, but the bear isn’t. Now, I’ll be the first to admit that teddy bears are supposed to be fuzzy, but this isn’t the kind of fuzziness that most people have in mind. The more interesting question here is why the camera got the wrong thing in focus. In order to do that, we have to learn a little bit about how autofocus works.
Before we do that, let’s try a little mini-exercise. Pick up your camera. Look through the viewfinder, point it at any interesting subject and press the shutter button halfway. You’ll probably see a display with a bunch of black boxes and some red ones. In this image I’ve colored the black focus points green so that you can see them better. Your camera might only have a few little boxes or it might have lots and lots of them. Those little boxes are called autofocus points:
So how does autofocus work? It’s a complicated, highly-technical thing, but here’s the simplified one-paragraph version that will tell you most of what you need to know.
When you use autofocus to take a picture, the camera looks at each of the autofocus points and looks for areas of sharp contrast. The camera then changes the focus on the lens just a little bit and checks those points again to see if the contrast is better or worse. It keeps doing this, adjusting the focus a tiny bit each time, until it thinks it has the best focus. Once it does, it takes the picture. There’s a whole lot of black magic going on behind the scenes to make this happen, but that’s the really simple version.
The camera might choose to use all of the focus points if it can. More often, it will use one or a few of them to find the subject. As you’re looking through the viewfinder, the camera will light up an individual focus point if it’s happy with the focus in that area. If your camera is guessing wrong you can boss it around and tell it exactly which points to use, but that’s a subject for a different lesson.
So that’s it– when you autofocus, the camera looks at the areas in the little black boxes and then changes the focus on the lens until it’s happy with the results. That’s not so hard, is it?
2 responses to “How Autofocus Works, a really simple explanation”
Yay! You’re back! :-)
I’d like to mention that if you have an SLR camera, you might find that autofocus is faster if you use the viewfinder. Why? The view finder has dedicated sensors for phase detection focusing.* Essentially, this means that the camera can tell approximately how out of focus something is and skip a lot of the trial and error of contrast detection focusing. Even then, contrast in the area of focus is important.
* Phase detection works a bit like our eyes do. When both of our eyes are open, if we focus on something close, things that are farther away get doubled. Vice versa for when we focus on something far away, things that are closer get doubled. The farther out of focus an object is, the further apart the double images are. The camera can use this to calculate how much focusing is needed.
Sounds complicated! I prefer to think of it as magic. :-)
But yeah, you’re right. There’s some interesting stuff going on under the hood. The cool thing about it is that it’s so good that you can usually forget about the underlying details and just trust that it will do a pretty good job in most situations.