Example: 02-Image-Processing/01-Image-Filters/grayscale_light_removal.py

# 本作品采用MIT许可证授权。
# 版权所有 (c) 2013-2023 OpenMV LLC。保留所有权利。
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# Grayscale Light Removal
#
# This example shows off how to remove bright lights from the image.
# You can do this using the binary() method with the "zero=" argument.
#
# 从图像中去除强光后,你现在可以使用
# histeq() 对图像进行处理,而不会因为过饱和部分的异常值
# 破坏算法...

import sensor
import time

sensor.reset()  # 初始化相机传感器。
sensor.set_pixformat(sensor.GRAYSCALE)  # 或 sensor.RGB565
sensor.set_framesize(sensor.QQVGA)  # 或 sensor.QVGA(或其他)
sensor.skip_frames(time=2000)  # 让新设置生效。
clock = time.clock()  # 跟踪FPS。

thresholds = (220, 255)

while True:
    clock.tick()  # Track elapsed milliseconds between snapshots().
    img = sensor.snapshot().binary([thresholds], invert=False, zero=True)

    print(clock.fps())  # 注意:您的 OpenMV Cam 在连接到
    # 计算机时运行速度会减半。断开连接后,FPS 应该会增加。

results matching ""

    No results matching ""