Routine Tutorial 05-Snapshot->emboss_snapshot
# Emboss Snapshot Example
#
# 注意:您将需要SD卡来运行此示例。
#
# 您可以使用您的OpenMV来保存修改的图像文件。
import sensor
import time
import machine
sensor.reset() # 初始化摄像头
sensor.set_pixformat(sensor.RGB565) # 设置图像色彩格式,有RGB565色彩图和GRAYSCALE灰度图两种
sensor.set_framesize(sensor.QVGA) # 设置图像像素大小为QVGA (320x240)
sensor.skip_frames(time=2000) # 让新的设置生效
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]) # 浮雕图像
img.save("example.jpg") # or "example.bmp" (or others)
raise (Exception("Please reset the camera to see the new file."))
Singtown Technology OpenMV official Chinese document function explanation: