mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Add JPEG Example
This commit is contained in:
parent
e01565cdb5
commit
156c349e43
19
usr/examples/jpeg.py
Normal file
19
usr/examples/jpeg.py
Normal file
@ -0,0 +1,19 @@
|
||||
import sensor, time, led
|
||||
sensor.reset()
|
||||
sensor.set_contrast(2)
|
||||
sensor.set_framesize(sensor.QQVGA)
|
||||
sensor.set_pixformat(sensor.RGB565)
|
||||
|
||||
clock = time.clock()
|
||||
# Take snapshot
|
||||
image = sensor.snapshot()
|
||||
|
||||
# Compress Image
|
||||
clock.tick()
|
||||
img = image.compress(30)
|
||||
print(clock.avg())
|
||||
|
||||
f = open("/test.jpeg", "w")
|
||||
f.write(img)
|
||||
f.close()
|
||||
break
|
||||
Loading…
Reference in New Issue
Block a user