OpenCV Assertion failed: (-215:Assertion failed) npoints >= 0 && (depth == CV_32F || depth == CV_32S)

前端 未结 6 1009
天命终不由人
天命终不由人 2020-12-10 15:34

I have found the following code on this website:

import os
import os.path
import cv2
import glob
import imutils
CAPTCHA_IMAGE_FOLDER = \"generated_captcha_im         


        
6条回答
  •  生来不讨喜
    2020-12-10 15:49

    In OpenCV4, cv2.findContours has only 2 return values. Contours being the FIRST value

    contours, _ = cv2.findContours(thresh.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
    

    Note that I added underscore to let go of the other return value of hierarchy

提交回复
热议问题