MATLAB: How to count big cell only

count big cells

I have image with different cell size but I want Count the number of big cells only!!
I try this code:
A = imread ('cell.png');
level=graythresh(A);
I=im2bw(A,level);
[labeled,numObjects]=bwlabel(I,4)
numObjects = 26

Best Answer

use bwareaopen to remove objects smaller than certain number of pixels.
BW2 = bwareaopen(BW, thresh);
[~, numObjects] = bwlabel(BW2,4);