Showing posts with label optics. Show all posts
Showing posts with label optics. Show all posts

Wednesday, August 14, 2013

How to pick a lens that performs well


You probably know that MTF charts are the way to assess the performance of a lens. What you may not know is that those charts are not very helpful. Writing in the July/August 2013 edition of Vision Systems Design magazine Andy Wilson summed it up this way:

Although MTF charts may allow similar lenses from a single manufacturer to be compared, the different testing methods used by individual manufacturer makes it difficult to compare lenses from different vendors. Finally, since other factors such as filters, imaging sensors and camera readout electronics will also affect image quality, MTF charts should only be used as a starting point when comparing lenses.”

So if MTF charts are the start point, what comes next?

Actually, it’s really hard. I have two techniques, both of which rely on having the lenses in my hands. First, I set up a simple line pair test and measure the contrast. I think it’s important to do this out at the periphery of the field-of-view rather than at the center. Every lens manufacturer makes sure their products work well on the optical axis. And of course, make sure the field-of-view and resolution are the same for both lenses.

Second, I weigh the lenses. It’s a crude measure I know, but glass is heavy so I conclude that the heavier lens contains more of it. More glass implies, to me at least, more optical elements for optimizing the image quality, thus a heavier lens is better. Usually, a heavier lens is more expensive, and while price doesn’t always relate to quality, (ask any wine taster,) I do think there’s a closer correlation than say the price of a pinot noir to how much you’ll enjoy it.

Wednesday, May 22, 2013

Learning about telecentric lenses


I see far too many vision applications that should use telecentric lenses but don’t. I imagine this is because: (a) telecentric lenses are expensive, and (b) not many people understand what telecentric imaging can do for them. I can’t do anything about (a) but I can help with (b).

Opto-Engineering have on their website a telecentric tutorial titled, “TELECENTRIC LENSES: BASIC INFORMATION AND WORKING PRINCIPLES” (the capitals are theirs). This does it exactly what it says, so I suggest everyone take a few minutes to expand their knowledge by clicking on that link.

I may set a test, so study hard!

Thursday, May 16, 2013

Sources for Telecentric Lenses


Announcing new telecentric lenses for 12k and 16k sensors, Italian lens manufacturer Opto-Engineering reminded me that they are “the telecentric company!”

Curious about this claim, I scrolled through my favorites for other providers of telecentric lenses. Melles Griot, Schneider Optics, and Navitar all showed up, and I’m sure there are other vendors/manufacturers too.

That got me wondering: how big is the global market for telecentric lenses? It can’t be above a couple of thousand units a year, can it? And if you figure the median price of a telecentric lens is say, $3,000, then you’re looking at a global market of $6M.

Not exactly huge is it? Although I suspect it is rather profitable.

Wednesday, May 15, 2013

Where is that lens from?


I’ve always considered Germany the center of optics expertise, with Asia challenging at the lower cost end of the market. Japan, China and South Korea all have lens manufacturers, but North Korea?

It was this note on Navitar’s home page that had me scratching my head:

Navitar is confident that our various suppliers located in and near North Korea will provide us adequate insurance in the event that a war breaks out.”

Fortunately the tension seems to have been dialed-back since that was posted in mid-April, but it still made me think: so Navitar get optical components from North Korea? Buy a Navitar lens and you’re enriching Kim Jong-un? I doubt that’s the case, but the simple statement on the Navitar website cries out for more explanation.

Tuesday, December 18, 2012

Auto aperture adjustment


The aperture is the iris inside the lens that determines how much light reaches the sensor in the camera. This has a massive impact on image quality, and not just whether it’s too dark, too bright, or just right. Depth-of-field, focus and image quality are all influenced by the size of the aperture, (which is reported in f-stops.)

And why am I rambling on about this today?

Well in machine vision we normally use lenses with a manual aperture. We dial it in to the optimum setting (typically around an f-stop of 2,) and lock it in to place. But sometimes it would be useful to be able to adjust it, preferably without clambering inside a machine to reach the camera (from where you can never see the monitor anyway.) And that’s why aperture control might be of interest.

