https://nuclearrambo.com/wordpress/count-number-objects-image-using-matlab/
Count number of objects in an image using Matlab