How to find all regions of the same color?
5 ビュー (過去 30 日間)
古いコメントを表示
Hi guys. I wrote a piece of code which finds all the points with the same color as I selected:
In this part we just find the coordinates of the required co
im = imread('Lighthouse.jpg');
n = 1;
figure, imshow(im)
[x,y] = ginput(n);
x = floor(x);
y = floor(y);
%colour(length(x),3);
colour = zeros(1,length(x),3, 'uint8');
for i=1:length(x)
for k=1:3
colour(1,i,k) = im(y(i),x(i),k);
end
end
%image(colour);
%axis off;
Now that I have the colour, I want to search the picture for all the points with the same colour.
[r,c,t] = size(im);
counter = 1;
for i=1:r
for j=1:c
if (im(i,j,:) == colour(1,1,:))
coordr(counter) = i;
coordc(counter) = j;
counter = counter+1;
end
end
end
This way I found all the points with the color the user selected! Now my problem is:
- it takes long time to process!!
- I want to select colors which are close to my color but I dunno the algorithm to do it! (this is my main problem) because the points which are found are not enough!
for example they are about 200 points in a big picture. they will be seen as dots! any ideas?
0 件のコメント
回答 (3 件)
Walter Roberson
2011 年 10 月 21 日
John D'Errico has a MATLAB File Exchange contribution for Fuzzy Color Matching
0 件のコメント
Image Analyst
2011 年 10 月 21 日
arman: I suggest you abandon that approach and use my delta E based approach in my File Exchange: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862 That uses an industry standard method (delta E) for determining color difference. I believe it will do exactly what you want.
Walter, fuzzy color was one of the submissions that John removed and never replaced. As I recall it didn't do color segmentation anyway but was some sort of a name assignment scheme, though. I still have his code though. He says "Fuzzycolor is a tool for identifying the "color name" of any RGB intensity triad, i.e., sets of 3 color values....."
0 件のコメント
lya lya
2015 年 11 月 28 日
Dear Image Analyst,
Do you still have the Fuzzy Color code from John? If so, I hope you can share it with me.
Thanks.
3 件のコメント
Stephen23
2015 年 11 月 30 日
You can also try my FEX submission, which identifies colornames based on RGB values but uses the "industry standard method (delta E) for determining color difference":
It also supports many standard sets of named colors, such as CSS, dvips, HTML, Kelly, MacBeth, MATLAB, Wolfram, X11, xcolor, xkcd,...
参考
カテゴリ
Help Center および File Exchange で Blue についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!