Example: 01-Camera/04-Global-Shutter/high_fps.py

# 本作品采用MIT许可证授权。
# 版权所有 (c) 2013-2023 OpenMV LLC。保留所有权利。
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# High FPS Example
#
# This example shows off how to make the frame rate of the global shutter camera extremely
# high. To do so you need to set the resolution to a low value such that pixel binning is
# activated on the camera and then reduce the maximum exposure time.
#
# When the resolution is 320x240 or less the camera reads out pixels 2x faster. When the
# resolution is 160x120 or less the camera reads out pixels 4x faster. This happens due
# to pixel binning which is automatically activated for you to increase the readout speed.
#
# While the readout speed may increase the camera must still expose the image for the request
# time so you will not get the maximum readout speed unless you reduce the exposure time too.
# This results in a dark image however so YOU NEED A LOT of lighting for high FPS.

import sensor
import time

sensor.reset()  # 重置并初始化传感器。
sensor.set_pixformat(sensor.GRAYSCALE)  # 将像素格式设置为灰度
sensor.set_framesize(sensor.QQVGA)  # 将帧大小设置为QQVGA(160x120)
sensor.skip_frames(time=2000)  # 等待设置生效。
clock = time.clock()  # 创建一个时钟对象来跟踪FPS。

sensor.set_auto_exposure(True, exposure_us=5000)  # make smaller to go faster

while True:
    clock.tick()  # 更新FPS时钟。
    img = sensor.snapshot()  # 拍照并返回图像。
    print(clock.fps())  # 注意:OpenMV摄像头在连接至IDE时运行速度会降低约一半。
    # 断开连接后,帧率应会提升。

results matching ""

    No results matching ""