Commits

slmgc  committed fd20b2c

Removed platform specific code. Added camera's framerate setting.

  • Participants
  • Parent commits c0663d1

Comments (0)

Files changed (3)

File app/config.py

-revision = '20120909'
-platform = None
-
 class window(object):
 	title = 'AR example'
 	size = (640, 480)
 	rel = ['data', 'libs']
 
 class camera(object):
-	size = (320, 240)
+	size = (640, 480)
+	framerate = 50

File app/webcam.py

 			pg.camera.init()
 			cams = pygame.camera.list_cameras()
 			if cams:
-				if config.platform == 'Windows':
+				try:
+					self.camera = pg.camera.Camera(
+						cams[0], config.camera.size, 'RGB')
+				except:
 					config.camera.size = (640, 480)
-				self.camera = pg.camera.Camera(
-					cams[0], config.camera.size, 'RGB')
+					self.camera = pg.camera.Camera(
+						cams[0], config.camera.size, 'RGB')
 				self.camera.start()
 				self.workers.append(Thread(target=self.capture))
 				self.run()
 
 	def capture(self):
 		snapshot = Surface(config.camera.size)
-		framerate = config.window.framerate
+		framerate = config.camera.framerate
 		timer = pg.time.Clock()
 		while self.running:
 			self.camera.get_image(snapshot)
 import os
 import sys
-import platform
 from app import App
 import app.config as config
 
 
 if __name__ == '__main__':
-	config.platform = platform.system()
 	config.path.root = (os.path.join(
 		os.path.dirname(__file__),
 		config.path.root