fix camera timing

This commit is contained in:
glmdev 2019-02-10 00:34:00 -06:00
parent 633e728141
commit a0ce12ba0b
2 changed files with 7 additions and 6 deletions

View File

@ -2,7 +2,6 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="f410c5c2-3ffe-4260-93eb-e3d83256d263" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/camera.py" beforeDir="false" afterPath="$PROJECT_DIR$/camera.py" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@ -33,8 +32,8 @@
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/camera.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="105">
<caret line="7" column="57" lean-forward="true" selection-start-line="7" selection-start-column="57" selection-end-line="7" selection-end-column="57" />
<state relative-caret-position="75">
<caret line="5" column="40" selection-start-line="5" selection-start-column="40" selection-end-line="5" selection-end-column="40" />
<folding>
<element signature="e#0#13#0" expanded="true" />
</folding>
@ -278,8 +277,8 @@
</entry>
<entry file="file://$PROJECT_DIR$/camera.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="105">
<caret line="7" column="57" lean-forward="true" selection-start-line="7" selection-start-column="57" selection-end-line="7" selection-end-column="57" />
<state relative-caret-position="75">
<caret line="5" column="40" selection-start-line="5" selection-start-column="40" selection-end-line="5" selection-end-column="40" />
<folding>
<element signature="e#0#13#0" expanded="true" />
</folding>

View File

@ -1,12 +1,14 @@
import pygame
import pygame.camera
import time
def capture(camera_stream = "/dev/video4", camera_res = (1920, 1080)):
def capture(camera_stream = "/dev/video0", camera_res = (1920, 1080)):
pygame.camera.init()
pygame.camera.list_cameras()
cam = pygame.camera.Camera(camera_stream, camera_res)
cam.start()
time.sleep(5)
img = cam.get_image()
pygame.image.save(img, './capture.jpg')
cam.stop()