Before there was autofocus, there was focus. The camera is a light-tight box that is used to expose a photosensitive surface (film or digital sensor) to light. In order to focus the light onto the surface, most cameras (and your own eyes) use a lens to direct the light. Why did I say, “Most?” Well, there are many types of cameras around that do not rely on lenses to focus light. The “pinhole camera” is a box with a tiny hole on one end and a photosensitive surface on the other. Light comes through the tiny opening and is projected onto the rear wall of the box. A search of the Internet or your local library will reveal that scientists and engineers are currently working on developing lens-less cameras that are never out of focus and avoid the unfortunate characteristics imparted to light when it passes through glass or plastic lenses. For the time being, however, nearly all of us are using cameras that focus light through a lens.
Focus
A lens is an optical device that consists of a curved material that allows light to pass through it. Depending on the design, a camera lens, either built into the camera or attached and interchangeable, consists of one or more elements that both diverge and converge light to focus it onto the photosensitive surface and re-assemble the light reflecting from the scene that has passed through the optics, resulting in an image. You might see lens specifications on the B&H Photo website that mention “elements” and “groups.” Each individual piece of glass is an element and one or more elements are designated into groups inside the camera.
Why do we need to bend the light to create an image? Well, we do not truly need to bend the light at all. The issue is that the film, sensor, or back wall of your eyeball is usually much smaller than the view we are trying to capture. Therefore, we need to bend the light to reduce the size of the image. How else would you get an entire mountain or building to fit onto a camera sensor without bending the light?
Not only does the lens bend the light, it also slows it down. The speed of light changes when it passes through translucent materials. So, light is bending and slowing as it enters and exits a lens (depending on the design of the lens). The camera lens’s job is to direct that light onto the film or sensor.
Before we go too crazy here, let me issue a disclaimer stating that there are many things one can learn about the behavior of light and the physics of lenses. I will never pretend to have more than a casual understanding of the topic, and my college physics grades would indicate that you might want to forget what you just read and are about to read but, for the purposes of this article, I am going to try to keep this basic and clear so that we can get to the subject at hand—focus. If you want to dig deeper, by all means, indulge yourself. Optics and light are super cool and fascinating, but I need to keep this relevant to the photographer. Doctoral-level knowledge of this topic is in no way guaranteed to make you a better photographer.
As anyone who has used a magnifying glass to try to burn holes in paper or leaves can attest to, there is a direct correlation between the convergence of light and distance from the object onto which you are trying to project that light. When you try to focus the light of the sun into a tiny spot to start a flame with a lens, you are focusing the light from a single light source. The camera, as well as your eye, is focusing the light from not only potentially many light sources, but an infinite number of light rays that are reflecting from objects in the scene. Moving the lens closer or farther from the sensor or film is how the camera and lens work to channel the light to recreate the image clearly.
If you could not adjust the focus of the camera and lens, you would have to move physically closer or further from the object—just like you did with your magnifying glass and the sun. Luckily for us, most cameras do the moving for us.
Let us get theoretical one more time to help cement this information. You are fundamentally against selfies and are taking a portrait of a friend so that they don’t have to take their own picture. Now, let’s look closely at our subject. Really closely… the tip of an eyelash. That eyelash tip is reflecting light from a light source (sun, strobe, light bulb, etc) in all directions, not just back at the camera. Reflected light from that eyelash is entering the camera’s lens at different angles because it is reflecting at a nearly infinite number of angles. The lens’s job is to collect those light rays and make them converge onto the film or sensor at a single point so that we can reproduce the tip of that eyelash on our photograph exactly the same as it appears to our eye. If that light converges at a point before the sensor, that eyelash tip will appear blurry, as the light will converge to a point and then continue on its merry way, diverging from the point. Similarly, if that light tries to converge at a point beyond the film or sensor, the light impacting the plane will not yet be brought to a single point, and we have the same effect.
What is this effect? An out-of-focus image is created. The tip of that eyelash is reproduced as a fuzzy collection of reflected light that will resemble a blurry eyelash tip. Now, imagine that an infinite number of times from every point of light or reflection in a scene. Blurry!
Unless your name is Hiroshi Sugimoto, you probably do not want to create out-of-focus images. Or, if you do, you will want to control how out-of-focus your images are. To allow your image to be sharp, or to allow you to intentionally not focus, the camera and lens work together to change the distance of the lens from the sensor or film in order to control where the captured light converges. When the light converges precisely at the plane of the film or sensor, the image is in focus.
So, on a camera with a lens that has a rotating mechanical focus ring, by turning this ring you will physically move the focusing lens, or lens-focusing group, to manually change the distance between the lens and sensor and allow the control of where in the camera that light converges.
Autofocus
Now that we have a basic understanding of how the lens works to focus the light onto the sensor or film, we can talk about the magic of autofocus. As technology advanced, camera companies figured out how to motorize the camera body and lenses to move the focusing elements or focusing group toward or away from the sensor or film. A vast majority of today’s cameras do not have autofocus motors inside the camera body, but rely on tiny motors built into the lenses, which are controlled from the camera itself.
Not really rocket science, right? But, how does the camera know when the subject is in focus? When we focus a lens manually, we look through a viewfinder or at an LCD screen and verify, with our eyes, if the subject looks sharp. Many viewfinders in the days of film had useful split-screen microprisms at the center that assisted with manual focusing. The autofocus camera needs to calculate focus electronically as the lens moves to and from the sensor or film. And, luckily for us, especially if you do not have perfect vision, it can now do this extremely fast and accurately.
Active versus Passive
You won’t see Active AF systems much these days, but let us give a nod to the technology. Active AF systems were around in the early days of autofocus technology and relied on the camera transmitting an ultrasonic or infrared signal toward the subject. The subject would reflect the sound or light back to the camera’s focus sensor and by crunching the time it took to receive the return versus the speed of sound or speed of light, the camera would know how far away the subject was. It actually sounds pretty cool and high tech, right? This is, basically, sonar and radar in a camera. Sonar and radar are cool. So is Active AF.
Before you get all excited about having pioneering technology on your camera, if you have what is known as an AF-assist lamp on your camera, its use is not an Active AF system—it merely augments lighting in a dark scene to assist the passive system.
Passive AF is the choice of the vast majority of today’s cameras. In the Passive AF world we have two different systems: Phase Detection and Contrast Detection. We will wrap up this intriguing article by describing how each system works, again, keeping it relatively simple.
Phase Detection
Phase detection is the system most commonly found on today’s DSLR cameras. As you know, light enters the lens of a DSLR and strikes a mirror that is angled in front of the sensor or film. That light is reflected up into a prism and then toward the viewfinder at the back of the camera. However, what you might not have known is that a very small amount of light passes through that mirror, strikes another mirror, and is reflected down toward the bottom of the camera, where the autofocus sensor lives.
The autofocus sensor contains two or more image sensors with microlenses above them. These tiny sensors create the camera’s autofocus points. The first passive autofocus cameras used to have one central focus point. Technology today gives us cameras with dozens of selectable focus points.
So, how does this autofocus sensor work? In simple terms, phase detection works by dividing that incoming light into pairs of images before comparing them. The light is divided as it passes through that transparent part of the main mirror, where that area acts like a beam splitter. The two distinct images are directed downward to the aforementioned autofocus sensor, where the two images are compared and their positional relationship evaluated. A computer inside the camera evaluates the signal from the autofocus sensor and commands the lens to adjust the focusing elements inside the lens until the two images appear identical. Once the two images match, the image is in focus.
Early sensors just evaluated vertical details in the image. This had its limitations as the system struggled to focus on simple scenes with lots of horizontal components. I remember turning my old SLR camera sideways to trick the autofocus sensor! Now, many sensors, called cross-type points, read both horizontal and vertical information simultaneously. Ahhhh, technology!
Contrast Detection
Contrast detection is the system used commonly by mirrorless cameras, point-and-shoot cameras, DSLR cameras in live view, and smartphone cameras; basically any camera without a mirror in use.
As you may have noticed, the phase detection systems are complex and have many components. Contrast detection is much simpler and it uses the light falling on the main sensor to provide focus. This gives contrast detection one advantage over phase detection: the number of autofocus points. With phase detection, the number of points is based on the design of the mirror and how many autofocus sensors live below that mirror. With contrast detection, the camera can have an almost unlimited number of focus points. Some modern cameras have touchscreens where the camera will focus on any point in the image that you designate, with the touch of a finger.
How does it work? Well, the camera commands the focus element of the lens to move while it reads any decrease in the intensity of light on a pixel or group of pixels. The maximum intensity indicates the region of sharpest focus. While simplicity is the advantage of this system, the downside is that the camera must constantly evaluate images in order to achieve focus. When the light hits the sensor for the first time, the camera has no idea if the light is showing its maximum intensity or not until it changes the position of the lens to vary that intensity. It is kind of the equivalent of measuring something on a balance scale without knowing the weight. You could put the counterweight on the opposite end of the scale and find that it is just right, too heavy, or too light. The camera gets the initial image, which may be in focus, but in order to verify, it has to start moving the lens to see if the image gets sharper or more blurry.
This is called “hunting.” Those who have older point-and-shoot cameras may remember, not so fondly, waiting for the lens to find focus while the action in the scene passed you by. Luckily, technology surrounding contrast detection autofocus is always improving, and today’s mirrorless cameras and point-and-shoots have the ability to focus extremely fast.
In Focus
So, now you know how focus works inside your camera. Or, at least, I hope you do.
In a follow-up segment, I will discuss the different autofocus modes and how to best use them to get the photographic results you seek. Thanks for reading!
83 Comments
Hi B&H.
I have a question. What rays of light diverges in front of the sensor? I mean are those the rays from the farther objects or the nearer objects?
Hi Xenomorph 1,
I hope I understand your question correctly...the lens bends all light that enters it regardless of the distance from the camera. You could make an argument that the light that enters along the lens's axis is not deflected, but its characteristics certainly will change as it moves through different mediums (air and glass).
Please let me know if you have follow-up questions.
Thanks for reading!
Best,
Todd
It looks like contrast detection is not efficient enough when a dark object is to be auto focused?
Hi Dhinesh,
Good question. Each method has its pros and cons, but both phase detection and contrast detection are getting better and better with every generation of camera. Regardless of the system, auto focus today is much, much better than it was just a few years ago. So, don't judge a system based solely on the type of auto focus as the proof is in the actual performance.
Thanks for reading!
Best,
Todd
With 77 comments, I'm sure someone already said this, but I'll say it again ... You don't have to bend light to have a small image. A pinhole camera the size of your camera body could still capture an entire scene from grass to clouds. The size of the pinhole camera doesn't matter. I would say the point of the lens to focus light to make the image brighter, and also provide a system by which you can control FOV, DOF, and other things photographers like to play with.
Hi Jason,
I think it took 78 comments for someone to say that. :) Thanks for adding great points to the discussion and thanks for stopping by!
Hi Todd,
It's a well written article to understand the technology behind the working of DSLR autofocus.
I have a question for you. For e.g if we use spot focus mode in DSLR, how does camera know that it has to focus at that point only ? (how does it converges the reflected light from that spot only to AF mirror/sensor)
Hi Srikanth,
Good question!
In the early days of autofocus, there was only one focus point and the camera's computer accepted information from only that autofocus sensor. Introduce the modern camera with dozens and dozens of autofocus sensors and it is a matter of the computer just knowing which sensor (or sensors) to take input from.
I hope this answers your question. Thanks for stopping by!
Nice article!
I have a question.
When I focus with DSLR with smaller apertures, my aperture stays wide open allowing more light to come to the AF sensor.
When i focus with mirrorless camera closes aperture with my sony a6000 making focusing imposible in dim light.
Is this typical? Are all mirrorless works this way?
When i work with flash i prefer to close down my aperture to get wider depth of field.
Hey Miz,
Almost all modern SLR and DSLR cameras have what is called "auto diaphragm"—a mechanical or electronic system that opens up the aperture all the way automatically when you attach the lens or power on the camera.
I can't speak for your Sony, but my Fujifilm camera does this, and I am sure that most mirrorless cameras do...the lens is usually wide open, but when you select a smaller aperture, the camera will quickly focus with the lens wide open and then very quickly stop the lens down so that you see your depth of field accurately in the viewfinder or on the LCD. Even with manual focus selected, the camera will try to give you the brighest possible image for composing and focusing before stopping down when you press on the shutter release.
If your Sony keeps stopping down before focusing, you might want to try to focus wide open, turn off the autofocus, and then step the lens down and shoot.
I hope this helps. Let me know what you find!
Nicely written. Good introduction to phase detection and contrast detection methods.
Thanks, P! I am glad you enjoyed the article and thanks for stopping by!
Thanks.. this is a very well written article. Here's my question: Does focussing the lens also change the focal length of the lens?
Hi MP,
Changing focus should not change the lens focal length. I cannot think of an example where that would happen.
On a zoom lens, unless the lens is parafocal, the focus will change as the focal length changes. But, changing focus should not change focal length on zoom or prime lenses.
Good question! May I ask why you asked?
Hi Todd, Nice article.
I also have the same doubt. From our high school, we studied that the focal length is the distance b/w lens and point of convergence. On DSLRs the convergence point is the image sensor.
As you have shown that for adjusting focus, lens is moved front and back. Doesn't this change focal length ?
Great question and, luckily for me, I have an answer for you!
The focal length of the lens does change when you focus the lens from its close focus point to its infinity point. However, the focal length designation of a lens is measured when the lens is focused at infinity. So, a 50mm lens is only really a 50mm lens (measuring optical distance) when it is focused at infinity.
I guess I answered incorrectly above, but for some reason I defaulted to thinking about zoom lenses. Hopefully MP hasn't started lecturing on the subject with the bum gouge.
Let me know if you have other questions!
What total distance do lenses typically move while autofocusing?
Hey Patrick,
The answer to that question depends on the lens.
Lenses that feature "internal focusing" handle all of the movement inside the lens barrel, so they do not change length. Lenses with external focusing will change length, but how much depends entirely on the lens.
Sorry I cannot be more specific! Let me know if you have follow-up questions. Thanks for reading!
Todd,
Can you give me some example ranges, say for an industrial camera used in manufacturing processes? I'm designing applications to add to my latest invention presentation: https://www.youtube.com/watch?v=QV5hiz8rEtI&feature=youtu.be : and just need an idea of what the ranges are so I can dive into one application and determine if my linear motion actuator can be usefully applied to it.
Thank you!
Patrick
I ask because I'm trying to identify good applications for use with my latest patented linear actuator mechanism:
https://www.youtube.com/watch?v=QV5hiz8rEtI&feature=youtu.be
I'm specifically trying to identify lens applications requiring very high resolution total travel lengths up to 5mm. It's difficult to get this information though and I was hoping you could point me in the right direction and maybe give me some specific examples to look at, industrial camers for example used for assembling and inspection applications.
Thank you!
Hey Patrick,
Unfortunately, this stuff is way way outside of my wheelhouse.
I would certainly reach out to the major lens manufacturers. Most of them, like Nikon and Zeiss and Fujinon, make many lenses for industrial applications.
I am the fine-art guy who failed college physics...probably not the person you want taking an educated guess on this stuff!
Thanks for reading and good luck!
Sir
Exellent topic and thanks for explaining it so well. Ihave a 300mm f2.8 L lens non is that is intermittantly hunting.I will now have to find out whether the focus system is phase or contrast detection. I use a 7D body. The body focuses well with other lenses.So if thier is anybody out there who wishes to share some tips i will appreciate. Question ? Why would the lens focus perfectly and then hunts once the lens needs to focus on a more complex image.
Nico
Cape Town
South Africa
Hey Nico,
I believe the Canon 7D uses phase detection when in DSLR mode and contrast detection in Live View mode.
Your hunting might be a result of being in a certain mode of autofocus.
Check out this Canon link: https://learn.usa.canon.com/app/pdfs/quickguides/CDLC_EOS7D_AF_Modes_QuickGuide.pdf
I hope this helps you troubleshoot the hunting! Good luck!
I have not find a better article explain how focus and autofocus worked until this one. Thanks.
Thanks, Meng! If you find a better one moving forward, let us know and I will try to improve this one!
Happy New Year!
Amazing article, excellently written! :)
Thanks, James!
Very well explained. The animated diagrams are very very nice. Very easy to understand and visualise. Thank you for all the hard work!
Thank you for reading, Medad! I am glad you enjoyed the article!
its useful information for me.. i m searching for camera working and got this information.. its interesting to see working with practical images.
Thanks for reading, shrikant!
Excellent,well done...!
Thank you for reading, Humberto!
Thanks for a well written article. I really needed that.
Hey Claude,
You are very welcome! I am glad you enjoyed it! Thanks for reading!
Glad to see you writing on this. For me, optical science is the last bit about camera that I could not easily and fluidly educate others on, and therefore I am doing my best to learn. It's one thing to understand refraction in a simple single lens system, once you add multiple light elements, then beam splitters or mirrors, and then auto focus systems - it get wildly intriguing and complicated. I appreciate the choices you made in your presentation.
For those further interested, the Massachusetts Institute of Technology has a great free video lecture series available that is part of their Optics course.
Also I have found an excellent app for iPhone called Ray Lab where you can sample, edit, and create lens systems and see refractive patterns as you edit the elements.
Hey Cameraplex!
Thanks for reading and thanks for commenting! I am glad you enjoyed the article. Thanks also for the links and info!
Optics and light are really intriguing topics that I wish I could dive deeper into. However, I definitely make the choice to try to tell photographers only what they need to know to understand the relationship of these topics to making photos. I am glad you appreciated the approach! Thanks!
Todd,
I enjoyed the article, but there's something I still don't get about your eyelash example. You say "Reflected light from that eyelash is entering the camera’s lens at different angles because it is reflecting at a nearly infinite number of angles". But, if the light source is basically a point (eg. the sun), and the tip of the eyelash is basically a point, and the lens of the camera is relatively small, I don't get the "reflecting at a nearly infinite number of angles" part. Is it because the lens is not a point and the light of the sun reflected on the tip of the eyelash enters different parts of the lens at different angles? If so, is that the reason why smaller apertures of the diaphragm of the camera produce different depths of filed? Please clarify. Thanks.
Hey Pablo,
Thanks for your question. Here is my attempt at clearing up your confusion:
If they eyelash only reflected light in one direction, you could only see the eyelash from a single position. As it is, the eyelash reflects light in all directions, that is why you can see it as you move around the person or that person moves around you. The only time you lose sight of the eyelash is when another object blocks the light from said eyelash.
When it comes to light, the diagrams work to greatly simplify the light rays reflecting from an object, entering and being diffracted by a lens, and then being focused on a sensor. In reality, there are innumerable light rays reflected in innumerable directions traveling towards the camera. It is amazing that we can invent lenses (and have lenses mounted on our heads) that can focus all these random light rays into a coherent image. It boggles the mind!
Depth of field is somewhat related, but that is a different function of aperture and focus and not just focus. I am going to be publishing an in-depth depth of field article soon. Stand by!
Thanks for reading and thanks for your question!
Something that may help illustrate if your computer's sound has an effects processor... Find a "click" type sound like maybe a ticking clock. Go into the effects processor and add echo. Play with the settings and you'll end up with "TICK...Tick...tick" Next change from echo to reverb, and you'll hear "Tiiiiicccckkk." Think of the reverb as similar to an out-of-focus picture. It's really an infinite number of echos that blend together, and the out-of-focus picture is an infinite number of image convergances.
Thanks, Chuck! Great analogy!
It looks like an easy concept but you guys explin it on detail. I will love to read more articles like this,like for better understanding on the principles of photography. I know there is a lot to learn. Thx
Thank you, Juan! I have written a lot of informative articles recently. Just drop "Todd Vorenkamp" into the blog search bar and you will see a list. Soon we plan on having links to these articles available in one place. Thanks for reading!
Muy bueno el articulo. Muy clara y simple la explicación espero recibir la próxima muy pronto
Gracias
Gracias, guillermo! Agradezco sus comentarios. El siguiente artículo va a salir pronto.
Nothing beats a writer who can make complex topics simple. It's not an easy task -nice job! I'm looking forward to your other articles.
In fact, where can I find them?
Hi unclegeo! Just type my name into the Explora search box and you should get a list of articles that I penned (plus some random stuff too...probably!). Let me know if it doesn't work!
Thanks, uncelego! I appreciate the comment! Thanks for reading!
I use a Pentax K20D that is probably 6 years old and many times when using autofocus the camera seems to be hunting for the correct image. Now I understand why and what to do to improve the situation.
Glad to be of assistance, Eric! Thanks for reading!