The emergence of feature rich industrial cameras at an attractive price means that colour machine vision cameras are finding their way into traditional applications for photographic cameras. Stemmer Imaging explain

The appearance of these new cameras on the market has led to a need to be able to generate photographic quality colour rendition. Many machine vision cameras now benefit from functionality such as auto-iris, zoom and focus. 

These functions and others such as auto-white balance, auto-wide dynamic range, digital noise reduction and motion detection, transform the high performance machine vision cameras that have been traditionally used under fixed lighting conditions into units that can accommodate changing light conditions and varying focus requirements. However, while colour machine vision cameras are, of course, perfectly capable of colour recognition, they have historically fallen short on the actual colour rendition. Therefore, additional image processing is required to allow them to match the colour quality of Digital Single-Lens Reflex cameras.

Colour recognition

Colour imaging is an important technique in machine vision and there are many applications where colour information is crucial. These occur in the food industry and meat processing, automotive inspection, print inspection, pharmaceutical inspection, part presence and/or detection, PCB assembly and many more. Colour imaging is a complex process which is a function of the illumination method being used and the camera technology.

It is worth understanding how colour images are produced. The most common type of colour cameras used in vision has a single CCD or CMOS sensor overlaid with a colour filter that covers each of the pixels. These are usually red, green and blue, arranged in the pattern shown in Figure 1, which is called a Bayer filter array. There are twice as many green pixels compared to red or blue which mimics the resolving power and greater sensitivity to green light of the human eye. 

To obtain a useful colour image, it is necessary to interpolate the red, green and blue values for each pixel using an algorithm. There are a variety of different algorithms available that differ only in the way colour is gained. This can either be done on the camera, or by the host computer. Conversions of the raw Bayer data can be made to a wide range of colour formats such as RGB, CMYK, YUV411, YUV422 and YUV444 – although RGB is most commonly used for visualisation and/or processing. However, for most machine vision colour applications there is no necessity for the colour rendition to reach photographic quality, it simply needs to be able to perform the required colour differentiation.

Matching colours to the real world

This situation has been addressed using a colour recognition and colour calibration tool, which is part of Teledyne DALSA’s Sapera Essential image processing package. The colour calibration is achieved through the use of a standard colour chart called a Macbeth chart or ColorChecker chart.

This consists of an arrangement of 24 squares of painted samples. The chart’s colour patches have spectral reflectances intended to mimic those of natural objects such as human skin, foliage and flowers, to have consistent colour appearance under a variety of lighting conditions, especially as detected by typical colour photographic film, and to be stable over time. 

The Sapera software knows what these colours should be and therefore can calculate the adjustments to each colour produced by the camera to generate a corrected colour output. Within the software, the chart is automatically recognised and the user then confirms these as the raw colours (Figure 2). 

The user then selects the illumination type (or colour temperature) to match the correction accordingly together with the desired colour fidelity, which is effectively a trade-off between quality and speed. Gamma correction can also be applied and there is no need for white balance as this is also taken care of by the correction. 

After the calibration process, the settings can be saved to a file and read back later or loaded at run-time for the application. With the colour calibration loaded, these corrections can then be applied to the image to produce excellent colour rendition. This can be applied on the whole image or a region of it and there is also the option for GPU acceleration if a supported GPU is available. This colour calibration can be used on any camera in practice but is included on the latest Genie TS GigE cameras as standard, so these do not require any additional software to attain excellent photographic quality colours.

Stemmer Imaging

www.stemmer-imaging.co.uk

T: 01252 780 000