当面部不在摄像机前面时,如何控制视频显示? 我的项目是只要有前置摄像头就可以播放电影 但是我的问题是,视频播放完毕后就会显示
for i, face in enumerate(faces):
self.draw_label(frame, (face[0], face[1]), label)
if name='john' :
cap = cv2.VideoCapture('Documents/face/123.mp4')
while faces is not None:
ret, frameo = cap.read()
gray = cv2.cvtColor(frameo,cv2.COLOR_BGR2GRAY)
cv2.imshow('framey',frameo)
cv2.imshow('grayF',gray)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
elif name='matin':
cap = cv2.VideoCapture('Documents/face/mat.mp4')
ret, frameo = cap.read()
gray = cv2.cvtColor(frameo,cv2.COLOR_BGR2GRAY)
cv2.imshow('framey',frameo)
cv2.imshow('grayF',gray)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()