how to convert a grayscale image to rgb image
조회 수: 20 (최근 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
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!