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?

  • See my comment below this question; this is due to the way still port captures work. You can try using --burst mode with --signal for a shorter time between captures. With that, you might get to 100ms between captures (bearing in mind still port captures require at least 3 frame's worth of time). Otherwise, you'll need to resort to video recording.
    – Dave Jones
    Commented Oct 18, 2015 at 8:02
  • Possible duplicate of Raspistill slow to trigger?
    – nu everest
    Commented May 8, 2017 at 5:11

1 Answer 1


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.

  • 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. Commented Aug 21, 2016 at 12:17
  • Thank you for your comment, you are right. I have removed the time it takes from my original text.
    – NDB
    Commented Aug 24, 2016 at 20:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.