real2rgb & colormaps
This function converts an MxN matrix of real-valued intensities into a truecolor image (MxNx3 double array in the range [0,1]), without discretization, by linearly interpolating between colors of the input colormap. The output can be displayed using IMAGE or IMSHOW, exported using IMWRITE, used for texture mapping, etc.
Colormaps are specified either by name, or as a JxK colormap table (K = 3 or 4). Named colormaps can be prefixed with '-' to invert the colormap, and suffixed with '*' to make each color transition cover the same number of gray levels when converted to grayscale. This latter option allows colormaps to be adapted to print to a linear grayscale when printed in black & white, e.g. 'hot*'. Colormaps can be non-linear by specifying a relative length for each color transition in the fourth column of a colormap table.
Many old and new colormap functions are included in this submission. The old colormaps have been included, with improvements, for the following reasons. All colormap functions can additionally return the most concise colormap table required to generate that colormap, and they can take in an intensity image and return the truecolor output using that colormap.
Some of the new colormaps included are:
thermal - generate the look of false-color thermal (IR) images.
temp - a blue-white-red color scheme for temperature scales.
sepia - generate the look of old photographs.
Several new colormaps have been created specifically to revert to linear grayscale when printed in black & white. These are:
hicontrast - saturated colors, for maximum level differentiation.
dusk - pastel shades from cold and dark to warm and light.
bright - bright colors, with good level differentiation.
pastel - pastel shades, with good level differentiation.
copper2 - similar to copper, but continues on to white.
pink2 - black to white through several distinct shades of pink.
earth - shades of green and brown.
Creating new colormap functions of your own is now incredibly simple. Specify a concise colormap table, and the included colormap_helper function does the rest. If you submit such colormap functions to the FEX, please use the tag 'real2rgb_colormap' so they can be found easily.
If you require more advanced functionality, e.g. for multi-dimensional input values, take a look at SC (FEX ID: 16233). The functionality included here is a subset of that functionality, separated for ease of use and understanding.
This function is now included in the sc package:
http://www.mathworks.com/matlabcentral/fileexchange/16233
The version here will not be maintained.
인용 양식
Oliver Woodford (2024). real2rgb & colormaps (https://www.mathworks.com/matlabcentral/fileexchange/23342-real2rgb-colormaps), MATLAB Central File Exchange. 검색 날짜: .
MATLAB 릴리스 호환 정보
플랫폼 호환성
Windows macOS Linux카테고리
- MATLAB > Graphics > Formatting and Annotation > Colormaps > Red >
- MATLAB > Graphics > Formatting and Annotation > Colormaps > Orange >
- MATLAB > Graphics > Formatting and Annotation > Colormaps > Yellow >
- MATLAB > Graphics > Formatting and Annotation > Colormaps > Purple >
- MATLAB > Graphics > Images > Modify Image Colors >
태그
도움
도움 준 파일: SC - powerful image rendering, COLORMAP and COLORBAR utilities (Jul 2014), Bipolar Colormap, mat2im, AdvancedColormap, demViewer, Bichromatic colormap for real2rgb
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!private/
버전 | 게시됨 | 릴리스 정보 | |
---|---|---|---|
1.9.0.0 | Updated description as this function is to be maintained in the sc package only. |
||
1.8.0.0 | Fix bug when converting matrices containing Inf or -Inf without specifying limits. Thanks to Ming Wu for reporting it. |
||
1.7.0.0 | Fixed bug reported by Peter Nave (thanks!) whereby colormaps of 1024x3 are returned (too big for Windows colorbars). |
||
1.5.0.0 | Added cold and dusk colormaps |
||
1.4.0.0 | Bug fix |
||
1.3.0.0 | A few bug fixes and efficiency improvements. Also, colormap functions return concise table when input == Inf rather than < 0. |
||
1.2.0.0 | Now faster when using non-linear colormaps, thanks to a suggestion by Steve Lord to use histc. |
||
1.1.0.0 | Two important bug fixes, increased colormap size used to 1024 (from 256), and added pink (standard) and bright (new) colormaps. |
||
1.0.0.0 |