mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
29 lines
831 B
Python
29 lines
831 B
Python
# Emboss Snapshot Example
|
|
#
|
|
# Note: You will need an SD card to run this example.
|
|
# You can use your OpenMV Cam to save modified image files.
|
|
|
|
import sensor
|
|
import time
|
|
import machine
|
|
|
|
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.
|
|
|
|
led = machine.LED("LED_BLUE")
|
|
|
|
start = time.ticks_ms()
|
|
while time.ticks_diff(time.ticks_ms(), start) < 3000:
|
|
sensor.snapshot()
|
|
led.toggle()
|
|
|
|
led.off()
|
|
|
|
img = sensor.snapshot()
|
|
img.morph(1, [+2, +1, +0, +1, +1, -1, +0, -1, -2]) # Emboss the image.
|
|
img.save("example.jpg") # or "example.bmp" (or others)
|
|
|
|
raise (Exception("Please reset the camera to see the new file."))
|