Routine explanation -05-snapshot save the picture

This routine is 05-Snapshot-snapshot.py\ The goal of this routine is to save the camera image using the save function.\ Note: Because openmv memory is small, you need an external SD card to save pictures.

# 保存图片例程
#
# 注意:您需要一张SD卡来运行这个例子
#
# 你可以使用你的OpenMV摄像头来保存图像文件

import sensor
import time
import machine

sensor.reset()  # 初始化sensor
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.save("example.jpg")  # or "example.bmp" (or others)

raise (Exception("Please reset the camera to see the new file."))

Note: The saved images can only be seen in SD card after openmv is restarted.

Singtown Technology OpenMV official Chinese document function explanation:

results matching ""

    No results matching ""