I run
The fps printed out vary wildly–80 fps to 28 fps.
what overhead causes the difference?
will the fps be more stable when the camera is not run in the IDE?


Hi, the FPS should be pretty stable. Which FPS number are you talking about? The one printed in the terminal is the actual FPS, the one printed on the IDE is how fast the IDE samples the camera frame buffer. The speed at which the IDE samples the frame buffer is highly variable depending on your computers CPU load.

I am referring to the FPS printed out using “print(clock.fps())” command in the script. The printout is in the IDE serial terminal.

Yes, that FPS should be very stable. Um, does the FPS continue to vary wildly throughout the runtime of the script or just at the beginning?



See attached file (685 Bytes)

Hi, the code you posted isn’t doing what you think. I believe you want this:

import sensor, image, time

sensor.reset()                           # Reset and initialize the sensor.
sensor.set_pixformat(sensor.GRAYSCALE)   # Set pixel format to GRAYSCALE.
sensor.set_framesize(sensor.VGA)         # Set frame size to QVGA (640x480)
sensor.skip_frames(time = 2000)          # Wait for settings take effect.
clock = time.clock()                     # clock timeing

while True:
    img = sensor.snapshot()                  # Take a picture and return the image.
    for j in range(40):
        for i in range(40):
            gs = img.get_pixel((cxm-20)+i,(cym-20)+j)      # Read pixel value of returned image.


The FPS is stable too.