フィルターのクリア

reconstruction of a color

1 回表示 (過去 30 日間)
Mohammad Golam Kibria
Mohammad Golam Kibria 2011 年 5 月 15 日
Hi suppose I have an image. It shows 2 colors visually.I need two know whether there is actually 2 colors or many different colors. I have used the following code.but perhaps Im not getting the right answer:
Here I seems to have two bars of two colors.
I1=rgb2hsv(I);
color=zeros([30,50,3],'double');
r=size(I1,1); for r=1:size(I1,1); for c=1:size(I1,2)
h=num2str(I1(r,c,1));
s=num2str(I1(r,c,2));
v=num2str(I1(r,c,3));
filename=strcat(path,num2str(r),'\',num2str(r),num2str(c),'h=',h,'s=',s,'v=',v,'.jpg');
color(:,:,1)=I1(r,c,1);
color(:,:,2)=I1(r,c,2);
color(:,:,3)=I1(r,c,1);
hsvcolor=hsv2rgb(double(color));
imwrite(hsvcolor,filename,'jpg');
end
end
am i doing the right process?If not what is necessary for correction?

回答 (2 件)

Walter Roberson
Walter Roberson 2011 年 5 月 15 日
T = reshape(I1,[],3);
U = unique(T,'rows');
if size(U,1) > 2
disp('there were more than 2 colors');
end
Though this does depend upon what you mean by "color"; possibly you just want to compare hues?
  1 件のコメント
Mohammad Golam Kibria
Mohammad Golam Kibria 2011 年 5 月 15 日
Yes, I want to compare hues and also want to know how much hue difference makes visible color difference in our eyes.So I need a program that will be of different hue but saturation and value will be same. But any file saved in takes array hue value as rgb value. can you suggest me how to write that type of program?

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


Bjorn Gustavsson
Bjorn Gustavsson 2011 年 5 月 16 日

カテゴリ

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