Bayer CFA to RGB Conversion
The Bayer CFA decoder transforms the raw Bayer CFA data stream issued by the camera into an RGB color data stream.
The missing pixel components are reconstructed using one of the following interpolation methods:
- Legacy interpolation method computes the missing color components using exclusively Mean() functions of the nearest components.
- Advanced interpolation method computes the missing color components using Mean() and Median() functions of the nearest components. The advanced interpolation eliminates the "creneling" effect on the highly contrasted sharp transitions in the image.
The CFA decoder requires up to eight surrounding pixels to compute the missed components of RGB pixels. Surrounding pixels are identified by their geographic location relative to the pixel for computation.
Definitions
- Mean2(a,b) = (a+b)/2
- Mean4(a,b,c,d) = (a+b+c+d)/4
- Median2Of4(a,b,c,d) = Mean2{ Min [ Max(a,b); Max(c,d) ] ; Max [ Min(a,b); Min(c,d) ] }
Computing Missing Components on 4 Positions of a Bayer CFA Array
For red pixel locations (case of R22)
G <= Mean4(GN, GS, GE, GW)
B <= Mean4(BNE, BSE, BSW, BNW)
Case of R22
For green pixel locations in lines with blue (case of G23)
R <= Mean4(RN, RS)
B <= Mean4(BE, BW)
Case of G23
For green pixel locations in lines with red (case of G32)
R <= Mean2(RE, RW)
B <= Mean2(BN, BS)
Case of G32
For blue pixel locations (case of B33)
G <= Mean4(GN, GS, GE, GW)
R <= Mean4(RNE, RSE, RSW, RNW)
Case of B33
Enabling the Bayer CFA Decoder
The Bayer CFA decoding function is automatically enabled if all the following conditions are satisfied:
- The camera is an area-scan camera (Imaging = AREA)
- The camera is a color camera (Spectrum = COLOR)
- The camera delivers raw data from a Bayer Color Filter Array sensor (ColorMethod = BAYER)
Registering Bayer CFA
The registration of the BAYER CFA must be correctly set by assigning the appropriate value to the ColorRegistration parameter.
There are 4 values: GB, BG, RG, GR corresponding to the colors of the 2 first pixels of the first image line delivered by the camera.
Configuring the Bayer CFA Decoder
The CFA decoder has only one setting to select the interpolation method: the CFD_Mode parameter.
The default and recommended setting is ADVANCED. The alternate setting is LEGACY.
CFA Decoder Performance
The peak pixel processing rate of the CFA decoder of each acquisition channel is 125 megapixels/s.
The performance level of the Bayer CFA decoder is matching approximately the performance of the DMA transfer. However, the peak pixel processing rate is significantly lower than the highest pixel rate achievable by the board-compatible Bayer CFA cameras.