Separate Bayer pattern Color Filter Array (CFA) image into sensor element images
Read a Color Filter Array (CFA) image into the workspace. The
rawread function returns
cfa, a 4012-by-6034 image.
cfa = rawread("colorCheckerTestImage.NEF");
Split the returned CFA image into several individual images, each representing a CFA sensor component. The CFA image has a Bayer pattern of RGGB. The
raw2planar function returns 2206-by-3017-by-4 array representing each component of the RGGB pattern.
rggb = raw2planar(cfa);
cfa— Bayer pattern CFA image
Bayer pattern CFA image, specified as an M-by-N numeric matrix.
I— Image with channel for each sensor element
Image with a channel for each sensor element, returned as an
(M/2)-by-(N/2)-by-4 numeric array of the same
The order of the channels in the output image depends on the Bayer pattern of the
CFA: the order of the red, green, and blue sensors. The 2-by-2 grid of pixels in the
upper-left corner of the CFA image describes the channel order, from left-to-right,
I(:,:,1) corresponds to the sensor at
I(:,:,2) to the sensor at
I(:,:,3) to the sensor at
I(:,:,4) to the sensor at