Code: Select all
import sensor, image, time, utime
sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # 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.
while(True):
start = (utime.ticks_ms())/1000
img = sensor.snapshot() # Take a picture and return the image.
end = (utime.ticks_ms())/1000
print("TIME", end-start)