Saving stream of jpeg images to SD card


I’m working on a project which involves saving a stream of images to an SD card as jpeg on the OpenMV H7. The camera is expected to take hours of footage at a time, and the hope is that it would be at a high enough frame rate for a machine vision algorithm to be able to look at offline. The goal for now is to try to achieve a consistent 5 fps.

However, what I’ve noticed is that simply using in a loop (sensor taking image resolution QVGA)

img = sensor.snapshot()

tends to cause the framerate to slow down drastically as more images are taken. In my instance, the saving started off at around 5 fps and very quickly after a few minutes dropped down all the way to 1 fps on a 32 Gb SD card. Is there perhaps a better way or some possible optimization for this type of thing?

See the ImageWriter class or the MJPEG class. Both are fine for saving jpeg video. The ImageWriter allows the camera to play back the video stream natively while mjpeg is a standard file format.

Thanks for the quick reply!

I’ve also been trying to use the MLX90640 sensor along with the camera, but I’d like to know if there’s a way to save the data along with the camera image? It looks like there’s a way to draw the value color coded onto the image, but is there an easy way to save the raw data without slowing the frame rate too much? It seems like there wouldn’t be enough room on board if I wanted to do so.

Yeah, the IR array returned is an array of 32x24 floats. You can just open a file and write those to disk. You have to write python code to do this. There’s no library call.