Sunday, May 20, 2012

Setting the F-Stop


Lenses are not designed to be user-friendly. Look at the two rings and you’ll see a bunch of numbers, one set indicating the focus the other the aperture openings. These latter numbers go up in powers of two, basically 2.1, 4, 8, 16, and they indicate how much light can pass through. A bigger number means the hole is smaller and less light gets through. Photographers call this the F-stop, and it’s usually written as f/#, so you get f/2.1, f/4 and so on.

So what’s the right setting for your application?

There’s the problem. No one will tell you, but a little reading of the Basler White Paper “Optics Recommendation,” (get it from their download site,) offered this nugget of information:

Best image results will appear with F/# = 4, 5.6, 8”

Well the term “Best image” is somewhat ambiguous, so I set up a little trial.

Using a 5Mp monochrome camera and a 35mm Tamron lens, I captured four images of the same scene, at f/2.1, f/4, f/8, and f/16. Closing the aperture reduces the quantity of light reaching the camera, and it seemed important to have the same gray levels in every image, so I compensated by increasing the exposure time.

I decided to quantify each image by taking a single line and measuring the contrast range. Not unlike a MTF/line pair type of calculation, I figured the “best” image would be the one with the greatest contrast.


Here’s the image I worked with (note that I’ve just snipped a small region from the much larger original.)



And here’s the graph showing gray levels along the green line.


 





And here’s what I observed, plotting contrast (defined as max gray – min,) against f/#:







Just as Basler said, the contrast was best between f/4 and f/8. So that will be my start point from now on.

1 comment:

Spencer Luster said...

I agree that the Basler paper rule of thumb on DOF is odd and at the very least incomplete.

As noted in our own Tech Tips section (http://lw4u.com/index.php/machine-vision-help/tech-tips/), "Light Ideas #4:Magnification, f-number and Depth of Field", DOF is primarily dependent on two things: 1)Lens f-number and 2)magnification. The latter is dominant, with DOF being inversely proportional to the square of the magnification.

How does one define DOF in universal, absolute terms? You don't. The reason being that it all depends on your application. Are you separating colored jelly beans or measuring hairline cracks? The concept of modulation transfer function (MTF) can be a good tool for comparing lenses, but to many MV users it's not practical. This subject deserves many words on its own, although not from me today. :-)

Back to the white paper. Not meaning to pick on Basler (who makes great cameras), but there are some other quirks in the document. One is the suggestion that for telecentric lenses "...the DOF is rather large." In context, one can only read this as referring to image sharpness. As many of us know, however, image sharpness DOF is inherently no different for telecentric lenses than for conventional lenses operating at the same f-number and magnification.

Based on some of the odd phrasings, I suspect that the Basler paper is a translation from another language. As such, maybe some technical fine points were garbled? I have trouble just getting through the morning without garbling half a dozen things!

Spencer