Example: 01-Camera/00-Snapshot/snapshot.py

# 本作品采用MIT许可证授权。
# 版权所有 (c) 2013-2023 OpenMV LLC。保留所有权利。
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# 快照示例
#
# 注意:运行此示例需要一张SD卡。
# 您可以使用OpenMV摄像头保存图像文件。

import sensor
import time
import machine

sensor.reset()  # 重置并初始化传感器。
sensor.set_pixformat(sensor.RGB565)  # 将像素格式设置为RGB565 (or 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")  # 或“example.bmp”(或其他文件)

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

results matching ""

    No results matching ""