基本信息
源码名称:计算机视觉 opencv 数数.ipynb
源码大小:0.07M
文件格式:.ipynb
开发语言:Python
更新时间:2020-09-29
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍

智能计数

计算机视觉 opencv 物体数数.ipynb

import cv2

import 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()