Showing posts with label pixel. Show all posts
Showing posts with label pixel. Show all posts

Thursday, August 25, 2011

Advice on selecting a camera – how many pixels?


You’re new to machine vision. You know you’ll need a camera and lens, but when you open the Edmund Optics catalog (or start surfing the web,) you’re overwhelmed by the options. So, in keeping with my mission of providing practical advice to machine vision users, here are a few tips:

The task dictates the hardware. Don’t buy a camera because you like the color, because there’s a pretty girl in the catalog or because it has more megapixels for the buck than any other camera. Start with the task.

Define the field of view – the area that you need to image. Don’t worry about fitting it to the proportions of the sensor (16:9, 4:3 or whatever,) just determine length and width, or diameter if that’s more appropriate. (Incidentally, I prefer to work in metric units – I just find it makes life easier.)

Now, a word of caution: Never plan on using every pixel in the sensor. This is because optical distortion and a fall-off in light intensity make the border pixels less reliable. To avoid using these I suggest adding 10% to the longest dimension you need to view, and calling that the field of view.

Now you need to determine the resolution required, in terms of pixels per millimeter. Okay, this can cause some head-scratching so let’s dive a little deeper.

The drivers for pixels per millimeter are either the smallest feature you need to detect, OR the required measurement resolution. If you need to check the presence of a screw in an assembly, then the smallest feature you need to find is that screw head. But how many pixels does it take to do that?

People have tried to apply some science to the business of how many pixels make a feature detectable but I prefer to rely on old-fashioned heuristics. (That’s “rule-of-thumb” to you!) The absolute minimum number of pixels needed to find a feature is a square measuring 3 pixels by 3. But, if it’s a circular feature you need to find this can result in only the center pixel fully covering the feature. The border pixels will have a grayscale value partway between that of the feature and the background, making detectability difficult. Thus 4 by 4 pixels is better and 5 by 5 better still.


Now, how about measurement resolution? Without going in to how an edge is detected, let’s just say that calculation of edge location depends on the gray levels of the surrounding pixels. And you can’t assume that the edge lines up neatly with the pixels; you’ll never have a white pixel adjacent to a black pixel – there will always be one or two shades of gray in between. So my heuristic for edge detection is that the uncertainty in the measurement will always be 3 pixels.

But before you apply that to the tolerance on the part print, remember this: you almost certainly have two edges to find in your image, so the total uncertainty is 6 pixels, not 3. And how is this related to the part tolerance? Well opinions vary, but I suggest that the measurement uncertainty should be no more than 10% of the tolerance on the dimension. So if you’re measuring a feature that should be 25mm +/- 0.6mm, (I picked those numbers to make the arithmetic easier,) the uncertainty should be 0.060mm, meaning that you’ll want each pixel to span 0.010mm.
 

And with that number, you can calculate how many pixels are needed to image your field of view.

Thursday, January 13, 2011

A prediction for machine vision lenses

It seems like yesterday that a 2Mp sensor was “high resolution” but today 5Mp is the new 2Mp and I’m pretty sure that in another year or so 12Mp will be on its way to commonplace. Much of this is driven by the consumer camera market where megapixels sell, but it’s fair to say that in machine vision we want higher resolution too.

Now if you study sensor specs you’ll know that as pixel numbers go up, each pixel gets smaller. If it didn’t we’d have image sensors the size of tennis courts by now! But I think there’s a limit to how small pixels can get.

The first issue is noise. As pixels get smaller so does their “full well capacity,” yet because noise is proportional to the square root of numbers of photons captured, smaller pixels tend to exhibit more noise.

Second, there’s that pesky business of diffraction. If you go back to my post of February 8th, 2009 (Wavelength matters,) you’ll see reference to something called the Airy disc. What this means is that light can’t be focused down smaller than its wavelength. Now as red is around 0.660 µm, that pretty much sets a limit on how small a pixel can be.

Right now it seems that most sensors used in machine vision – like the 5Mp Sony ICX625 - have pixels of 3.5 µm or greater, but consumer applications are already edging into the sub micron area. For the reasons listed above, that’s not going to work for us, so what’s the conclusion?

Well that brings me to my prediction: as resolutions increase we’re going to reach the point where the trusty C-mount lens will no longer do the job. Quite simply, we will have to use larger format lenses (I’m thinking F-mount,) to project our images onto the larger CCD and CMOS sensors that we’ll want to use.

In other words, large format lenses could be a real growth area a couple of years from now.

Wednesday, September 23, 2009

Pixel pitch and pixel spacing

In “MTF and high resolution sensors” I discussed the impact of pixel pitch on resolution. Having received a question on this, I’d like to explain briefly why its pixel pitch that matters and not pixel size (although they are of course related,) and tell you where to find the information.

The size of a pixel gives you an indication of its light-receiving area. However, in discussing resolution it’s the spacing between the pixels that matters. The equation is:


Fmax-practical = 1/(4 x pixel pitch)

Where Fmax-practical is the maximum line-pair frequency that the sensor can resolve.

I gave the example of the 5Mp Sony ICX625 CCD which has pixels of 3.45 microns. However, the pixel pitch is around 4 microns. Why is the pitch greater than the pixel size? Well not all of the silicon collects light. In effect, there’s a border around each pixel, or to put it another way, there’s a space between neighboring pixels.

To determine the pitch you need the dimensions of the active region of the CCD, and for that you need to sensor’s spec sheet. Strangely, I couldn’t find it on Sony’s web site – they seem to want to keep it secret – but it's out there if you look hard enough. Once you've tracked it down you'll learn that the ICX625 measures 9.93 mm in the horizontal direction, and there are 2448 pixels in that length, which is how we get the pixel pitch of 4 microns. As a sanity check, you could do the following: given that the sensor is a 2/3” format with a 4:3 aspect ratio and a diagonal of 11.016mm, work out the length of the sides and calculate the pitch from there.

Hope that makes things clear. And by the way, I do welcome comments, so if you’ve got questions, complaints or anything you want to share, please make use of the “Comment” function.