feat: 摄像头测试

This commit is contained in:
raiots 2023-06-02 20:59:42 +08:00
parent f80c02e923
commit cef597361b
1 changed files with 18 additions and 0 deletions

18
cvshot.py Normal file
View File

@ -0,0 +1,18 @@
import cv2
# take a photo using cv2
img = cv2.VideoCapture(0)
# img.set(cv2.CAP_PROP_AUTO_EXPOSURE, 0.25)
img.set(cv2.CAP_PROP_AUTO_EXPOSURE, 3) # auto mode
img.set(cv2.CAP_PROP_AUTO_EXPOSURE, 1) # manual mode
img.set(cv2.CAP_PROP_EXPOSURE, 100)
# while True:
ret, frame = img.read()
if ret:
cv2.imwrite('img.png', frame)
img.release()
print('succeed')