genx320_histogram_grayscale_mode_set_afk.py
# 本作品采用MIT许可证授权。
# 版权所有 (c) 2013-2024 OpenMV LLC。保留所有权利。
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# 此示例展示了如何使用Prophesee的GenX320事件传感器,并控制
# GenX320数字流水线中的抗闪烁(AFK)滤波模块。
# AFK可以检测场景中给定频率的周期性变化并将其滤除。
import csi
import time
csi0 = csi.CSI(cid=csi.GENX320)
csi0.reset()
csi0.pixformat(csi.GRAYSCALE)
csi0.framesize((320, 320))
csi0.brightness(128) # 一般保持128(这是默认值)。
csi0.contrast(16) # 增大可让图像更醒目。
csi0.framerate(100)
# 启用AFK滤波器,去除130Hz到160Hz频率范围内的周期性数据
csi0.ioctl(csi.IOCTL_GENX320_SET_AFK, 1, 130, 160)
# 禁用AFK滤波器
# csi0.ioctl(csi.IOCTL_GENX320_SET_AFK, 0)
clock = time.clock()
while True:
clock.tick()
img = csi0.snapshot()
print(clock.fps())