Avoiding Color Artifacts and the Influence on Frame Rate and Computing Load
Color is an important factor in industrial image processing and supports accurate error detection, for example, in print image inspection. Reliable inspection requires the prevention of color errors. However, preventing these errors can influence other system parameters such as frame rate and the computing load of the host system.

Avoiding color errors - the theory
Where and how color images are calculated and the format in which they are transmitted from the camera to the host system influences the color error.

Raw image
After commissioning, industrial cameras transmit image information to the host system in Bayer 8-bit format as standard, i.e. as a raw image with Bayer matrix of the image sensor.
When a Basler color camera is put into operation, the pylon Viewer does not display the raw image but instead shows the result of a basic color image calculation (2x2 debayering) performed on the host system. This simple processing step can produce visible color artifacts, which can be avoided by performing debayering directly in the camera.

Debayering location
The color image calculation from the raw data of image sensors with Bayer matrix is called debayering. It can be performed before data transfer in the camera (output formats: RGB8, YCbCr variants) or after data transfer on the host system (output formats: Bayer RAW formats).
When debayering is performed on the host system, it places a heavier load on system resources. In addition, avoiding color errors, especially at color edges, requires very complex debayering algorithms. For this reason, debayering is typically performed on the camera’s FPGA as the preferred option.

Debayering algorithm
Debayering is an algorithm that uses interpolation to calculate the color image from the raw data of the Bayer sensor. With simple 2x2 debayering , the algorithm takes the nearest pixels into account. With 5x5 debayering - part of Basler's patented in-camera PGI feature set - 24 pixels are included in the calculation.
The calculation with more pixels leads to a better result: transitions between different colors become clearer and artifacts disappear.

Image data transfer
The camera then transfers the processed color image to the host system. Various pixel formats are available, including RGB8, YCbCr422_8, and YCbCr420_8. RGB8 provides the most color information and results in the largest data size. YCbCr422_8 transmits less color information and is smaller, while YCbCr420_8 carries the least color information and has the smallest data size.
If less color information is transmitted, color artifacts occur.
Conclusion: The key to avoiding color errors lies in choosing the right debayering method and transferring the color image data correctly. Optimal color images can be achieved with 5x5 debayering in the camera and subsequent data transfer in RGB8 pixel format.
The interplay of color error, frame rate, and computing load
Depending on how perfect you want your color image to be, the frame rate and computing load of your application's host system will change. There are three scenarios.

Maximum image quality
The 5x5 debayering is performed on the camera’s FPGA, allowing fully processed color images to be transmitted to the host system in high-quality RGB8 format. While this format delivers optimal color quality, it also produces a large data volume, reducing the frame rate to approximately 33 % of the maximum. However, since the image processing is handled by the camera, the host system’s full computing capacity remains available for additional processing or analysis tasks.

Balanced image quality and frame rate
If the 5x5 debayering is performed on the camera’s FPGA and the images are transmitted in a more compressed format such as YCbCr422_8 or YCbCr420_8, the amount of data transferred to the host system is reduced. This results in higher frame rates—around 50 % of the maximum for YCbCr422_8 and up to 67 % for YCbCr420_8. However, due to the reduced color information, color artifacts may appear. With the image processing handled on the camera, the host system’s full computing capacity remains available for other tasks such as additional image analysis.

Maximum frame rate
Is a high frame rate in your application more important than avoiding color errors? To achieve the maximum frame rate of the camera, debayering is performed on the host system, with the camera transmitting standard Bayer 8-bit data. The type of debayering selected determines how effectively color artifacts are avoided and how much the host system is utilized. There is an inverse relationship: lower color errors require higher computing load, and vice versa. In any case, the computing load on the host system is higher than in scenarios 1 and 2, leaving less capacity available for other image processing or analysis tasks.
Making the right choice: Tools simulate color errors and frame rate
Not sure which scenario is right for your application and whether a higher frame rate is worth a minor compromise in color accuracy? We offer two tools to help you make an informed decision.

Color Artifact Visualizer
Load an image from your application into our Color Artifact Visualizerto see how pixel format and debayering method affect the color error ΔE.
The RGB image is the reference image without color errors. The image calculated in the camera using 5x5 debayering is transmitted to the host system in RGB format.
YCbCr422_8 and YCbCr420_8 show minor color errors, because the color images calculated in the camera using 5x5 debayering are transferred to the host system in the smaller formats.
With the three Bayer8 formats, the color error is clearly visible, especially at color edges. Debayering takes place on the host system with the Bayer 8-bit format transmitted as standard. The three formats show different types of debayering.

Frame Rate Calculator
Our Frame Rate Calculator gives you the frame rate that you can achieve with your camera and the pixel format that suits you.
Select your camera model and at least the pixel format. Click on "Calculate" and you will receive the maximum frame rate.
Our cameras with 5x5 debayering in the in-camera PGI feature set
The 5x5 debayering is part of the patented in-camera PGI feature set. The algorithm ensures excellent color images.