What I didn’t know until today though us that there are two types of aperture control; DC iris and P iris. How did I learn about this? By reading “Auto iris control with Point Grey cameras” in the Point Grey Knowledge Base. This gives a good summary of the differences between the two; it’s worth a couple of minutes of your time.

Thursday, December 13, 2012

Why you can’t get a sharp image


Most discussions of machine vision optics tend to focus (groan now please!) on lens focal length, working distance and depth of field. These are all important – critical even – in setting up a vision application, but often an engineer will zoom in on a region of the image and become instantly depressed. What looks sharp in the compressed monitor view often has a slightly fuzzy quality that no amount of focus ring adjustment can dial out.

The issue is diffraction. Ask an optics guru to explain and you’ll get a sermon on Modulation Transfer Function and a headache. So let me offer a different tack: grab a coffee and settle down with “Using Optics to Optimize Your Machine Vision Application,” (Vision & Sensors, December 2012.)

Frustratingly, Quality Magazine now expects you to register to read their articles, which I suspect is going to lose them some readers, but trust me, it’s worth it. Written by John Lewis of Cognex, this is an excellent article that will improve your understanding of how to get the sharpest possible image, and without all the equations Edmund Optics finds so necessary to explain depth-of-field, or DoF for short.

Now I’m going in the Edmund Optics site to get me one of those DoF targets. Or, now I’ve seen the price, I might just make one.

Tuesday, November 20, 2012

Fisheye lens

I’ve had a few applications where I needed a really wide angle lens, but the Sunex Superfisheye is about the widest angle I’ve ever seen. With 185o this can actually see back behind the camera – well just a little anyway. And at $800 it seems pretty good value too.

When would you use such a lens? Well imagine you want to look at the inside of a tube – perhaps you’re inspecting a telescope - just put this lens at the entrance and there’s no need to scan or rotate.
Yes, there is a significant loss of resolution, so you’ll need a hi-res camera. But since the lens comes with either a Canon or Nikon mount that shouldn’t be too much of a problem.

Judging by the website material, the main users of this lens would seem to be realtors, but there’s no reason it shouldn’t be put to work in a machine vision application.

Now before I go, this Thursday is Thanksgiving here in the US. That means you shouldn't expect any more posts from me until Monday because I'll be sleeping off all my turkey. See you next week.

Wednesday, October 31, 2012

Benchmarking optics


How do you determine if a lens costing $800 is better than one costing a quarter the price? Well asides from thinking, as I do with wine, it must be better if they can command a premium for it, the answer is to do a side-by-side comparison.

But Brian,” I hear you moaning, “I only want to buy one lens, not two, one of which I will not need.”

Well fortunately, Edmund Optics has already done some benchmarking for you. “Better Optics = Better System Performance” describes how they compared their lens with one from a competitor. Surprisingly enough, the Edmunds lens came out on top, but that’s not important right now.

What is important is how they conducted the comparison. It was a simple test that you could do yourself. Yes, you will need two lenses, but if you ask nicely your supplier will let you have them “on evaluation.” They may ask that you share the results with them. That’s something I have no problem with: mutual back-scratching is mutually beneficial.

So read the Edmunds article and learn why their lenses are so good how to evaluate lenses for yourself.

Wednesday, October 24, 2012

Lens focusing, simplified?


Anything has to be better than turning the focus ring first one way, then the other while trying to watch an image on a monitor. It’s even worse when, as in a system I worked on recently, the monitor is not viewable when working at the camera. And don’t get me started on the tribulations of linescan camera focusing!

All of which is why, since 2009 I’ve been getting excited about the potential of liquid lenses. (“The end of focus problems” June 14th, 2009.) Cognex and Microscan have offered liquid lenses on select products for a few years, but there’s been nothing I could buy to add to a camera, until now.

