how to convert grayscale image to RGB image

2 ビュー (過去 30 日間)
aarti sawant
aarti sawant 2013 年 12 月 14 日
回答済み: DGM 2022 年 4 月 19 日
hello,
Plz tell me how can i convert grayscale image to RGB image

回答 (3 件)

Walter Roberson
Walter Roberson 2013 年 12 月 14 日
RGBImage = cat(3, GrayImage, GrayImage, GrayImage);
would result in an RGB image with the same visual appearance as the grayscale image.

Image Analyst
Image Analyst 2013 年 12 月 14 日
Another option to assign colors to certain gray levels is to create a color map that does the mapping and pass it into ind2rgb
rgbImage = ind2rgb(grayImage, jet(256)); % Choose whatever colormap you want instead of jet.
It just depends on what you want and expect the output to look like.

DGM
DGM 2022 年 4 月 19 日
Depending on what the goals are, there are various ways to interpret the question. The following link includes demonstrations of converting a single-channel image to a 3-channel image via:
  • channel replication (like above)
  • channel filling/deletion and potential hue adjustment
  • uniform and nonuniform colorization methods
  • color mapping
I imagine most needs are met with replication or colormapping, but I like generalizable answers to be somewhat comprehensive.

カテゴリ

Help Center および File ExchangeBlue についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by