ルーチン説明 06-Video-Recording->imageio_write バイナリビデオを書き込みます

# 写入二进制视频示例
#
# 将此示例与uSD内存卡一起使用!录制后重置相机以查看文件。
#
# 本示例说明如何使用Image Writer对象记录OpenMV Cam所见内容的快照,以供以后使用Image Reader对象进行分析。
# 由Image Writer对象写入磁盘的图像以OpenMV Cam可以读取的简单文件格式存储。

import sensor
import image
import time
import machine

record_time = 10000  # 10秒(以毫秒为单位)

sensor.reset()  # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565)  # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.QQVGA)  # Set frame size to QQVGA (160x120)
sensor.skip_frames(time=2000)  # Wait for settings take effect.
clock = time.clock()  # Create a clock object to track the FPS.

led = machine.LED("LED_RED")
stream = image.ImageIO("/stream.bin", "w")

# 红色LED亮起表示我们正在捕获帧。
led.on()

start = time.ticks_ms()
while time.ticks_diff(time.ticks_ms(), start) < record_time:
    clock.tick()
    img = sensor.snapshot()
    # Modify the image if you feel like here...
    stream.write(img)
    print(clock.fps())

stream.close()
led.off()

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

results matching ""

    No results matching ""