How do I convert my grayscale image back to its true color(RGB)?

2 views (last 30 days)
dog=imread('dogImage.png'); hidden01=imread('hidden01.png'); f=flatten(hidden01);%flattenning image function red=dog(:,:,1); for x=1:160000; if f(x)==0 a(x)=red(x)-1;
end
if f(x)==1
a(x)=red(x)-0;
end
end
a=reshape(a,400,400);
%rgbImage = cat(3, a, a, a)
rgbImage = ind2rgb(a, colormap)
%rgb=a(:,:,[1 1 1]);
figure()
image(rgbImage);
axis off

Answers (1)

Star Strider
Star Strider on 13 Mar 2015
You don’t.
Once you’ve lost the colour information, you can’t retrieve it.

Community Treasure Hunt

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

Start Hunting!