1import cv2
2import numpy as np
3
4img=cv2.imread('test.png') #read image
5gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) #turn image to gray
6blur = cv2.GaussianBlur(gray,(3,3),0) #add blur
7edges = cv2.Canny(blur,50,100) #find edges
8
9contours, hierarchy = cv2.findContours(edges,cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) #find contours
10cv2.drawContours(img,contours,-1,(0,255,0),2) #draw contours
11cv2.imshow('Contours in Green',img) #show contours in green
12
13#Now you need to sort them out.
14