How to fix lens vignetting

vignetting

The term “vignetting” refers to a gradual darkening of the image towards the outer edges of the frame. Although photographers sometimes intentionally create vignetting for artistic effect, in machine vision vignetting is nearly always unintentional and is considered a problem for effective image processing.

The most serious type of vignetting occurs when the imaging circle of your lens isn’t big enough to cover the entire area – or, in the case of a line scan camera, the entire width – of your camera’s sensor. This results in dark black areas at the edges of your image. The only way to truly fix this type of vignetting is to switch to a lens with a larger imaging circle.

But even if you have properly matched your lens to your sensor, you will likely still observe some degree of darkening of the image towards the outer edges. This natural vignetting is simply due to the way light behaves as it passes through the lens to the sensor.

While the light rays strike the center of the sensor perpendicularly, they must travel at an angle to reach the outer edges of the sensor. This reduces the intensity due to the angle of impact and the longer distance the light has traveled.

In addition to lens vignetting, the lighting being used might introduce some additional non-uniformity to the image. To compensate for lens vignetting and other non-uniformities in lighting, JAI line scan cameras include an automatic shading correction function.

Let’s take a quick look at some examples of vignetting and how you can fix this.

Examples of lens vignetting

The example below on the left depicts an image taken by a monochrome line scan camera showing a combination of lens vignetting and non-uniform lighting conditions. The edges of the image are noticeably darker than the center. Details of the image in the darker areas are not clear, and this can result in inaccuracy or wrong interpretation during inspection. 

Mono line scan camera shading correction-1

One way to solve this is to apply shading correction. The shading correction function in a monochrome JAI line scan camera intelligently applies gain to the darker areas of the image to equalize them with the brighter areas in the image. As you can see from the image on the right, applying shading correction has resulted in a homogenous intensity distribution across the signal channel and a consistent brightness in the image. Because the intensities are “flattened out” across the image, this type of shading correction is often referred to as “flat” shading correction.  

In a color camera, lens vignetting can not only affect the brightness at the edges of the image, it can also create noticeable color shading effects. This is due to the different color wavelengths experiencing slightly different reductions in intensity as they bend to the edges of the sensor. The image below shows an example of this shading in a color line scan camera. The pre-correction color graph shows how the different color channels are being affected differently as they move towards the edges of the sensor.

color shading correction slide

Applying color shading correction selectively adjusts gain to align the red and blue channels with the response curve of the green channel, removing the appearance of any coloration in the image. However, note that aligning the red and blue channels to the green channel doesn’t eliminate the shading, it only ensures that all three channels have the SAME amount of shading across the image.

In these situations, BOTH flat shading AND color shading correction are required. You would first apply flat shading, which uses master gain to  flatten the overall change in intensity towards the edges. You can then apply color shading to eliminate any color effects, after which a final white balancing may be required.  

For more information, watch our on-demand webinar: 3 key camera tools to use to address challenges faced in high speed applications, for a step-by-step guide on how to fix shading issues using this function.

Contact JAI for help:
Let us help you to find the perfect camera to meet your application requirements for high speed line scan applications. 
Contact a JAI engineer