cnts = cv2.findContours(edged_image.copy(), cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)
cnts = cnts[0] if imutils.is_cv2() else cnts[1]
cnts = sorted(cnts, key=cv2.contourArea, reverse=True)[:5]


报错:
  OpenCV(4.1.1) error: (-215:Assertion failed) npoints >= 0 && (depth == CV_32F || depth == CV_32S) in function 'cv::contourArea'

解决方法:
  这里的操作有误:
  cnts = cnts[0] if imutils.is_cv2() else cnts[1]
  如果你仍然想使用它, 你可以将它改为:
  cnts = cnts[1] if imutils.is_cv3() else cnts[0]

相关文章:

  • 2022-02-02
  • 2021-11-10
  • 2021-09-19
  • 2022-02-21
  • 2021-12-24
  • 2021-08-31
  • 2021-06-25
  • 2022-12-23
猜你喜欢
  • 2021-06-27
  • 2021-08-02
  • 2022-12-23
  • 2022-12-23
  • 2021-04-08
  • 2021-09-24
相关资源
相似解决方案