raw2rgb
Description
Examples
Convert the color filter array (CFA) image in the file into a 16-bit RGB image in the sRGB colorspace.
rgb = raw2rgb("colorCheckerTestImage.NEF");
imshow(rgb)
Convert the CFA image into a 8-bit RGB image in the Adobe RGB 1998 colorspace.
rgb = raw2rgb("colorCheckerTestImage.NEF",BitsPerSample=8,ColorSpace="adobe-rgb-1998"); imshow(rgb)
Convert the CFA image into a 16-bit image, in the camera's native colorspace, white-balanced against a D65 illuminant.
rgb = raw2rgb("colorCheckerTestImage.NEF",ColorSpace="camera", ... WhiteBalanceMultipliers="D65"); imshow(rgb)
Input Arguments
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 raw2rgb
function does not support RAW file formats that
employ JPEG compression.
Data Types: char
| string
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Example: rgb =
raw2rgb("colorCheckerTestImage.NEF",BitsPerSample=8,ColorSpace="adobe-rgb-1998");
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: rgb =
raw2rgb("colorCheckerTestImage.NEF","BitsPerSample",8,"ColorSpace","adobe-rgb-1998");
Apply contrast stretching when rendering the RGB image, specified as a numeric or
logical 0
(false
) or 1
(true
)
Bits per sample of the output RGB image, specified as 8
or
16
.
Color space of the output RGB values, specified as "srgb"
,
"camera"
, or "adobe-rgb-1998"
. For more
information about the "srgb"
and
"adobe-rgb-1998"
color spaces, see Understanding Color Spaces and Color Space Conversion.
The "camera"
color space is native to the device.
Data Types: char
| string
White balance adjustment for rendering the RGB image, specified as one of the
strings in this list, or as a 1-by-N vector of data type
double
.
Value | Description |
---|---|
"AsTaken" | White balance multipliers used by the camera to capture the image |
"D65" | White balance multipliers required to balance image using the D65 illuminant |
"ComputeFromImage" | White balance multipliers determined by analyzing the CFA image |
1-by-N vector | Custom white balance multipliers specified as a 1-by-N
vector of data type single or double .
For Bayer sensor images, N must be 4 and the order of the
coefficients should match the CFALayout field reported by
rawinfo . For non-Bayer sensors, N should
match the SamplesPerPixel field reported by
rawinfo . |
Data Types: double
| char
| string
Output Arguments
RGB image, returned as an M-by-N-by-3 numeric
array. The values of M and N correspond to the
first and second elements of the RenderedImageSize
field reported by
rawinfo
,
respectively.
rgbImage
can be either uint8
or
uint16
, depending on the value of the
BitsPerSample
name-value argument.
Extended Capabilities
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
Version History
Introduced in R2021aThe function now reads CFA image data using LibRaw version 0.21.4.
The function now reads CFA image data using LibRaw version 0.21.1.
raw2rgb
now supports thread-based
environments.
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
| rawread
| rawinfo
| planar2raw
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.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- 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)