A linear-time component-labeling algorithm using contour tracing