applying colour for clustered image

조회 수: 3 (최근 30일)
kash
kash 2013년 3월 1일
i have a code below of 2 images
for n=1:length(dirlist);
img = imread([pathname, dirlist(n).name]);
I=img;
HSV = rgb2hsv(I);
%HSV=I;
H = HSV(:,:,1); H = H(:);
S = HSV(:,:,2); S = S(:);
V = HSV(:,:,3); V = V(:);
idx = kmeans([H S V],3);
figure,imshow(ind2rgb(reshape(idx, size(I,1), size(I, 2)), [0 0 1; 0 0.8 0;1 0 0]))
end
the image consist of water,and land
one image consist of 70% of water and other 40% of water is it possible to give same colour for water in two images
plz assist

답변 (2개)

ChristianW
ChristianW 2013년 3월 1일
You can define the water color. Than calculate the mean color for every cluster. Compare the mean cluster color with your defined water color to find your water cluster.
You could also use the mean cluster color directly as cluster color.
  댓글 수: 11
ChristianW
ChristianW 2013년 3월 2일
You are messing things up. I took your color/texture segmentation (implemented with kmeans), the segmentation isn't my part of the code. My part just takes a kmeans output and does a cluster affectation. It applies color for the clustered image, thats what you've asked for.
If your question is aimed at improving your segmentation, than Image Analyst is your best bet.
kash
kash 2013년 3월 2일
my question also deals with this,having two images consisting of water,how can we give same colour for water for different images

댓글을 달려면 로그인하십시오.


Image Analyst
Image Analyst 2013년 3월 2일
Looks like you can find the blue water fairly easily with color classification. The green water you'll have to find by adding in a texture filter like stdfilt() or entropyfilt() because the trees are very close to the same color and the only difference is the texture. The white stuff is either sand or surf on sand - either way white stuff is land. If you still need help, say so. I have color classification examples in my File Exchange http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
  댓글 수: 9
Image Analyst
Image Analyst 2013년 3월 2일
Exactly what does "Walter colouring must be mase" mean?
kash
kash 2013년 3월 5일
I cannot understand what u said,what is walter colouring

댓글을 달려면 로그인하십시오.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by