object counting algorithm, recursive component labeling algorithm for binary images