import cv2
cap = cv2.VideoCapture(0)
i = 0
try:
while True:
ret, frame =cap.read()
cv2.imshow('Local Camera', frame)
k = cv2.waitKey(1)
if (k == ord("q")):
break
elif(k == ord("k")):
# ret, frame = cap.read()
cv2.imwrite("/home/ucar/photo_wj/photo/" + str(i) + ".jpg", frame)
i = i + 1
print("Ok")
except:
cap.release()
cv2.destroyAIWindows()
opencv拍照并保存
最新推荐文章于 2023-10-27 19:49:44 发布