例程讲解06-Video-Recording->image_writer写入二进制视频

# 写入图片例程
#
# 使用这个例子需要内存卡!记录后重置摄像头以查看文件。

# 这个例子展示了如何使用Image Writer对象来记录你的OpenMV Cam
# 在使用Image Reader对象进行后续分析时所看到的快照。 
# 通过Image Writer对象写入磁盘的图像以OpenMV Cam可以读取的简单
# 文件格式存储。
import sensor, image, pyb, time

record_time = 10000 # 10 seconds in milliseconds

sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time = 2000)
clock = time.clock()

img_writer = image.ImageWriter("/stream.bin")

# Red LED on means we are capturing frames.
red_led = pyb.LED(1)
red_led.on()

start = pyb.millis()
while pyb.elapsed_millis(start) < record_time:
    clock.tick()
    img = sensor.snapshot()
    # Modify the image if you feel like here...

    img_writer.add_frame(img)
    print(clock.fps())

img_writer.close()

# Blue LED on means we are done.
red_led.off()
blue_led = pyb.LED(3)
blue_led.on()

print("Done")
while(True):
    pyb.wfi()

星瞳科技OpenMV官方中文文档函数讲解:

results matching ""

    No results matching ""