Skip to content
Ivmech Mechatronics Innovation Ltd edited this page Dec 21, 2015 · 4 revisions

Sample python script ivport_capture_sequence_A.py is capable of capturing a sequence of images extremely rapidly (the closest approach to simultaneous capturing) by utilizing its video-capture capabilities with a JPEG encoder (via the use_video_port parameter). However, there are several things to note about using this technique:

  • When using video-port based capture only the video recording area is captured; in some cases this may be smaller than the normal image capture area.
  • No Exif information is embedded in JPEG images captured through the video-port.
  • Captures typically appear “grainier” with this technique. Captures from the still port use a slower, more intensive denoise algorithm.

All capture methods support the use_video_port option, but the methods differ in their ability to rapidly capture sequential frames. So, whilst capture() and capture_continuous() both support use_video_port, capture_sequence() is by far the fastest method (because it does not re-initialize an encoder prior to each capture). Using this method,has managed 90fps JPEG captures at a resolution of 640x480.

Before using it, required dependencies python-rpi.gpio and picamera have to be installed with sudo apt-get install python-rpi.gpio picamera command from the Terminal.

...
with picamera.PiCamera() as camera:
    camera.resolution = (640, 480)
    camera.framerate = 90
    camera.start_preview()
    time.sleep(2)    # Camera Initialize
    camera.capture_sequence(['image%02d.jpg' % i for i in range(frames)], use_video_port=True)
...

Starting Capture Sequence with Switching

Therefore it can be started with sudo python ivport_capture_sequence_A.py from the Terminal;

It ends with Captured 90 frames at total 28.78fps

Youtube video of stereo recording with 2 camera modules

IVPort Stereo Recording

The closest approach to simultaneous capturing at 7fps with each camera connected to Ivport Camera Multiplexer.

capture sequence ivport simultaneous

Notes About Capture Sequence

90 frames can not be captured at 90fps. There should be some delay while camera switching for SD Card bandwidth limit correction. This correction occurs approximately 28fps with 4 camera switching, and it is equal to 7fps for each camera capture. The major issue with capturing this rapidly is firstly that the Raspberry Pi’s IO bandwidth is extremely limited and secondly that, as a format, JPEG is considerably less efficient than the H.264 video format (which is to say that, for the same number of bytes, H.264 will provide considerably better quality over the same number of frames). At higher resolutions (beyond 800x600) you are likely to find you cannot sustain 30fps captures to the Pi’s SD card for very long (before exhausting the disk cache). However, if you can perform your processing fast enough with low level programming or other approaches, you may not need to involve the disk or network at all.