fix camera timing
This commit is contained in:
parent
633e728141
commit
a0ce12ba0b
@ -2,7 +2,6 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="f410c5c2-3ffe-4260-93eb-e3d83256d263" name="Default Changelist" comment="">
|
<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" />
|
<change beforePath="$PROJECT_DIR$/camera.py" beforeDir="false" afterPath="$PROJECT_DIR$/camera.py" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||||
@ -33,8 +32,8 @@
|
|||||||
<file pinned="false" current-in-tab="true">
|
<file pinned="false" current-in-tab="true">
|
||||||
<entry file="file://$PROJECT_DIR$/camera.py">
|
<entry file="file://$PROJECT_DIR$/camera.py">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="105">
|
<state relative-caret-position="75">
|
||||||
<caret line="7" column="57" lean-forward="true" selection-start-line="7" selection-start-column="57" selection-end-line="7" selection-end-column="57" />
|
<caret line="5" column="40" selection-start-line="5" selection-start-column="40" selection-end-line="5" selection-end-column="40" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="e#0#13#0" expanded="true" />
|
<element signature="e#0#13#0" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
@ -278,8 +277,8 @@
|
|||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/camera.py">
|
<entry file="file://$PROJECT_DIR$/camera.py">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="105">
|
<state relative-caret-position="75">
|
||||||
<caret line="7" column="57" lean-forward="true" selection-start-line="7" selection-start-column="57" selection-end-line="7" selection-end-column="57" />
|
<caret line="5" column="40" selection-start-line="5" selection-start-column="40" selection-end-line="5" selection-end-column="40" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="e#0#13#0" expanded="true" />
|
<element signature="e#0#13#0" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
import pygame
|
import pygame
|
||||||
import pygame.camera
|
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.init()
|
||||||
pygame.camera.list_cameras()
|
pygame.camera.list_cameras()
|
||||||
cam = pygame.camera.Camera(camera_stream, camera_res)
|
cam = pygame.camera.Camera(camera_stream, camera_res)
|
||||||
cam.start()
|
cam.start()
|
||||||
|
time.sleep(5)
|
||||||
img = cam.get_image()
|
img = cam.get_image()
|
||||||
pygame.image.save(img, './capture.jpg')
|
pygame.image.save(img, './capture.jpg')
|
||||||
cam.stop()
|
cam.stop()
|
||||||
|
Loading…
Reference in New Issue
Block a user