Tuesday, April 12, 2011

Understanding machine vision lenses – focal length and f number

Few people charged with developing or maintaining a vision system are experts in photography, so the business of selecting a suitable lens can seem like a black art. Two of the areas of confusion are focal length and f number. Here’s what you need to know:

The focal length really tells you the angle the lens looks over. A shorter focal length lens sees over a wide angle while a longer length sees a narrower angle. At the most extreme, picture the difference between a bubble-shaped ‘fisheye’ lens and a telescope. The fisheye lets you see over a wide area, but as objects get further from the lens they quickly appear much smaller. On the other hand, the telescope has a very narrow angle, which is why it can be so hard to find the moon through one, but obviously enough, it’s great for seeing things that are far away.

What this means in machine vision applications, is that a short focal length lens – say 8 or 12mm – is good for when the camera is quite close to the object you want to image. But as the camera is moved away, the object will appear smaller. Get over this by changing to a longer focal length, like a 25 or even 50mm. That will keep the image the same size even though the working distance from object to lens has increased.

So what about the f number? Sometimes referred to as the ‘f stop’ this number is a measure of how much light can get through the lens and fall on the sensor. It’s actually an inverse relationship, meaning that a bigger f number allows less light through. Conversely, a smaller f number transmits more light.

If you look at a machine vision lens you’ll see that there isn’t a single f number but that it changes as the aperture is opened or closed. A wide open aperture results in a small f number, but as the aperture is closed the f number increases. If you compare a C-mount and an F-mount lens you’ll also see that the larger F-mount has lower f numbers for a wide open aperture. That makes sense because the lens itself is a bigger diameter and lets more light in.

And why does this matter? Well light is a big issue in machine vision, especially since you are usually trying to minimize exposure time. That means opening the aperture wide, but when you do that the depth of field reduces dramatically, so it may be hard to keep everything in focus. To compensate, you either have to throw yet more light on the object, or find a lens with a smaller f number. If you think this through you may decide that you’re better off working with large format lenses as opposed to regular C-mounts.

So, to summarize: focal length is a measure of the angle a lens sees over while f numbers are an inverse indicator of how much light a lens transmits at a given aperture position. A smaller f number equals more light.

Any questions?

1 comment:

NTebeau said...

You should do a follow up post on f/# and how it relates to depth of field, and Air Disk limitations. I've been to too many companies where they're using a 5 MegaPixel camera and have an Airy disk 10x their pixel size.