Contour Detection Python Code Using Functions And Formulas