fix camera resolution

This commit is contained in:
glmdev 2019-02-10 00:28:42 -06:00
parent b39236bcb1
commit 633e728141
2 changed files with 16 additions and 18 deletions

View File

@ -2,10 +2,8 @@
<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" />
<change beforePath="$PROJECT_DIR$/capture.jpg" beforeDir="false" afterPath="$PROJECT_DIR$/capture.jpg" afterDir="false" />
<change beforePath="$PROJECT_DIR$/index.py" beforeDir="false" afterPath="$PROJECT_DIR$/index.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ref-img.jpg" beforeDir="false" afterPath="$PROJECT_DIR$/ref-img.jpg" afterDir="false" />
</list> </list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
@ -35,8 +33,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="165"> <state relative-caret-position="105">
<caret line="11" column="14" selection-start-line="11" selection-start-column="14" selection-end-line="11" selection-end-column="14" /> <caret line="7" column="57" lean-forward="true" selection-start-line="7" selection-start-column="57" selection-end-line="7" selection-end-column="57" />
<folding> <folding>
<element signature="e#0#13#0" expanded="true" /> <element signature="e#0#13#0" expanded="true" />
</folding> </folding>
@ -183,7 +181,7 @@
<frame x="0" y="27" width="1920" height="1053" extended-state="6" /> <frame x="0" y="27" width="1920" height="1053" extended-state="6" />
<editor active="true" /> <editor active="true" />
<layout> <layout>
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.18133895" /> <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.18133895" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" /> <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info id="Favorites" order="2" side_tool="true" /> <window_info id="Favorites" order="2" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" /> <window_info anchor="bottom" id="Message" order="0" />
@ -194,7 +192,7 @@
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" /> <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="6" /> <window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="bottom" id="Version Control" order="7" /> <window_info anchor="bottom" id="Version Control" order="7" />
<window_info anchor="bottom" id="Terminal" order="8" weight="0.32972974" /> <window_info active="true" anchor="bottom" id="Terminal" order="8" visible="true" weight="0.32972974" />
<window_info anchor="bottom" id="Python Console" order="9" /> <window_info anchor="bottom" id="Python Console" order="9" />
<window_info anchor="bottom" id="Event Log" order="10" side_tool="true" /> <window_info anchor="bottom" id="Event Log" order="10" side_tool="true" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" /> <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
@ -230,13 +228,6 @@
<entry file="file://$PROJECT_DIR$/lib/test-images/lot-5-cars-B.jpg"> <entry file="file://$PROJECT_DIR$/lib/test-images/lot-5-cars-B.jpg">
<provider selected="true" editor-type-id="images" /> <provider selected="true" editor-type-id="images" />
</entry> </entry>
<entry file="file://$PROJECT_DIR$/image_tools.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="45">
<caret line="3" column="23" selection-start-line="3" selection-start-column="23" selection-end-line="3" selection-end-column="23" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/config.py"> <entry file="file://$PROJECT_DIR$/config.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="75"> <state relative-caret-position="75">
@ -278,10 +269,17 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/image_tools.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="45">
<caret line="3" column="23" selection-start-line="3" selection-start-column="23" selection-end-line="3" selection-end-column="23" />
</state>
</provider>
</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="165"> <state relative-caret-position="105">
<caret line="11" column="14" selection-start-line="11" selection-start-column="14" selection-end-line="11" selection-end-column="14" /> <caret line="7" column="57" lean-forward="true" selection-start-line="7" selection-start-column="57" selection-end-line="7" selection-end-column="57" />
<folding> <folding>
<element signature="e#0#13#0" expanded="true" /> <element signature="e#0#13#0" expanded="true" />
</folding> </folding>

View File

@ -2,10 +2,10 @@ import pygame
import pygame.camera import pygame.camera
def capture(camera_stream = "/dev/video4"): def capture(camera_stream = "/dev/video4", camera_res = (1920, 1080)):
pygame.camera.init() pygame.camera.init()
pygame.camera.list_cameras() pygame.camera.list_cameras()
cam = pygame.camera.Camera(camera_stream, (640, 480)) cam = pygame.camera.Camera(camera_stream, camera_res)
cam.start() cam.start()
img = cam.get_image() img = cam.get_image()
pygame.image.save(img, './capture.jpg') pygame.image.save(img, './capture.jpg')