Just in time for Vision 2012 optics specialists Qioptiq have announced their flo.x lens “with liquid lens focusing.” This sounds exactly what I’ve been waiting for, albeit with a couple of drawbacks. First, it’s made for an M12 mount, rather than C-mount. And second, the focal length is a rather wide angle 3.35mm.

No, it’s not exactly what I’ve been waiting for, but the very fact that it exists gives me hope. Who knows, perhaps I’ll be sent a plane ticket to Stuttgart so I can attend Vision 2013 for the unveiling of the C-mount liquid lens!

By-the-way, if you’re looking on the Qiotiq website for details of the flo.x, - well I couldn’t find anything, although they do have some great machine vision lenses.

Tuesday, September 18, 2012

An alternative zoom lens


Every machine vision engineer has a Computar 55mm telecentric lens on his bench. It’s a fine lens that gives a degree of zoom, but I hate to see it used on a real application.

The reason for this is that it’s not repeatable. If it has to be removed for some reason, it’s impossible to guarantee reinstallation with the same mag.

Navitar make a posher version, the Zoom 7000 Macro. That’s a good lens but it suffers the same weakness: it’s impossible to reproduce any particular magnification.

Opto-Engineering, (who else?) has the answer: multi-mag optics. Essentially, it’s a series of lenses that can be indexed round in front of the camera. I’ve seen something similar on microscopes, and I recall old – very old – TV cameras having something similar, but for machine vision this is something of a first.

There’s a video on the Opto Eng website where a young woman explains the merits of this device. The good thing about the video, besides the attractive presenter, is that we are shown the indexing mechanism. I thought that was rather cool.

You could search for the video yourself, but to make your life easier I’ve embedded it below.

Monday, July 23, 2012

Lenses for BIG Detectors and High Magnification: Part 1


This is the first of a two-part post from guest blogger Spencer Luster. Spencer runs Toledo-based LIGHT WORKS, LLC which specializes in clever optical solutions to machine vision challenges. If you want to know find out if a telecentric lens is right for your application, he’s the man to contact. Now, read on …


Camera detectors continue to get smaller. And bigger.

On the one hand individual pixels are shrinking, annoyingly so, with the tiny 2 micron range now being available. Optics people tend to dislike this trend because as the pixels get smaller, lens performance must increase.

At the same time chip makers are producing some models with many more pixels, for both area and line scan cameras. The result being that overall detector sizes can get quite large, with some over 60mm long.

Yet most machine vision lenses aren't designed for these very large formats, or for good imaging with puny pixels. What's a poor end user to do?

There are at least two answers, and sometimes they work together beautifully. We'll discuss the first answer in this article. The second will come in Part 2.


Photographic and Enlarger Lenses

The classic 35mm format photographic camera lens is designed for creating big images. Not all the way up to 60mm, but they can cover a large majority of detector sizes. This is true even of the lenses designed for digital SLR cameras whose formats are usually a bit smaller. They can be pretty good tools, and adapters for their bayonet-style mounts are available. If you feel very ambitious you can find a way to utilize their autofocus/autoiris functions, but I never have.

One downside is that they are not usually designed for very low distortion and thus can present a challenge for critical gauging applications.

If you need excellent image reproduction, flat field, and low distortion, then photographic enlarger lenses could be your answer. You do remember photographic film from the Pleistocene Era, right? The film from cameras was developed and then projected onto large pieces of photographic developing paper using enlarger lenses. Reproduction geometry had to be nearly perfect.

Figure 1 shows the typical use, although the lens-to-paper distance is scaled much shorter.


Figure 1: Enlarger Lens with Film

Rodenstock and Schneider (to name two) still make these lenses and they're terrific for use with large format detectors substituted for the film. That is, instead of projecting the film onto paper, you put your camera detector at the film plane and capture images of whatever you want.

