How can I use morphological methods to count the number of cells ??
조회 수: 1 (최근 30일)
이전 댓글 표시
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
Belal Arar
2016년 5월 18일
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
채택된 답변
Image Analyst
2013년 12월 7일
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
Image Analyst
2013년 12월 7일
편집: Image Analyst
2013년 12월 7일
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.
추가 답변 (1개)
Belal Arar
2016년 5월 18일
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
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!