6

How do you quickly capture a series of stills programmatically?

I'm testing an image processing task where I need to perform an action between image captures. Essentially, I want to:

  1. Capture a reference image
  2. Turn on a laser diode broadcasting a pattern in front of the camera
  3. Capture second image
  4. Turn off laser diode

I'd like this to happen as fast as possible (preferrably under 100ms), so the laser isn't visible for long. What's the most efficient way to implement this?

I'm currently testing raspistill, and although it works, it's very slow. Even with timeout set to 300, which is as low as I can get it before I start having exposure problems, it still takes 1.3 seconds per frame.

This thread mentions running raspistill with a timeout of 0, which effectively turns it into a daemon, and then you can trigger multiple captures from a separate process with a signal. How well does this work?

Are there other techniques I should try?

Cerin
  • 2,271
  • 7
  • 31
  • 49

1 Answers1

3

I have specified an alias in my .bash_profile to allow for easy and fast camera shots:

alias shot='SHOTTIME=$(date +"%Y-%m-%d_%H%M") && raspistill -o shot-$SHOTTIME.jpg --nopreview --exposure sports --timeout 1

Whenever I type shot on command line, an image with time stamp is saved, for example shot-2016-02-27_0934.jpg.

You could run shot twice, the second run with the laser diode.

NDB
  • 269
  • 3
  • 8
  • 1
    0.040 seconds is unfortunately far to fast to be true.. Measuring time consumed with time shot is flawed, it will actually only measure the time taken to assign the SHOTTIME variable, not capturing the image. The real time is ~1 seconds. – slackhacker Aug 21 '16 at 12:17
  • Thank you for your comment, you are right. I have removed the time it takes from my original text. – NDB Aug 24 '16 at 20:04