function W = Counter(img)
imshow(img)

img1=rgb2gray(img);
imshow(img1)

img2=imbinarize(img1,graythresh(img1));
imshow(img2)

img2=~img2;
imshow(img2)

B = bwboundaries(img2);
W = length(B)-1;
end
