Ai
1 Star 1 Fork 0

小鱼儿灬/opencv_python

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
faceTest1.py 571 Bytes
一键复制 编辑 原始数据 按行查看 历史
小鱼儿灬 提交于 2018-12-01 21:11 +08:00 . 人脸识别
import cv2
detector = cv2.CascadeClassifier('haarcascades/haarcascade_frontalface_alt2.xml')
cap = cv2.VideoCapture(0)
cv2.waitKey(0)
while True:
ret, img = cap.read()
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
faces = detector.detectMultiScale(gray, 1.3, 5)
for (x, y, w, h) in faces:
cv2.rectangle(img, (x, y), (x + w, y + h), (255, 0, 0), 2)
cv2.namedWindow("frame", 0);
cv2.resizeWindow("frame", 640, 480);
cv2.imshow('frame', img)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/dxh_git/opencv_python.git
git@gitee.com:dxh_git/opencv_python.git
dxh_git
opencv_python
opencv_python
master

搜索帮助