implementation of linear-time component-labeling algorithm using contour tracing technique