diff --git a/08人脸录入.py b/08人脸录入.py new file mode 100644 index 0000000..e362622 --- /dev/null +++ b/08人脸录入.py @@ -0,0 +1,23 @@ +#导入cv模块 +import cv2 +#读取摄像头 +cap = cv2.VideoCapture(0) +#cap = cv.VideoCapture("output/1.mp4") + +falg = 1 +num = 1 + +while(cap.isOpened()):#检测是否在开启状态 + ret_flag,Vshow = cap.read()#得到每帧的图像 + cv2.imshow('Capture_Test',Vshow) + k = cv2.waitKey(1) & 0xFF#按键判断 + if k == ord('s'):#保存 + cv2.imwrite('E:/pythonProject/output'+str(num)+'.name'+'.jpg',Vshow) + print("success to save"+str(num)+".jpg") + print("----------------") + num += 1 + elif k == ord(' '):#退出 + break +#释放摄像头 +cap.release() +cv2.destroyAllWindows() #删除所以窗口 \ No newline at end of file diff --git a/pic/1.mp4 b/pic/1.mp4 new file mode 100644 index 0000000..2af53e2 Binary files /dev/null and b/pic/1.mp4 differ