欢迎来到传世资源站!
加载中...
正在加载,请耐心等待...
本站为收藏、学习站,如有侵权,请联系管理员删除!

计算机视觉 opencv 数数.ipynb

介绍 评论 失效链接反馈

智能计数计算机视觉 opencv 物体数数.ipynb 计算机视觉  opencv 数数.ipynb Python-第1张 import cv2import imutils
image = cv2.imread("D:/jupyter  file/image/29.png")
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
blurred = cv2.GaussianBlur(gray, (3, 3), 0)
edged = cv2.Canny(blurred, 50, 130)
cnts = cv2.findContours(edged.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
cnts = imutils.grab_contours(cnts)
total = 0
for c in cnts:
    if cv2.contourArea(c) < 25:                         #这个值要调参数
        continue
    cv2.drawContours(image, [c], -1, (204, 0, 255), 2)
    total = 1
print("[INFO] found {} shapes".format(total))
cv2.imshow("Image", image)
cv2.waitKey(0)
cv2.waitKey(0)
cv2.destroyAllWindows()

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复