This script counts the amount of contours of an object.
To compute only outlines of objects, it fills the transparent holes of an object with white color and computes afterwards the contours.
Normally an object should only contain a single contour. If multiple objects are visible on the image, more contours appear.