How can I use morphological methods to count the number of cells ??

1 view (last 30 days)
Hi ,
I have the following image ....
I want to Use morphological methods to count the number of different size cells.
Can any one help ??
Thx
  3 Comments
Christine Ak
Christine Ak on 7 Dec 2013
thx for reply , actually yeah I want to find the number of the circles
Belal Arar
Belal Arar on 18 May 2016
a=imread('C:\Users\Belal Arar\Desktop\cells_imag.bmp'); [a1 a2 a3]=size(a); %a=reshape(double(a),a1*a3,a2); x=[1 -2 1]; y=[1;-2;1;]; gx=filter2(x,a); gy=filter2(y,a); g=sqrt(gx.^2+gy.^2); [r c]=bwlabel(g,4); %c is the number of cells % r is a matrix "the same size of the original image o1=[r==1]; imshow(o1); %show cell 1 o2=[r==2]; figure imshow(o2);%show cell 2 o3=[r==3]; figure imshow(o3);%show cell 3 o4=[r==4]; figure imshow(o4);%show cell 4 o5=[r==5]; figure imshow(o5);%show cell 5 o6=[r==6]; figure imshow(o6);%show cell 6 o7=[r==7]; figure imshow(o7);%show cell 7 o8=[r==8]; figure imshow(o8);%show cell 8 o9=[r==9]; figure imshow(o9);%show cell 9 o10=[r==10]; figure imshow(o10);%show cell 10 o11=[r==11]; figure imshow(o11);%show cell 11 o12=[r==12]; figure imshow(o12);%show cell 12 o13=[r==13]; figure imshow(o13);%show cell 13 o14=[r==14]; figure imshow(o14);%show cell 14 o15=[r==15]; figure imshow(o15);%show cell 15 o16=[r==16]; figure imshow(o16);%show cell 16 o17=[r==17]; figure imshow(o17);%show cell 17

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 7 Dec 2013
Don't know why it has to be morphological methods, but you could if you want (not how I'd do it). But you could do something like
numberOfRegions = sum(bwulterode(binaryImage));
  3 Comments
Image Analyst
Image Analyst on 7 Dec 2013
Edited: Image Analyst on 7 Dec 2013
bwulterode() is a morphological method. By the way, you were supposed to tag it as homework, so as to be honest. As it is, I just did your homework for you, which is against forum norms. I tagged it homework for you just now.
Christine Ak
Christine Ak on 11 Dec 2013
actually I didn't know that before (( tagging as homework)) , Sorry Thxx By the way ^_^

Sign in to comment.

More Answers (1)

Belal Arar
Belal Arar on 18 May 2016
a=imread('C:\Users\Belal Arar\Desktop\cells_imag.bmp'); [a1 a2 a3]=size(a); %a=reshape(double(a),a1*a3,a2); x=[1 -2 1]; y=[1;-2;1;]; gx=filter2(x,a); gy=filter2(y,a); g=sqrt(gx.^2+gy.^2); [r c]=bwlabel(g,4); %c is the number of cells % r is a matrix "the same size of the original image o1=[r==1]; imshow(o1); %show cell 1 o2=[r==2]; figure imshow(o2);%show cell 2 o3=[r==3]; figure imshow(o3);%show cell 3 o4=[r==4]; figure imshow(o4);%show cell 4 o5=[r==5]; figure imshow(o5);%show cell 5 o6=[r==6]; figure imshow(o6);%show cell 6 o7=[r==7]; figure imshow(o7);%show cell 7 o8=[r==8]; figure imshow(o8);%show cell 8 o9=[r==9]; figure imshow(o9);%show cell 9 o10=[r==10]; figure imshow(o10);%show cell 10 o11=[r==11]; figure imshow(o11);%show cell 11 o12=[r==12]; figure imshow(o12);%show cell 12 o13=[r==13]; figure imshow(o13);%show cell 13 o14=[r==14]; figure imshow(o14);%show cell 14 o15=[r==15]; figure imshow(o15);%show cell 15 o16=[r==16]; figure imshow(o16);%show cell 16 o17=[r==17]; figure imshow(o17);%show cell 17

Community Treasure Hunt

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

Start Hunting!