how to convert a grayscale image to rgb image
20 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
how to covert a grayscale image to rgb image
0 commentaires
Réponses (3)
Walter Roberson
le 18 Avr 2012
cat(3, YourImage, YourImage, YourImage)
The result will be a truecolor image that happens to only use gray tones.
2 commentaires
Walter Roberson
le 22 Août 2012
Déplacé(e) : DGM
le 29 Déc 2023
For example:
YourImage = rgb2gray( imread('lena.tif') );
newImage = cat(3, YourImage, YourImage, YourImage);
Image Analyst
le 22 Août 2012
This should also work:
rgbImage = ind2rgb(grayImage, gray(256));
though I usually use the cat() method given by Walter.
1 commentaire
Walter Roberson
le 23 Août 2012
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
le 29 Déc 2023
This answer covers multiple ways, depending on what your expected results are:
0 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!