findContours not working properply
I am using findContours on a simple white circle i created on a paint application with a black back ground. The problem is that while the tutorials tell me that there should be only one contour surrounding that circle, when i output the contours, there are 2 different points.
Due to this reason, i am not able to use contour approx method.
Can anyone help me with this?
Thanks in Advance!
http://codepad.org/0UIGzcYO <- This is the code
http://postimg.org/image/k8sbwdnkv/0d008450/ <- This is the image i am using for the contour import cv2
import numpy as np
img = cv2.imread("url.png")
canny = cv2.Canny(img,0,0)
imgs,cnts,hie = cv2.findContours(canny,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
cv2.namedWindow("img",cv2.WINDOW_NORMAL)
cnt = cnts[1]
epsilon = 0.1*cv2.arcLength(cnt,True)
approx method
http://postimg.org/image/51gxprl3z/fb8cb208/ <- = cv2.approxPolyDP(cnt,epsilon,True)
cv2.drawContours(img,approx,-1,(0,255,0),3)
cv2.imshow("img",img)
cv2.waitKey(0)
cv2.destroyAllWindows()
This is the original image
image(/upfiles/14483724218429244.png)
This is the editied image for approximation(/upfiles/14483724673701482.png)