uranus4ever / Captcha-Crack

破解验证码 Use CNN to crack Captcha code.
35 stars 8 forks source link

验证码切割报错 #1

Open yanwii opened 5 years ago

yanwii commented 5 years ago

环境: opencv-python 4.0.0.21

错误为:

Traceback (most recent call last):
  File "captcha_generator.py", line 188, in <module>
    letter_image_regions = extract(image, str=captcha_correct_text)
  File "captcha_generator.py", line 79, in extract
    (x, y, w, h) = cv2.boundingRect(contour)
cv2.error: OpenCV(4.0.0) /io/opencv/modules/imgproc/src/shapedescr.cpp:741: error: (-215:Assertion failed) npoints >= 0 && (depth == CV_32F || depth == CV_32S) in function 'pointSetBoundingRect'
Forever22 commented 4 years ago

出错上面的一行代码 contours = contours[0] if imutils.is_cv2() else contours[1] 改成 contours = contours[0]