Contour Detection Python Code Using Numpy