rawread
Description
Examples
Read CFA Image Data from File
Read only the visible Color Filter Array (CFA) image data from a file. By default, rawread
returns only the visible portion of the CFA image.
cfa = rawread("colorCheckerTestImage.NEF");
Read the entire CFA image from a file, including the image frame. In a RAW image, the frame is typically used to calculate the black-level surrounding the visible image.
cfa = rawread("colorCheckerTestImage.NEF", "VisibleImageOnly", false);
Input Arguments
filename
— Name of RAW file
string scalar | character vector
Name of RAW file, specified as a string scalar or character vector. Specify
filename
as a full path, containing the file name and extension,
or as a relative path from the current folder or from any folder on the MATLAB® path.
The rawread
function does not support RAW file formats that
employ JPEG compression.
Data Types: char
| string
visibleImageOnly
— Return only visible CFA image data
true
or 1
(default) | false
or 0
Return only visible CFA image data, specified as a numeric or
logical 1
(true
) or 0
(false
). In a RAW image, the frame is typically used to calculate the black-level
surrounding the visible image. To read only the visible portion of the CFA, specify
true
. To read the entire CFA, including the frame, specify
false
. This table provides more detail for each option.
Value | Description |
---|---|
true | The dimensions of the
|
false | The dimensions of the
|
Data Types: logical
Output Arguments
cfaImage
— CFA image
m-by-n-by-p numeric
array
CFA image, returned as an m-by-n-by-p numeric array.
By default, rawread
returns only the visible portion of the CFA
image. In this case, the values of m and n
correspond to the first and second elements of the VisibleImageSize
field reported by rawinfo
,
respectively. If you choose to include the frame in the returned image, then the values
of m and n correspond to the first and second
elements of the CFAImageSize
field reported by
rawinfo
, respectively. For both types of returned images, the
value of p depends on the type of CFA sensor. For Bayer type sensors,
the value is 1. For a Foveon sensor, the value is 3.
Data Types: uint16
| single
More About
RAW File Format
The RAW file format preserves image data in its most unedited state, recorded directly from the camera sensor. Most camera manufacturers define their own proprietary RAW file format, such as the Nikon NEF file format and the Canon CRW format. Adobe has also defined a RAW file format, DNG (digital negative), which is supported by several cameras. The name of the format is typically capitalized, like other file formats such as JPG and TIF. However, unlike other file formats, RAW is not an acronym.
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 R2021aR2024a: LibRaw version updated to 0.21.1
The function now reads CFA image data using LibRaw version 0.21.1.
R2022b: Support for thread-based environments
rawread
now supports thread-based
environments.
R2021b: LibRaw version updated to 0.20.2
The function now reads CFA image data using LibRaw version 0.20.2. Before, the function used LibRaw version 0.20.0.
See Also
raw2planar
| rawinfo
| planar2raw
| raw2rgb
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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)