qrcodes_with_lens_corr.py
# 本作品采用MIT许可证授权。
# 版权所有 (c) 2013-2023 OpenMV LLC。保留所有权利。
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# QRCode示例
#
# 此示例展示了OpenMV摄像头检测二维码的强大能力
# 并使用镜头校正(更高性能请参见qrcodes_with_lens_corr.py脚本)。
import csi
import time
csi0 = csi.CSI()
csi0.reset()
csi0.pixformat(csi.RGB565)
csi0.framesize(csi.QVGA)
csi0.snapshot(time=2000)
csi0.auto_gain(False) # 必须关闭此功能以防止图像褪色...
clock = time.clock()
while True:
clock.tick()
img = csi0.snapshot()
img.lens_corr(1.8) # 1.8的强度对于2.8mm镜头来说很好。
for code in img.find_qrcodes():
img.draw_rectangle(code.rect, color=(255, 0, 0))
print(code)
print(clock.fps())