MATLAB Answers

how to convert a gray scale image to color image using matlab

496 views (last 30 days)
learningmat
learningmat on 11 Sep 2013
Answered: David Mills on 22 Feb 2017
Hi all, Is there any possibility to convert ab gray scale image into color image.If so, kindly suggest me.
Thanks in advance

Answers (4)

sidra
sidra on 11 Sep 2013
Nirmala , try the following , its a very simple and efficient code to convert grayscale images to RGB using a specified colormap.
  4 Comments
Image Analyst
Image Analyst on 12 Sep 2013
I believe I heard that most of that was done "by hand" - by artists - with some help from digital computers to continue colors onto the next frame. See https://en.wikipedia.org/wiki/Colorizing

Sign in to comment.


Jan
Jan on 11 Sep 2013
It depends on how the converted image should look like, so please explain any details. Examples:
Gray = rand(200, 200);
RGB1 = cat(3, Gray, Gray, Gray); % information stored in intensity
RGB2 = Gray;
RGB2(end, end, 3) = 0; % All information in red channel
GrayIndex = uint8(floor(Gray * 255));
Map = jet(255);
RGB3 = ind2rgb(GrayIndex, Map);
And there are many many other possible solutions.
  3 Comments
Image Analyst
Image Analyst on 11 Sep 2013
What happened to A? Why is it no longer available in your code? Did you use "clear" to get rid of it? If so, just don't do that and you'll have the original A.

Sign in to comment.


Tallha Akram
Tallha Akram on 11 Sep 2013
[X,map] = imread('trees.tif');
gmap = rgb2gray(map);
figure, imshow(X,map), figure, imshow(X,gmap);
figure; imshow(X,gmap); colormap(map);
  10 Comments

Sign in to comment.


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!