python调⽤摄像头⼈脸识别代码_Python使⽤opencv调⽤笔记
头痛最快的缓解方法本摄像头进⾏⼈脸识别...
上代码#万码学堂Python ⼈脸识别演⽰最简单的祝福语一句话
import cv2.cv2 as cv2
face_model=cv2.CascadeClassifier(r'D:\pythonworks\DAdemo\Lib\site-
packages\cv2\data\haarcascade_l')
# 打开摄像头
capcure = cv2.VideoCapture(0)
# 获取摄像头实时画⾯
其实都没有歌词
#    读取摄像头当前这⼀帧的画⾯  ret:True fase image:当前这⼀帧画⾯
cameraCapture = cv2.VideoCapture(0)
支付宝口令
ret, image = ad()
cv2.namedWindow('WanmaitCamera')
while ret:
if cv2.waitKey(1) == 27:#esc退出
break
cv2.imshow('WanmaitCamera', image)
ret, image = ad()
#  图⽚灰度处理
gray = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
# 检查⼈脸
faces = face_model.detectMultiScale(gray, 1.1, 3, 0,(20,20))
#faces = face_model.detectMultiScale(gray,1.1,3,0,(2,2))
font = cv2.FONT_HERSHEY_SIMPLEX
# 标记⼈脸
for (x, y, w, h) in faces:
# 矩形标记
蔡卓妍微博
# 图像,⽂字内容, 坐标 ,字体,⼤⼩,颜⾊,字体厚度
女生竞选部长演讲稿
cv2.putText(image,'wanmait',(int(x+w/2-60),y),font,1,(255,255,255),2)
# 显⽰图⽚
cv2.imshow('WanmaitCamera', image)
ret, image = ad()
运⾏效果: