From 04c7dfcf51881df1f6a2058c8a74c179ab3aee13 Mon Sep 17 00:00:00 2001 From: Tomas Musil Date: Tue, 22 Jul 2014 13:05:50 +0200 Subject: [PATCH] fix capture.py, add imago-camera, imago-timer --- imago-camera | 7 +++++++ imago-timer | 7 +++++++ src/capture.py | 7 +++++-- src/timer.py | 2 +- 4 files changed, 20 insertions(+), 3 deletions(-) create mode 100755 imago-camera create mode 100755 imago-timer diff --git a/imago-camera b/imago-camera new file mode 100755 index 0000000..035b8f5 --- /dev/null +++ b/imago-camera @@ -0,0 +1,7 @@ +#!/usr/bin/env python + +"""Go image recognition.""" + +from src import capture + +capture.main() diff --git a/imago-timer b/imago-timer new file mode 100755 index 0000000..f1f41c6 --- /dev/null +++ b/imago-timer @@ -0,0 +1,7 @@ +#!/usr/bin/env python + +"""Go image recognition.""" + +from src import timer + +timer.main() diff --git a/src/capture.py b/src/capture.py index dd7f47f..b9563ff 100755 --- a/src/capture.py +++ b/src/capture.py @@ -53,7 +53,8 @@ class Capture: def live(self, q): """Run live preview on the screen.""" clock = pygame.time.Clock() - while True: + done = False + while not done: if q: try: line = q.get_nowait() # or q.get(timeout=.1) @@ -80,7 +81,8 @@ class Capture: last = 0 clock = pygame.time.Clock() - while True: + done = False + while not done: for event in pygame.event.get(): if event.type == pygame.QUIT: done = True @@ -101,6 +103,7 @@ class Capture: def take(self): """Take a new image from the camera.""" + print "taking pic" im = self.cam.get_image() self.screen.display_picture(im) im.save(self.saving_dir + "{0:0>3}.jpg".format(self.im_number), 'JPEG') diff --git a/src/timer.py b/src/timer.py index 2419563..e26bef1 100755 --- a/src/timer.py +++ b/src/timer.py @@ -106,7 +106,7 @@ def main(): timers = (Timer(main_time, args.b[0], args.b[1]), Timer(main_time, args.b[0], args.b[1])) if args.cam: - capture = subprocess.Popen(['python', 'capture.py', '-c', '-d', str(args.d), '-r', + capture = subprocess.Popen(['python', 'src/capture.py', '-c', '-d', str(args.d), '-r', str(args.r[0]), str(args.r[1])], stdin=subprocess.PIPE) last = 0 -- 2.4.2