firmware.zip (1.1 MB)
Hi, attached is OpenMV Cam H7 Plus firmware with support for the features you wanted:
You can now specify frames to drop with sensor.set_framedrop(x) where x is the number of frames to drop before capturing a frame. E.g. if you set that to 1 it cuts the FPS in half.
You can now disabling flushing of the image fifo handled by sensor by doing: sensor.disable_full_flush(True) which will turn off automatic flushing on overflow. When you disable this is basically means that there’s no age limit on frames anymore in the fifo. So… you can now have images from an unlimited time ago in the fifo.
Run the script below to see the effect. Note that while the image fifo will fill up at the max frame rate of the camera and then continue to be feed at whatever your read frame of frames out of the fifo is. This behavior is expected and there’s not really a way to fix it. So, you should play with the depth of the fifo and the number of frames you want to drop to get the performance you want.
# Hello World Example
# Welcome to the OpenMV IDE! Click on the green run arrow button below to run the script!
import sensor, image, time, pyb
sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.GRAYSCALE) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240)
#sensor.skip_frames(time = 2000) # Wait for settings take effect.
clock = time.clock() # Create a clock object to track the FPS.
clock.tick() # Update the FPS clock.
img = sensor.snapshot() # Take a picture and return the image.
print(clock.fps()) # Note: OpenMV Cam runs about half as fast when connected
# to the IDE. The FPS should increase once disconnected.
Anyway, the main thing is that the camera will capture frames in the background now and not drop any frames while you are doing something else like connecting to the internet and etc.
For the best experience you want to find a frame drop and fifo depth such that the fifo never is overflowing. In general this is not behavior you ever want. So, I would recommend you try to find a depth where disable_full_flush() is not needed. However, I added it so you don’t have to worry too much about getting that depth exactly right.
PR here: Kwabena/special sensor stuff by kwagyeman · Pull Request #1345 · openmv/openmv · GitHub