mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Tried to emulate Arduino's 11 folders... I'd perfer to have all the shield scripts in one folder... but, that might not make sense. I don't really want one script per folder however. So, I might merge some more stuff in the future. I have a grand idea here that will become evident as I work though the examples. Anyway, the current structure is not final. It will be in flux for a little while. As for Git History, folder history is the best we're going to get. Git and GitHub don't seem to deal with moves too well.
33 lines
644 B
Python
33 lines
644 B
Python
import sensor, time
|
|
|
|
# Reset sensor
|
|
sensor.reset()
|
|
|
|
# Set sensor settings
|
|
sensor.set_brightness(0)
|
|
sensor.set_saturation(0)
|
|
sensor.set_gainceiling(16)
|
|
sensor.set_contrast(1)
|
|
|
|
# Set sensor to QQVGA/RGB565
|
|
sensor.set_framesize(sensor.QVGA)
|
|
sensor.set_pixformat(sensor.RGB565)
|
|
sensor.set_colorbar(True)
|
|
|
|
# Skip a few frames to allow the sensor settle down
|
|
# Note: This takes more time when exec from the IDE.
|
|
for i in range(0, 30):
|
|
sensor.snapshot()
|
|
|
|
clock = time.clock()
|
|
# Take snapshot
|
|
img = sensor.snapshot()
|
|
|
|
# Compress Image
|
|
clock.tick()
|
|
img = img.compress(50)
|
|
print(clock.avg(),"\n")
|
|
|
|
with open("/test.jpeg", "w") as f:
|
|
f.write(img)
|