rgb2lightness
Description
Examples
Convert RGB Color to Lightness Component
Read RGB image into the workspace.
rgb = imread('peppers.png');
Convert the RGB color values to lightness component, excluding the color information.
lightness = rgb2lightness(rgb);
Display the RGB image and the derived lightness component of image.
figure
imshow(rgb)
title('Input RGB Image')
figure
imshow(lightness,[])
title('Lightness Component of Image')
colorbar
Input Arguments
rgb
— RGB color values
m-by-n-by-3 image array
RGB color values, specified as an m-by-n-by-3
image array. The input rgb
must be in sRGB color space with a
reference white point of D65.
Data Types: single
| double
| uint8
| uint16
Output Arguments
lightness
— Converted lightness values
m-by-n image array
Converted lightness values, returned as an
m-by-n image array. If the input data type is
double
, the output data type is double
.
Otherwise, the output data type is single
.
Data Types: single
| double
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
rgb2lightness
supports the generation of C
code (requires MATLAB®
Coder™). For more information, see Code Generation for Image Processing.
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 R2019aR2022b: Support for thread-based environments
rgb2lightness
now supports thread-based
environments.
Ouvrir l'exemple
Vous possédez une version modifiée de cet exemple. Souhaitez-vous ouvrir cet exemple avec vos modifications ?
Commande MATLAB
Vous avez cliqué sur un lien qui correspond à cette commande MATLAB :
Pour exécuter la commande, saisissez-la dans la fenêtre de commande de MATLAB. Les navigateurs web ne supportent pas les commandes MATLAB.
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)