Convert CFA to RGB (24 bit)  
Top  Previous  Next


Menu:   Convert > CFA to RGB (24 bit)  
Script:   bayer  

Use this command to convert an 8-bit color filter array image into a 24-bit RGB image.

CFA images are usually generated by a single-chip CCD camera, which has a color filter mosaic array installed in front of the sensor. The most frequently used Bayer pattern has the following layout:

G
B
G
B
B
R
G
R
G
R
G
B
G
B
G
R
G
R
G
R
 

Each pixel value in a CFA image corresponds to the intensity of the pixel behind the corresponding color filter. The conversion from such a grayscale image to RGB image is typically done on the camera itself, however some cameras (known as Bayer cameras) deliver a CFA image unchanged. CFA to RGB command transforms such an image into RGB image by performing the Bayer color reconstruction (demosaicing). The command also allows you to interactively adjust the gain levels for each color component by providing a real-time color preview in the input image frame.

the minimum and maximum gain for each color component is selected by moving a related pair of sliders. As you move the sliders, the colors in the preview image change. The numbers in the boxes on the left and the markers in the histogram are updated accordingly, displaying the gain range for the selected component. You can also edit the minimum and maximum levels by selecting or typing the desired values in the boxes on the left of the sliders and pressing ENTER, or by dragging the highlighted areas at the bottom of the Component rulers.

The following options are available in the CFA to RGB dialog box:

Input
 
Displays the number of the input frame that contains an 8-bit grayscale CFA image. If you want to convert another image, type or select the corresponding value.  
 
Output
 
Displays the number of the frame in which the RGB image will be created. Depending on the Preferences. ImageWarp will set it either to the first available value or to the Input frame number. Type or select another value if you want the output image to be created in a different frame.  

Interpolation
 
Allows you to select the interpolation mode.  
 
Click None to disable interpolation and substitute missing pixels with the nearest adjacent pixels of the same color.  
 
Click Bilinear to calculate the values of missing pixels by performing bilinear interpolation of the adjacent pixels.  
 
Layout
 
Lets you define the layout of the Bayer filter by selecting two first elements of the first row of the CFA input image. Select one of the following layouts: GB, GR, BG, RG.  

White balance
 
Click this button to automatically adjust the gain levels for each color component by performing the gray balance. In order to get the correct results, the input image should contain an object of the gray color that covers most of the field of view.  

Histogram display
 
Displays the 3-component histogram for the input image or its selection. When you activate the Red, Green or Blue component by clicking the related ruler or slider, the histogram graph for the selected component will be brought to the foreground. As you adjust the minimum and maximum gain levels for the active color component, the markers of the corresponding color will move over the histogram, visually representing the boundaries of the gain range.  

Y-scale
 
Use the Y-scale slider located on the right side of the Histogram display to change the scale of the Y-axis of the histogram chart. The default range of the Y-axis is determined by the largest frequency value.  

Component rulers
 
Display the intensity scales for the Red, Green and Blue components. The color bars that appear at the bottom of each ruler highlight the current gain ranges Use them as a visual reference while adjusting the minimum and maximum levels of gain for each color.