Saving stream of jpeg images to SD card

Discussion related to "under the hood" OpenMV topics.
mhjasonliu
Posts: 2
Joined: Tue Jan 21, 2020 3:45 pm

Saving stream of jpeg images to SD card

Postby mhjasonliu » Thu Feb 27, 2020 10:19 pm

Hello!

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)

Code: Select all

img = sensor.snapshot()
img.save(filename)
 
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?
User avatar
kwagyeman
Posts: 4271
Joined: Sun May 24, 2015 2:10 pm

Re: Saving stream of jpeg images to SD card

Postby kwagyeman » Fri Feb 28, 2020 1:37 am

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.
Nyamekye,
mhjasonliu
Posts: 2
Joined: Tue Jan 21, 2020 3:45 pm

Re: Saving stream of jpeg images to SD card

Postby mhjasonliu » Sat Feb 29, 2020 8:48 pm

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.
User avatar
kwagyeman
Posts: 4271
Joined: Sun May 24, 2015 2:10 pm

Re: Saving stream of jpeg images to SD card

Postby kwagyeman » Sun Mar 01, 2020 4:13 am

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.
Nyamekye,

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 23 guests