필터 지우기
필터 지우기

how can i convert RGB image to indexed image without using toolbox?

조회 수: 1 (최근 30일)
maha D
maha D 2016년 10월 14일
댓글: Image Analyst 2016년 10월 15일
i want to convert rgb image to indexed image but without using toolbox, with colormap and impixel

답변 (2개)

Guillaume
Guillaume 2016년 10월 14일
Since rgb2ind is part of base matlab, you can use that. No toolbox required.

Image Analyst
Image Analyst 2016년 10월 14일
rgb2ind() doesn't work? Really? Then please read this link, then post your code.
In the meantime, this works just fine for me:
rgbImage = imread('peppers.png');
subplot(2, 1, 1);
imshow(rgbImage); % Show original image
[indexedImage, map] = rgb2ind(rgbImage, 8);
subplot(2, 1, 2);
imshow(indexedImage, map); % Show posterized version
colorbar;
Since you forgot to share your code, can you run my code and verify that rgb2ind() still does not work for you? Then, since it works for me and I can't reproduce your system's behaviour, and does not work for you, you should call the Mathworks for tech support.
  댓글 수: 2
maha D
maha D 2016년 10월 15일
편집: Guillaume 2016년 10월 15일
function [ind, map] = myrgb2ind(rgb);
rgb = imread('rgb.TIF');
[ind,map] = rgb2ind(rgb,8);
impixel(ind);
imagesc(ind);
colormap(map);
imshow(ind);
end
%this is my code i don't know what is wrong with it.
Image Analyst
Image Analyst 2016년 10월 15일
You don't need to call both imagesc() and imshow(). Just call imshow(). And call colormap AFTER you call imshow().
And you don't need to call impixel() at all. If you want to see what the values are, just use impixelinfo().
Look at my code. Just do it like that, not the way you did it.

댓글을 달려면 로그인하십시오.

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by