default res

This commit is contained in:
glmdev 2019-02-10 01:44:46 -06:00
parent 5a8940da7b
commit 0a76d0099e
2 changed files with 18 additions and 24 deletions

View File

@ -32,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="240">
<caret line="16" column="29" selection-start-line="16" selection-start-column="29" selection-end-line="16" selection-end-column="29" />
<state relative-caret-position="75">
<caret line="5" column="65" selection-start-line="5" selection-start-column="65" selection-end-line="5" selection-end-column="65" />
<folding>
<element signature="e#0#13#0" expanded="true" />
</folding>
@ -41,6 +41,11 @@
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/capture.jpg">
<provider selected="true" editor-type-id="images" />
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/.gitignore">
<provider selected="true" editor-type-id="text-editor">
@ -277,8 +282,8 @@
</entry>
<entry file="file://$PROJECT_DIR$/camera.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="240">
<caret line="16" column="29" selection-start-line="16" selection-start-column="29" selection-end-line="16" selection-end-column="29" />
<state relative-caret-position="75">
<caret line="5" column="65" selection-start-line="5" selection-start-column="65" selection-end-line="5" selection-end-column="65" />
<folding>
<element signature="e#0#13#0" expanded="true" />
</folding>

View File

@ -2,27 +2,16 @@ import pygame
import pygame.camera
import time
import cv2
from SimpleCV import Image, Camera
def capture(camera_stream = 0, camera_res = (1920, 1080)):
# cam = cv2.VideoCapture(camera_stream)
# s, img = cam.read()
#
# if s:
# cv2.imwrite('./capture.jpg', img)
cam = Camera()
img = cam.getImage()
img.save('./capture.jpg')
# 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()
def capture(camera_stream = "/dev/video0", camera_res = (640, 480)):
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()
return './capture.jpg'