Fixing the camera 6

pull/1/head
Julius Riegel 7 years ago
parent 73e37c0c84
commit ae22100db9

@ -41,8 +41,8 @@
<file leaf-file-name="graphiclib.py" pinned="false" current-in-tab="true"> <file leaf-file-name="graphiclib.py" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/lib/graphiclib.py"> <entry file="file://$PROJECT_DIR$/lib/graphiclib.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="474"> <state relative-caret-position="491">
<caret line="86" column="64" lean-forward="false" selection-start-line="86" selection-start-column="64" selection-end-line="86" selection-end-column="64" /> <caret line="87" column="70" lean-forward="false" selection-start-line="87" selection-start-column="70" selection-end-line="87" selection-end-column="70" />
<folding> <folding>
<element signature="e#0#28#0" expanded="true" /> <element signature="e#0#28#0" expanded="true" />
</folding> </folding>
@ -493,8 +493,8 @@
</entry> </entry>
<entry file="file://$PROJECT_DIR$/lib/graphiclib.py"> <entry file="file://$PROJECT_DIR$/lib/graphiclib.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="474"> <state relative-caret-position="491">
<caret line="86" column="64" lean-forward="false" selection-start-line="86" selection-start-column="64" selection-end-line="86" selection-end-column="64" /> <caret line="87" column="70" lean-forward="false" selection-start-line="87" selection-start-column="70" selection-end-line="87" selection-end-column="70" />
<folding> <folding>
<element signature="e#0#28#0" expanded="true" /> <element signature="e#0#28#0" expanded="true" />
</folding> </folding>

@ -73,8 +73,9 @@ class PiCamera(pygame.sprite.Sprite):
pygame.sprite.Sprite.__init__(self) pygame.sprite.Sprite.__init__(self)
pygame.camera.init() pygame.camera.init()
camera = picamera.PiCamera() camera = picamera.PiCamera()
camera.resolution = (1280/2, 720/2)
self.camera = camera self.camera = camera
self.output = picamera.array.PiRGBArray(camera, size=size) self.output = picamera.array.PiRGBArray(camera, size=(1280/2, 720/2))
self.size = size self.size = size
self.image = pygame.Surface(self.size) self.image = pygame.Surface(self.size)
self.image.fill((0, 0, 0)) self.image.fill((0, 0, 0))
@ -84,6 +85,6 @@ class PiCamera(pygame.sprite.Sprite):
def update(self, *args): def update(self, *args):
print('updating camera') print('updating camera')
self.output.truncate(0) self.output.truncate(0)
self.camera.capture(self.output, 'rgb', resize=self.size) self.camera.capture(self.output, 'rgb', resize=(1280/2, 720/2))
s = pygame.transform.rotate(pygame.surfarray.make_surface(self.output.array), 90) s = pygame.transform.rotate(pygame.surfarray.make_surface(self.output.array), 90)
self.image.blit(s, (0, 0)) self.image.blit(s, (0, 0))
Loading…
Cancel
Save