import sensor, image, time
#引入此例程依赖的模块,
#sensor 是与摄像头参数设置相关的模块,
#image 是图像处理相关的模块,
#time 时钟控制相关的模块。
#import 相当于 c 语言的#include <>,模块相当于 c 语言的库。
sensor.reset() #初始化相机传感器
sensor.set_pixformat(sensor.RGB565) #设置相机模块的像素模式。
sensor.set_framesize(sensor.QVGA) #设置相机模块的帧大小。
sensor.skip_frames(time = 2000) #Let new settings take affect.
clock = time.clock() #初始化时钟
while(True):
clock.tick() #Track elapsed milliseconds between snapshots()
img = sensor.snapshot() #截取当前图像,存放于变量 img 中。
print(clock.fps()) #打印当前的帧率。
sensor.set_pixformat(pixformat)
设置相机模块的像素模式。
sensor.GRAYSCALE: 8-bits per pixel.
sensor.RGB565: 16-bits per pixel.
sensor.BAYER: 8-bits per pixel bayer pattern.
sensor.set_framesize(framesize)
设置相机模块的帧大小。
OpenMV4 H7默认