0

导入简历2

将 numpy 导入为 np

将 matplotlib 导入为 mp

image=cv2.imread('D:\instagramphotos\IMG_2012.jpg')

图像=cv2.resize(图像,(700,500))

imgrey=cv2.cvtColor(图像,cv2.COLOR_BGR2GRAY)

ret,thresh=cv2.threshold(imgrey,200,255,0)

计数器,层次结构=cv2.findContours(阈值,cv2.RETR_TREE,cv2.CHAIN_APPROX_NONE)

print("计数器编号:", len(counter))

cv2.drawContours(imgrey,thresh,-1,(255,0,0),3)

cv2.drawContours(imgrey,thresh,-1,(255,0,0),3)

cv2.error: OpenCV(4.5.4-dev) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\drawing.cpp:2501: error: (-215:Assertion failed) npoints >函数'cv :: drawContours'中的0

4

0 回答 0