필터 지우기
필터 지우기

saving colormap

조회 수: 1 (최근 30일)
Namrata
Namrata 2011년 3월 29일
below are the commands I am using:
cmap = contrast(Grayscale_Image,100);
colormap(cmap);
The resulting colormap is needed to be saved as an image for further processing on it.Is there any way to do so?

답변 (1개)

Walter Roberson
Walter Roberson 2011년 3월 29일
ImageWidth = 20;
cmapimg = repmat(reshape(cmap,size(cmap,1),1,3), 1, ImageWidth, 1);
Now use your favorite image writing routine on cmapimg. The result will be a vertical stripe of colors ImageWidth pixels wide with the rows all the same color. (That is, to store it as an image, you really only need a single pixel of each color, but that is hard for humans to see, so this code broadens it out to ImageWidth identical pixels.)

카테고리

Help CenterFile Exchange에서 Colormaps에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by