openmv随笔(IDE第一篇)
import sensor
"""
import是python中导入模块的命令,在micopython一样适用
"""
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
"""
sensor.QQVGA: 160x120
sensor.QQVGA2: 128x160 (用于 lcd 扩展板)
sensor.HQVGA: 240x160
sensor.QVGA: 320x240
sensor.VGA: 640x480 (只用于OpenMV Cam M7 的灰度图处理图像,或者彩图采集图像)
sensor.QQCIF: 88x72
sensor.QCIF: 176x144
sensor.CIF: 352x288
sensor.skip_frames(n=10)# 跳过n张照片,在更改设置后,跳过一些帧,等待感光元件变稳定。
"""
while(True):
img = sensor.snapshot()
跳过一些帧
sensor.skip_frames(n=10)
获取一张图像
sensor.snapshot()
自动增益/白平衡
sensor.set_auto_gain()
sensor.set_auto_whitebal()
设置窗口ROI
sensor.set_windowing(roi)
ROI:Region Of Interest
sensor.set_framesize(sensor.VGA)
sensor.set_windowing((640, 80))
"""
import sensor
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA)
sensor.set_windowing((200, 200))
while(True):
img = sensor.snapshot()
"""
设置反转
sensor.set_hmirror(True)
sensor.set_vflip(True)
"""
import sensor
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA)
sensor.set_windowing((200, 200))
sensor.set_hmirror(True)
while(True):
img = sensor.snapshot()
"""