龙华区城市建设局网站,上海由多少家网站建设公司,河北二级建造师考试最新消息,黄的网站建设本次在图片识别的程度上增添了视频识别
原理就是在图片的基础上进行操作 每毫秒进行下一帧的人脸解析识别#xff0c;时间可自行设置 import numpy as np
import cv2win cv2.namedWindow(dzd,cv2.WINDOW_NORMAL)
cv2.resizeWindow(dzd,640,200)
rose cv2.imread(./rose.jp…本次在图片识别的程度上增添了视频识别
原理就是在图片的基础上进行操作 每毫秒进行下一帧的人脸解析识别时间可自行设置 import numpy as np
import cv2win cv2.namedWindow(dzd,cv2.WINDOW_NORMAL)
cv2.resizeWindow(dzd,640,200)
rose cv2.imread(./rose.jpg)
cv2.imshow(dzd,rose)
cv2.waitKey(0)
cv2.destroyWindow(dzd)# v cv2.VideoCapture(./dzd2.mp4)
face_detector cv2.CascadeClassifier(./haarcascade_frontalface_alt2.xml)
# 视频是由一张张图片组成每一张图片帧
while True:flag,frame v.read()if not flag:break
# frame cv2.resize(frame,(640,360))gray cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY)face_zones face_detector.detectMultiScale(gray,scaleFactor 1.1,minNeighbors 3)for x,y,w,h in face_zones:cv2.rectangle(frame,pt1 (x,y),pt2 (xw,yh),color [0,0,255],thickness2)cv2.imshow(dzd,frame)key cv2.waitKey(1)if key ord(q):break
v.release()#释放视频流
cv2.destroyAllWindows()