ADDED:applied the OpenCV findContour implementation