These lenses typically come in focal lengths of 28mm, 35mm, 50mm, 60mm, 80mm, and 105mm and larger. The longer the focal length, the larger the film or detector format that can be used. The 28mm fl. lenses are for use with 18mm x 24mm film/detectors. At the top end focal lengths, 4" X 5" detectors could be used! (In fact, some of the old Nikon enlarger lenses could be used with 8" x 10" film plates! Alas, Nikon no longer builds enlargers.)

Typical reproduction ratios for the shorter focal length enlargers is 5X to 30X. This means that the film can be accurately projected as being 5 to 30 times larger depending on the film and paper distances. For machine vision purposes, an inspected object can be imaged onto the detector with a magnification of 1/5 to 1/30. Longer focal length lenses operate best at 2X to 10X (1/2 to 1/10)

In order to use these you will need an adapter to go from the enlarger lens male thread (39mm x 1/26") to your camera. Rodenstock at least provides such a beast, and there may be others. Edmund Optics sells the Rodenstock model. Be aware that unlike c-mount lenses or even photographic camera lenses, the back (or flange) focal lengths of enlargers vary with lens models.

The primary down side is that enlarger lenses typically don't come with minimum f-numbers smaller than F/2.8, and usually F/4 to F/5.6. (No need for a "fast" lens when you can spend as much time as you want exposing the developing paper.) So if you need to operate with short exposure times, order up a truckload of photons.

One other thing: Enlargers don't come with focus rings. You adjust focus by adding or subtracting spacers, or use a separate accessory such as Rodenstock's "modular-focus" attachment. Some web links are embedded in the article.

(NOTE: Edmund sells "Rodagon Large Format" lenses. These are one line of Rodenstock's enlarger lenses. They happen to be very good, 6-element designs.)


Spencer Luster
LIGHT WORKS, LLC



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.

Thursday, May 3, 2012

Sensor sizes explained


Matching a lens to a camera is a headache. The problem is in finding a lens that will put the whole area viewed – the field of view – onto the camera sensor. If sensors were all the same size life would be simple, but unfortunately they aren’t. If you look at the specs you’ll see them referred to as 1/3”, ½” and so on, but do you know what this means?

Brian Robertson of PPT Vision recently posted one of the best explanations of this that I’ve ever read on the PPT blog. “Machine Vision Cameras and Imager Chip Sizes” (April 18th, 2012,) provides a concise explanation of why sensors are described in this seemingly archaic manner. It also helps clarify what a 1 1/8 sensor actually is.

Once you understand what the numbers mean selecting a lens becomes a little easier.

Wednesday, April 18, 2012

More on evaluating lenses


My last post rambled on to the effect that you need data to make comparisons between lenses. This is a big topic and it requires a grasp of two technical terms: line pairs per millimeter and modulation transfer function.

I could devote a month’s worth of blog posts to explaining these, but I don’t need to because Scott Israel of 1st Vision has done it for me in a video presentation titled “Debunking the Megapixel Lens Myth!

The video gets pretty technical, although to avoid reinventing the wheel Scott uses some material from Edmund Optics presentations on the same theme. Over the course of almost twenty-three minutes Scott delves in to why more pixels means smaller pixels, making use of star target patterns, and best of all, why it’s “hogwash” to talk of a five megapixel lens. (You’ll have to watch the video to learn why.)

The bottom line though is that it’s very hard for the end user to figure out which lens is best for a specific application, so call Scott and ask him to do it for you.

Tuesday, April 17, 2012

Evaluating lenses – the most important tip!


I’ve just finished upgrading an inspection system that I installed a year ago. Besides some software improvements the most important thing I did was upgrade the lens.

The issue, as is so often the case, was that once detection of flaws of a certain size has been achieved, the quality people asked if the system could do better. This led me to evaluate a number of lenses, but also highlighted an essential aspect of lens evaluation: you can’t do it by eye!

All too often I see people who should know better trying to decide if lens A is better than lens B simply by looking at the images on a monitor.

What’s wrong with this picture?

Well how do you know the monitor is accurately displaying what your camera and lens combo see?

If the camera is just VGA resolution then the monitor probably presents a pretty accurate facsimile of what has actually been captured by the sensor. This is because most monitors have beeter than 640 x 480 pixel resolution. But if you’re playing with a 5Mp camera with a 2,500 x 2,000 pixel sensor some compression will be involved to display the image to your eyes.

And let’s not even start talking about how subjective and uncalibrated human vision is anyway.

So what do you do to assess performance?

You use your vision tools, especially edge detection, to produce numbers that indicate the relative ability of each lens to pass photons to the sensor. That way you’re being objective, and that can’t be bad, can it?

Thursday, March 1, 2012

Lens calculators


It’s hard to know what focal length lens you should buy, especially when budgets are tight. Who wants to go back to the boss to tell him they bought the wrong one?

That’s why lens calculators are so useful. The best-of-the-best I directed you to back in November ’11 (“Advice on lens selection”), but some simple, on-line calculators (no download required,) can be found at the website of German lens specialist Lensation.

Focal length, depth of field: Lensation has ‘em all, so take a look and bookmark the page.

Thursday, January 12, 2012

Shouldn’t autofocus be standard?


I make it a requirement that I have remote access to all my installed vision systems. This saves me much time and money in travelling to factories to make a simple change in the way a system works. However, there remain two classes of problem that still require site visits: lighting and optics.

If you’re wondering why, I take it you’ve never tried to advise a technician at the end of a phone on how to focus an image, while watching the result live over the internet. “Turn the focus ring left …. No, that’s the aperture. The other ring … no, the other way …. No, turn the ring the other way. Too far…”

Autofocus lenses exist and zoom technology is commonplace in traffic control, (AVT have a solution,) but we haven’t really adopted them in machine vision. I think it’s time that changed. Of course, this will force a shift in camera design since the commands to the lens will pass through the camera, but I don’t see any real obstacles to doing that.

Not only would this help maintenance, it would also mean the lens could become a change part. If a system needed one field-of-view for a large part and a much smaller FoV for a second, then why not just change lenses? At the moment I would never propose doing this because the focus will never go back the same way twice, but with autofocus that problem goes away.

That just leaves lighting problems that need a site visit. Brightness I can control through software, but the angle? Has anyone considered applying optics technology to lighting?

Thursday, December 15, 2011

"Home Made" Hypercentric Lenses


Optics articles from occasional contributor Spencer Luster of LightWorks don’t come along very often, but they’re worth the wait. Here’s a great article on DIY pericentric imaging.

One of Light Works' main product lines is hypercentric (sometimes called pericentric) lenses that provide converging views. We offer high quality models for difficult and critical inspection tasks. Many times, however, the basic converging view geometry is of benefit, even with lesser image quality. With that in mind I'd like to quickly describe how you can set up such geometry with a conventional camera lens and a Fresnel lens.

Figure 1 shows a spool with defect examples such as a dent in the top flange, and a tear in the bottom. Wouldn't it be great if you could inspect both flanges simultaneously using one camera? Now you can! Order before midnight tonight! I mean, uh, just keep reading.


Figure 1


Figure 2 shows an arrangement of a combination of a camera lens and a Fresnel lens that makes up a hypercentric system.

Figure 2


Some things to note about this system are:

  • The Fresnel Lens has a focal length FL.
  • The Fresnel Lens is placed two FL distances away from the Iris of the Camera Lens. (You can estimate by eye the location of the Iris.)
  • When the Iris is small – say F/8 or more – the Camera Lens will only accept light that appears to come from a small Virtual Source that is two FL distances below the Fresnel Lens.
The result of this system is a converging view of the object. (See the pink dashed lines.) By itself many fun and useful inspections can be achieved. Nevertheless, our goal was to inspect the top and bottom flanges. As shown, the bottom flange can be inspected, but the converging view of the top means it's "back lit" by the spool itself – it can't be silhouetted to spot the dent defect.

One easy solution is to cut a hole in the center of the thin, plastic Fresnel lens. Figure 3 shows this.

Figure 3

Now place a diffuse light source below the spool. The result? Pure optical magic! The bottom flange inspection hasn't changed, and the top flange is now properly back lit.

Okay, that's the Readers' Digest version. In practice there are a few things to keep in mind:

  • Fresnel lenses are for imaging use in near monochromatic light only. Stick with single color LED illumination. Even then image quality will only be fair.
  • Most Fresnel lenses are designed to have their grooved side facing a so-called "infinite conjugate." That is, the grooved side should be viewing something very far away, or receiving nearly collimated light. The smooth side should face a near object or the finite conjugate. Using a Fresnel as described above violates this principal, but you can still build a useful system. An improvement would be to use a pair of Fresnel lenses with their grooved sides facing each other.
  • The distance from the Fresnel to the Camera Lens Iris doesn't have to be 2* FL, but it's a good starting point. Experiment with other distances.
  • When illuminating the object, you may see light scattered from the Fresnel grooves. Try to prevent light traveling directly from the light source to the Fresnel surface.

Have fun!

Spencer Luster

Tuesday, November 1, 2011

Advice on lens selection


If I was to categorize the machine vision questions I get, number two on the lens would be optics. Every camera system needs a lens, but lens nomenclature makes no sense to the typical vision user. In an effort to help, periodically I direct readers to the best lens calculator package I know of – MachVis, buried deep on the Qioptiq website – but sometimes that’s not enough. What’s needed is a simple optics primer.

It seems the folks at Basler have reached the same conclusion, because they’ve recently put a two page white paper titled “Optics Recommendation” on their website. It’s not the definitive guide, but it might help you on your way.

And what do I get most questions about? That would be lighting.

Thursday, October 13, 2011

F-stops, resolution and depth-of-field


One of the most baffling aspects of machine vision technology is finding the “ideal” lens settings. Unless you’re serious about photography, (and I am not,) terms like “f#” and “diffraction limited” might as well be in Mandarin. This is why I lap up any and every article I can find on optics, and is the reason I read “Into the Depths,” (Vision Systems Design, September 2011,) several times.

Written by the very knowledgeable Greg Hollows of Edmund Optics, this article attempts to clarify the relationship between the size of the aperture, (indicated by f#,) the depth-of-field, and the resolution of an imaging system. Unfortunately though, I still found it too complicated and had to resort to Wikipedia.

And what did Wikipedia tell me? Well as part of MV4U’s mission to simplify machine vision for users, I shall summarize and then direct you to some useful sources.

f# - this tells you how open or closed the lens aperture is. Much confusion comes from the fact that a small f# means the aperture is wide open while a big number means it’s very small. Thus at f# of 1.2 the aperture is wide open and much light can pass through, while at f# of 16 the aperture has been closed down to a pinhole and hardly any light can get through.

When light passes through a pinhole it gets bent, or diffracted, a lot. This doesn’t happen so much with a bigger diameter hole. Diffraction is a bad thing because it reduces the resolution of the imaging system. In simple terms, the more diffraction that takes place, the more blurry the image. So to get a good image, open the aperture wide, (or as a photographer would say, use a small f#.)

But here comes a problem: when the aperture is open wide the depth-of-field is very shallow. In other words, the image is only in focus over a very small change in working distance – maybe just a few millimeters. Close the aperture down (increasing the f#,) and the range over which the object stays in focus increases.

So how does the eager vision engineer balance these tradeoffs? Well from Wikipedia I ended up at “Lens Diffraction & Photography” on the cambridgeincolour.com website. (Be sure to read both pages.) This has two excellent diffraction limit calculators; one finds the circle of confusion, the other estimates the f# at which resolution will start to be compromised. I found that playing with these in conjunction with the Greg Hollows’ article help make his explanations clear.

The other useful calculator I found was for estimating depth-of-field. Again, this is useful for trying things out and seeing what effect they have.

Lenses are mysterious things for most of us engineers. Hopefully these links and my explanation will help bring it all into focus. (Loud groans please!)