how to find out the indexed matrix of an image?
조회 수: 1 (최근 30일)
이전 댓글 표시
I find out color map and color data of an image.. but how find an index matrix from an color data
color data contains mxn pixels
color map contains RGB colors
index matrix consist of all the colors in an image it like 8,16,64... any number
[cdata cmap]=imread('');
[r c]=size(cmap);
colormap=cmap(1:r,:); %store the colormap
position=colormap;
댓글 수: 2
Walter Roberson
2013년 10월 18일
Do not use "colormap" as a variable name. "colormap" is the name of the function that changes the active color map.
답변 (1개)
Walter Roberson
2013년 10월 18일
In the above code, your variable "cdata" is the indexed matrix.
If you want the truecolor image implied by your "cdata" and "cmap", then you can use
ind2rgb(cdata, cmap)
댓글 수: 2
Walter Roberson
2013년 10월 18일
length(unique(YourArray(:)))
Like that? The number actually used?
Or do you mean
size(cmap, 1)
which is the number of entries in the assigned colormap even if some of the entries of the map are unused.
참고 항목
카테고리
Help Center 및 File Exchange에서 Blue에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!