how to convert a grayscale image to rgb image
2 ビュー (過去 30 日間)
古いコメントを表示
how to covert a grayscale image to rgb image
0 件のコメント
回答 (3 件)
Walter Roberson
2012 年 4 月 18 日
cat(3, YourImage, YourImage, YourImage)
The result will be a truecolor image that happens to only use gray tones.
2 件のコメント
Walter Roberson
2012 年 8 月 22 日
移動済み: DGM
2023 年 12 月 29 日
For example:
YourImage = rgb2gray( imread('lena.tif') );
newImage = cat(3, YourImage, YourImage, YourImage);
Image Analyst
2012 年 8 月 22 日
This should also work:
rgbImage = ind2rgb(grayImage, gray(256));
though I usually use the cat() method given by Walter.
1 件のコメント
Walter Roberson
2012 年 8 月 23 日
The cat() method will work when the grayscale image is class single or double, or uint8 or uint16, but ind2rgb() requires uint8 or uint16.
DGM
2023 年 12 月 29 日
This answer covers multiple ways, depending on what your expected results are:
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Convert Image Type についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!