fix capture.py, add imago-camera, imago-timer
authorTomas Musil <tomik.musil@gmail.com>
Tue, 22 Jul 2014 11:05:50 +0000 (13:05 +0200)
committerTomas Musil <tomik.musil@gmail.com>
Tue, 22 Jul 2014 11:05:50 +0000 (13:05 +0200)
imago-camera [new file with mode: 0755]
imago-timer [new file with mode: 0755]
src/capture.py
src/timer.py

diff --git a/imago-camera b/imago-camera
new file mode 100755 (executable)
index 0000000..035b8f5
--- /dev/null
@@ -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 (executable)
index 0000000..f1f41c6
--- /dev/null
@@ -0,0 +1,7 @@
+#!/usr/bin/env python
+
+"""Go image recognition."""
+
+from src import timer
+
+timer.main()
index dd7f47f..b9563ff 100755 (executable)
@@ -53,7 +53,8 @@ class Capture:
     def live(self, q):
         """Run live preview on the screen."""
         clock = pygame.time.Clock()
     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)
             if q:
                 try:
                     line = q.get_nowait() # or q.get(timeout=.1)
@@ -80,7 +81,8 @@ class Capture:
         last = 0
         clock = pygame.time.Clock()
 
         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
             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."""
             
     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')
         im = self.cam.get_image()
         self.screen.display_picture(im)
         im.save(self.saving_dir + "{0:0>3}.jpg".format(self.im_number), 'JPEG')
index 2419563..e26bef1 100755 (executable)
@@ -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:
     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
                           str(args.r[0]),
                           str(args.r[1])], stdin=subprocess.PIPE)
     last = 0