Siva, you've been asking enough questions here that you should learn how to format lines as code. Here's a tip: Just simply highlight the lines of code and click the {}Code icon above the text box. That will format it so that we will see it properly. I've done it for you this time but try to do it yourself next time - it's not hard. Thanks!
what's the value of r? One? Or three? I guess your Image is already an RGB image, only that R, G and B are always equal (and therefore you have gray) ...
It's possible for a color image to have only gray colors in it. Gray is a color too. If all your red, green, and blue channels were the same image, then creating a color image out of them will make a gray image.
If you want to apply a pseudocolor look up table to an image to create a pseudocolored image, you can use colormap() and ind2rgb().
thanks.for jpg images, this code return me color image but for bmp color image give me graye image. original images are color(red.green.blue).i apply them in my code but output images were gray!! i use above codes to convert them to color image but output was gray image again.how correct it?
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
2 Comments
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/46698-how-to-convert-gray-image-to-color-image#comment_96152
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/46698-how-to-convert-gray-image-to-color-image#comment_96152
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/46698-how-to-convert-gray-image-to-color-image#comment_96189
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/46698-how-to-convert-gray-image-to-color-image#comment_96189
Sign in to comment.