フィルターのクリア

how to find out the indexed matrix of an image?

1 回表示 (過去 30 日間)
Anusha
Anusha 2013 年 10 月 18 日
コメント済み: Walter Roberson 2013 年 10 月 18 日
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
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.
Anusha
Anusha 2013 年 10 月 18 日
ok

サインインしてコメントする。

回答 (1 件)

Walter Roberson
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 件のコメント
Anusha
Anusha 2013 年 10 月 18 日
no need true color
cdata =index matrix is it?
I take an one image (8 color image)that consist cdata (2185x1575 unit8) values its too big matrix
but i want only number of color is presented in the matrix 8 color means only 8 value are presented.
it is possible
Walter Roberson
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 ExchangeColormaps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by