File Exchange

image thumbnail

Grayscale to RGB Converter

version 1.0 (257 KB) by

Convert grayscale images to RGB using a specified colormap.

3.66667
8 Ratings

50 Downloads

Updated

View License

The function converts grayscale images to RGB using a specified colormap. The default colormap is ``hot''. The graysale image is supplied either as a name or a matrix.

Example:

res = grs2rgb(im,cmap);

res is a size(im)-by-3 RGB image.

Comments and Ratings (10)

obaldia

It is simple in two lines:
[tmpng cmap] = rgb2ind(im);
[res] = ind2rgb(tmpng Newcmap);

Ketul Patel

mohammed

nice algorithm

Petter

Petter (view profile)

Jasmin

Jasmin (view profile)

jorge Vega Sanchez

very good program

chris cookson

worked great for me, i couldn't believe there wasn't a SIMPLE way to do this already. good work.

Shairyar Malik

Its a beautiful code, excelent effort...
Allah Bless You...

meerab asd

Joaquim Luis

Matlab already contains one (two) function to do this purpose. It is IND2RGB. Image Processing Tbx has a MEX (very fast and very
low memory overhead) called ind2rgb8.
Your function converts the UINT8 image to DOUBLES. This is a awfull memory consumption.

Updates

Examples added and M-lint message taken care of.

MATLAB Release
MATLAB 7.3 (R2006b)
Acknowledgements

Inspired by: Gray image to Color image conversion

Inspired: rgb2hex and hex2rgb

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video