+
96
-

回答

如果要拍照,代码如下

#!/usr/local/python3/bin/python3
# -*- coding: utf-8 -*
import cv2
import time
time = time.strftime('%Y-%m-%d-%H-%M-%S', time.localtime(time.time()))

cap = cv2.VideoCapture(0)
while(1):
# get a frame
ret, frame = cap.read()
# show a frame
cv2.imshow("capture", frame)
if cv2.waitKey(1):
cv2.imwrite('./face_photo/photo'+time+'.jpeg', frame)
break
cap.release()
cv2.destroyAllWindows()



网友回复

我知道答案,我要回答