フィルターのクリア

How to Read the pixels and state what are all the colors that are present in the Image?

1 回表示 (過去 30 日間)
I have plotted the graph using geoshow.
I need to read the pixels and validate the data by counting the respective colors.
So, I want to know what are the colors present in the Image. I have checked that with paint picker. But, there are number of colors.
Is it possible to read the image and list the colors in the form of color code RGB?
If possible, kindly help me out of this.
  3 件のコメント
Walter Roberson
Walter Roberson 2018 年 7 月 6 日
Do you want just the list of unique RGB triples? That is quite easy.
Do you want the "color name" for each RGB triple? That is more difficult, but you could start with the over 1500 named colors at https://en.wikipedia.org/wiki/List_of_colors_(compact) and you could read https://blog.xkcd.com/2010/05/03/color-survey-results/ (read it multiple times)
Do you want the named "primary" color for each RGB triple? That is hardest, as we have a very tough time defining exactly where "blue" ends and the next major color starts. Mechanical definitions based upon octant of the RGB color are not very good at aligning with human experience.
Guillaume
Guillaume 2018 年 7 月 6 日
Jotheeshwar V's comment mistakenly posted as an answer moved here:
I don't need the color name. The color indication in redchannel, greenchannel and bluechannel values. Like 255, 255, 255 for white.
and By the way, it is radar-gram of the ground surface and the plot is
https://drive.google.com/open?id=1AHilH-DD7AlSDxrReZ35ZO-06My-G84M
Regards,
Jotheeshwar

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

採用された回答

Walter Roberson
Walter Roberson 2018 年 7 月 6 日
[uniquergb, ~, groupnumber] = unique(reshape(YourImage, [], 3),'row');
groupcounts = accumarray(groupnumber);
Now the RGB triple uniquergb(K,:) occurred groupcounts(K) times.
  5 件のコメント
Walter Roberson
Walter Roberson 2018 年 7 月 8 日
YourImage = imread('peppers.png');
[uniquergb, ~, groupnumber] = unique(reshape(YourImage, [], 3),'rows');
groupcounts = accumarray(groupnumber, 1);
[sortedcounts, sortidx] = sort(groupcounts, 'descend');
N = 10;
most_common_rgb = double( uniquergb(sortidx(1:N),:) );
most_common_counts = sortedcounts(1:N);
fprintf('The most common colors are:\n count @ [r, g, b]\n');
fprintf('%g @ [%g, %g, %g]\n', [most_common_counts, most_common_rgb].' ); %transpose is important
Jotheeshwar V
Jotheeshwar V 2018 年 7 月 8 日
編集済み: Jotheeshwar V 2018 年 7 月 8 日
When I use my image, I am getting the error:
Out of memory. Type HELP MEMORY for your options.
I tried for a small image and that worked out
What should I do for this concern?
and the grid size of my file is, 11521x39842x3

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by