From 0a76d0099e8ff79b27b2419294ff6506a614759a Mon Sep 17 00:00:00 2001 From: glmdev Date: Sun, 10 Feb 2019 01:44:46 -0600 Subject: [PATCH] default res --- .idea/workspace.xml | 13 +++++++++---- camera.py | 29 +++++++++-------------------- 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 8105924..6e28112 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -32,8 +32,8 @@ - - + + @@ -41,6 +41,11 @@ + + + + + @@ -277,8 +282,8 @@ - - + + diff --git a/camera.py b/camera.py index cf70fe9..895a232 100644 --- a/camera.py +++ b/camera.py @@ -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'