User Manual - twentynine
Figure 107: Raw image overlaid with a Bayer pattern
Figure 107 shows a raw image from a color camera. If it is zoomed into the image, the Bayer pattern
gets more and more visible. Each pixel represents an intensity value, to reconstruct a full color image
from the incomplete color samples, the missing color information at each pixel has to be interpolated.
The interpolation process has several different names like
Color Filter Array Interpolation, Demosaicing
or Debayering
. The reconstructed image is typically accurate in uniform-colored areas, but has a loss of
resolution especially at structures and edges.
There are different interpolation methods where each of them has its own strengths and weaknesses. In
the
ImageProcAPI
three algorithms are implemented, namely
Bilinear Interpolation
,
High Quality Linear
Interpolation
and
Pixel Group Interpolation
.
Bilinear Interpolation
The
Bilinear Interpolation
is a linear demosaicing method using a 3-by-3 filter for color interpolation. For
each pixel its 8 direct neighbors are considered to determine the 2 missing colors of this pixel by simple
averaging. The red value of a non-red pixel is computed as the average of the two or four adjacent red
pixels, and similarly for blue and green.
The bilinear method has the lowest complexity as there are only a few calculations per pixel, compared
to the other algorithms. It thus shows the lowest workload, but is much more imprecise at e.g. structures
and edges in the image. Because of the small amount of calculations, also the memory usage is negligible
compared to HQ Linear Interpolation.
HQ Linear Interpolation
The
HQ Linear interpolation
is a gradient-corrected bilinear interpolated method using a 5x5 linear filter. In
contrast to the bilinear method, the HQ Linear interpolation correlates different color channels to calculate
the missing color value. For example, the red value of a non-red pixel is computed as the average of the
two or four adjacent red pixels (depending on the amount of red pixels in the 5x5 neighborhood) plus a
correction value calculated from pixels of a different color channel.
131
SMARTEK Vision | User Manual - twentynine | Doc. v1.0.2