working contour detection