label2color
%LABEL2COLOR Convert Label Matrix to RGB Image with specified properties.
% RGB = LABEL2COLOR(X) converts a label matrix X into a color RGB image
% with default properties for the purpose of visualizing the labeled regions.
%
% RGB = LABEL2COLOR(X,PARAM1,VAL1,PARAM2,VAL2,___) converts a label matrix X,
% specifying parameters and corresponding values that control various aspects of the RGB image.
% Parameter case does not matter.
%
% PROPERTIES can be a comma-separated list of strings
% 'ColorMap' - colormap (default 'jet')
% 'ZeroColor' - zero color (background, uint8/double, default [0 0 0])
% 'EdgeColor' - edge color (uint8/double, default [255 255 255])
% 'EdgeWidth' - edge width (default 1)
%
% Class Support
% -------------
% The input label matrix X can have any numeric class. It must contain
% finite nonnegative integers. RGB is uint8.
%
% Example 1
% ---------
% RGB = label2color(X);
%
% Example 2
% ---------
% RGB = label2color(X,'colormap','summer');
%
% Example 3
% ---------
% RGB = label2color(X,'ColorMap','hot','ZeroColor',[0 0 1],'EdgeColor',[1 1 1],'EdgeWidth',3);
%
%
% 20/12/2015, ver 1.10, modify the code for 'EdgeWidth'
% 21/12/2015, ver 1.20, support any numeric class
% 22/12/2015, ver 1.21, remove 'assignin'
% 22/12/2015, ver 1.22, 'numregion' should plus 1; set default 'ColorMap' to 'jet'
% 22/12/2015, ver 1.23, add demo
% 23/12/2015, ver 1.30, support custom colormap
%
% Jing Lou (楼竞), http://www.loujing.com
%
Zitieren als
Jing Lou (2024). label2color (https://www.mathworks.com/matlabcentral/fileexchange/54579-label2color), MATLAB Central File Exchange. Abgerufen .
Kompatibilität der MATLAB-Version
Plattform-Kompatibilität
Windows macOS LinuxKategorien
- MATLAB > Graphics > Images > Modify Image Colors >
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Live Editor erkunden
Erstellen Sie Skripte mit Code, Ausgabe und formatiertem Text in einem einzigen ausführbaren Dokument.
label2color/
Version | Veröffentlicht | Versionshinweise | |
---|---|---|---|
1.30.0.0 | support custom colormap |
||
1.23.0.0 | 'numregion' should plus 1
|
||
1.21.0.0 | remove 'assignin' |
||
1.2.0.0 | support any numeric class |
||
1.0.0.0 |
add demo
|