Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import cv2
- import numpy
- img = cv2.imread('imgpp.png')
- grayImg = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
- blurImg = cv2.GaussianBlur(grayImg,(5,5),0)
- #cv2.imshow('image',img)
- #cv2.waitKey(0)
- cnts = cv2.findContours(blurImg, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)[0]
- cv2.drawContours(img, cnts,1,(255,0,0),3);
- print(len(cnts))
- OpenCV Error: Assertion failed (npoints > 0) in cv::drawContours, file C:projectsopencv-pythonopencvmodulesimgprocsrcdrawing.cpp, line 2506
- cv2.drawContours(img, cnts,1,(255,0,0),3);
- cv2.error: C:projectsopencv-pythonopencvmodulesimgprocsrcdrawing.cpp:2506: error: (-215) npoints > 0 in function cv::drawContours
Add Comment
Please, Sign In to add comment