I had asked earlier about sending video frames from the MV7 to a PC. Decided it would be simpler for now to save video to the SD card and then copy to the PC. But I have had very erratic results, both with GIF and MPEG.
I copied some code from you site and modified it a bit doe debugging:
import sensor, mjpeg, time
# Setup camera.
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QQQVGA)
sensor.skip_frames()
c = time.clock()
# Create the mjpeg object.
m = mjpeg.Mjpeg("example3.mjpeg")
# Add frames.
for i in range(100):
print(0, end ='')
c.tick()
img = sensor.snapshot()
print(1, end ='')
m.add_frame(img)
# Finalize
fps = c.fps()
m.close(fps)
print("\nFPS: {}".format(fps) )
This should print a long string of ones and zeroes: ‘0’ at the start of the loop and ‘1’ between capturing the image and saving it to the MJPEG file. At the end it should print the FPS value. Sometimes it does do this, although the FPS value varies a lot from run to run - typically about 50, 76, or 91 FPS. Does not seem to matter if the frame buffer in the IDE is enabled or disabled. But many times it just prints ‘0’ or ‘010’ and hangs. I can press the run button three times in a row and get two good runs and then a hang. Or once (after a reset) and it runs and then hangs or just hangs immediately.
I am using a tested 15Gb Sandisk Ultra uSD card and have tried two USB cables. I thought that the problem was with the SD card but realized that the program hangs after printing a ‘0’ so it seems it is getting stuck on reading the image. Note that I am using QQQVGA grayscale - very small images. I also noticed that the last five rows (approximately) in many frames have a lot of random pixels.(Is there a way to upload images?) Is it possible that the board is defective or that there is a problem with the QQQVGA mode?
What I really want to do is use pyp.Timer to control the frame rate exactly. I wrote some code for that but could never get it to work at more than 4 fps. The code here is just test code to try to debug the problem. Since the MV7 is hanging on the simple code it is not surprising it has problems with a callback function. So I would greatly appreciate any help here.