Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

Contour approximation not working correctly

$
0
0
I have a white circle with black lines going from either side(as shown in the picture). The problem is that when I use the contour approx method, it just outputs points around the image. rather than a whole complete circle GNU nano 2.2.6 File: test.py Modified import cv2 img = cv2.imread("circ.jpeg") canny = cv2.Canny(img,150,300) ima,cnts,hie= cv2.findContours(canny,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE) cnt = cnts[0] epsilon = 0.1*cv2.arcLength(cnt,True) approx = 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 image of the circle.](/upfiles/14483747608602505.jpeg) ![This is how it comes.](/upfiles/14483748282490229.png)

Viewing all articles
Browse latest Browse all 41027

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>