标签:port gray release des rtsp top while ace ram
import cv2
import dlib
import json
face_detector = dlib.get_frontal_face_detector()
cap = cv2.VideoCapture("rtsp://admin:123@192.168.0.244:554/h264/ch6/main/av_stream")
face_cascade = cv2.CascadeClassifier(‘haarcascade_frontalface_default.xml‘)
ret,frame = cap.read()
while ret:
ret,frame = cap.read()
#frame = cv2.imread(‘r.jpg‘)
cv2.imshow("frame",frame)
gray = frame#cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
faces=face_detector(gray)
# print faces
for i in faces:
#print i.left(),i.right()
f=gray[i.top()-20: i.bottom()+20 , i.left()-20 : i.right()+20,:]
cv2.imshow(‘face‘,f)
#cv2.imwrite(‘2.jpg‘,f)
if cv2.waitKey(1) & 0xFF == ord(‘q‘):
break
cv2.destroyAllWindows()
cap.release()
标签:port gray release des rtsp top while ace ram
原文地址:https://www.cnblogs.com/ahuo/p/10031787.html