From 167071ae6decd5355f8c292f84f1a1364f5e3c93 Mon Sep 17 00:00:00 2001 From: Julius Riegel Date: Sat, 13 Jan 2018 17:54:51 +0100 Subject: [PATCH] Fixing the camera 7 Camsize parameter --- .idea/workspace.xml | 8 ++++---- lib/graphiclib.py | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 3972b70..30de114 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -41,8 +41,8 @@ - - + + @@ -493,8 +493,8 @@ - - + + diff --git a/lib/graphiclib.py b/lib/graphiclib.py index 726119f..3840758 100644 --- a/lib/graphiclib.py +++ b/lib/graphiclib.py @@ -73,9 +73,10 @@ class PiCamera(pygame.sprite.Sprite): pygame.sprite.Sprite.__init__(self) pygame.camera.init() camera = picamera.PiCamera() - camera.resolution = (1280/2, 720/2) + self.camsize = (self.size[0], int(self.size[0]/2)) + camera.resolution = self.camsize self.camera = camera - self.output = picamera.array.PiRGBArray(camera, size=(1280/2, 720/2)) + self.output = picamera.array.PiRGBArray(camera, size=self.camsize) self.size = size self.image = pygame.Surface(self.size) self.image.fill((0, 0, 0)) @@ -85,6 +86,6 @@ class PiCamera(pygame.sprite.Sprite): def update(self, *args): print('updating camera') self.output.truncate(0) - self.camera.capture(self.output, 'rgb', resize=(1280/2, 720/2)) + self.camera.capture(self.output, 'rgb', resize=self.camsize) s = pygame.transform.rotate(pygame.surfarray.make_surface(self.output.array), 90) self.image.blit(s, (0, 0)) \ No newline at end of file