how to converty gray image to color image?
조회 수: 3 (최근 30일)
이전 댓글 표시
how to converty gray image to color image?
댓글 수: 0
답변 (1개)
Image Analyst
2012년 9월 25일
Depending on what you want the gray to be....
grayImage = rgb2gray(rgbImage);
OR
grayImage = rgbImage(:, :, 1); % Extract red channel.
grayImage = rgbImage(:, :, 2); % Extract green channel.
grayImage = rgbImage(:, :, 3); % Extract blue channel.
댓글 수: 4
Ryan
2012년 9월 25일
To build on Matt's answer, here is a reference for colormaps in Matlab: http://www.mathworks.com/help/matlab/ref/colormap.html
Image Analyst
2012년 9월 25일
Sorry. I didn't notice, since this is much much less common than the other way. You can use cat() or ind2rgb():
rgbImage = cat(3, grayImage, grayImage, grayImage);
rgbImage = ind2rgb(grayImage, cmap); % e.g. cmap = gray(256)
참고 항목
카테고리
Help Center 및 File Exchange에서 Red에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!