mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
31 lines
633 B
Python
31 lines
633 B
Python
import time, sensor, image, gif
|
|
|
|
# Reset sensor
|
|
sensor.reset()
|
|
|
|
# Set sensor settings
|
|
sensor.set_contrast(1)
|
|
sensor.set_brightness(1)
|
|
sensor.set_saturation(1)
|
|
sensor.set_gainceiling(16)
|
|
sensor.set_framesize(sensor.QVGA)
|
|
sensor.set_pixformat(sensor.GRAYSCALE)
|
|
|
|
for i in range(30):
|
|
img = sensor.snapshot()
|
|
|
|
# FPS clock
|
|
clock = time.clock()
|
|
gif = gif.Gif(img.width(), img.height(), "/test.gif", loop=True)
|
|
|
|
for i in range(30):
|
|
clock.tick()
|
|
img = sensor.snapshot()
|
|
gif.add_frame(img, delay=10)
|
|
# Print FPS.
|
|
# Note: Actual FPS is higher, the IDE slows down streaming.
|
|
print(clock.fps())
|
|
|
|
gif.close()
|
|
print("done")
|