daily pastebin goal
16%
SHARE
TWEET

Untitled

a guest Jan 20th, 2018 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import cv2
  2. import numpy
  3. img = cv2.imread('imgpp.png')
  4. grayImg = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
  5. blurImg = cv2.GaussianBlur(grayImg,(5,5),0)
  6.  
  7. #cv2.imshow('image',img)
  8. #cv2.waitKey(0)
  9.  
  10. cnts = cv2.findContours(blurImg, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)[0]
  11. cv2.drawContours(img, cnts,1,(255,0,0),3);
  12. print(len(cnts))
  13.    
  14. OpenCV Error: Assertion failed (npoints > 0) in cv::drawContours, file C:projectsopencv-pythonopencvmodulesimgprocsrcdrawing.cpp, line 2506
  15.     cv2.drawContours(img, cnts,1,(255,0,0),3);
  16. cv2.error: C:projectsopencv-pythonopencvmodulesimgprocsrcdrawing.cpp:2506: error: (-215) npoints > 0 in function cv::drawContours
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top