I have a image of two circles which are partially occulded. I have to label them as two different label. is there any way to label them differently? I am adding some more images. Images have some regular & non-regular shapes.

2 views (last 30 days)
poonam
poonam on 28 Dec 2015
Commented: poonam on 3 Jan 2016
>>
>>
  2 Comments

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 28 Dec 2015
poonam, did you see the example in the help for the watershed function? This is exactly the help demo - two overlapping circles, separating and labeling them. Just follow the code in the help example.
  3 Comments
poonam
poonam on 3 Jan 2016
Yes sir, I learned about that function. and it worked very well for all my images. And I think my revision of question was unnecessary. Thank you.

Sign in to comment.

More Answers (1)

harjeet singh
harjeet singh on 28 Dec 2015
hello poonam do use this code
clear all
close all
clc
img=imread('rgbCattach.png');
img=rgb2gray(img);
figure(1)
imshow(img)
drawnow
img=logical(img);
[centers, radii, metric] = imfindcircles(img,[30 100]);
img_labeled(1:size(img,1),1:size(img,2))=0;
for i=1:size(centers,1)
for j=1:size(img,1)
for k=1:size(img,2)
d=sqrt( (j-centers(i,2)).^2 + (k-centers(i,1)).^2);
if(d<=radii(i))
img_labeled(j,k)=i;
end
end
end
end
figure(2)
imshow(img_labeled)
drawnow
  6 Comments
poonam
poonam on 3 Jan 2016
Thank you harjeet, 'watershed' function suggested by @Image Analysis worked perfectly well in my problem. Now I can extract these object individual.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by