image_statistics_info.py

# 本作品采用MIT许可证授权。
# 版权所有 (c) 2013-2023 OpenMV LLC。保留所有权利。
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# 图像统计信息示例
#
# 此脚本计算图像的统计信息并打印出来。

import csi
import time

csi0 = csi.CSI()
csi0.reset()
csi0.pixformat(csi.GRAYSCALE)  # 或RGB565。
csi0.framesize(csi.QVGA)
csi0.snapshot(time=2000)
csi0.auto_gain(False)  # 必须关闭以进行颜色跟踪
csi0.auto_whitebal(False)  # 必须关闭以进行颜色跟踪

clock = time.clock()

while True:
    clock.tick()
    img = csi0.snapshot()
    print(img.get_statistics())
    print(clock.fps())

# 您还可以传递 get_statistics() 一个 "roi=" 来获取该区域的统计信息。
# get_statistics() 允许您快速确定图像的颜色通道信息。
# 图像中的任何区域。

results matching ""

    No results matching ""