1 | initial version |
You can do the following:
find contours on this image, which is already binarized with black background so it's ready for contouring (https://docs.opencv.org/3.3.1/d4/d73/tutorial_py_contours_begin.html)
for each contour there are APIs to calculate perimeter, area and center of mass (moments) https://docs.opencv.org/3.3.1/dd/d49/tutorial_py_contour_features.html
Of course you will easily be able to count contours