raw2planar
Separate Bayer pattern color filter array (CFA) image into sensor element images
Since R2021a
Syntax
Description
Examples
Split CFA Image into Individual Sensor Component 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);
Input Arguments
cfa
— Bayer pattern CFA image
M-by-N numeric matrix
Bayer pattern CFA image, specified as an M-by-N numeric matrix.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
Output Arguments
I
— Image with channel for each sensor element
(M/2)-by-(N/2)-by-4 numeric array
Image with a channel for each sensor element, returned as an
(M/2)-by-(N/2)-by-4 numeric array of the same
data type as cfa
.
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,
top-to-bottom. I(:,:,1)
corresponds to the sensor at
cfa(1,1)
, I(:,:,2)
to the sensor at
cfa(1,2)
, I(:,:,3)
to the sensor at
cfa(2,1)
, and I(:,:,4)
to the sensor at
cfa(2,2)
.
Extended Capabilities
Thread-Based Environment
Run code in the background using MATLAB® backgroundPool
or accelerate code with Parallel Computing Toolbox™ ThreadPool
.
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
Version History
Introduced in R2021aR2022b: Support for thread-based environments
raw2planar
now supports thread-based
environments.
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)