필터 지우기
필터 지우기

How to find all regions of the same color?

조회 수: 2 (최근 30일)
arman Yaraee
arman Yaraee 2011년 10월 21일
댓글: Stephen23 2015년 11월 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:
  1. it takes long time to process!!
  2. 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?

답변 (3개)

Walter Roberson
Walter Roberson 2011년 10월 21일
John D'Errico has a MATLAB File Exchange contribution for Fuzzy Color Matching

Image Analyst
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....."

lya lya
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
lya lya
lya lya 2015년 11월 28일
Thanks!
Stephen23
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 CenterFile Exchange에서 Blue에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by