QRCode示例
# 本作品采用MIT许可证授权。
# 版权所有 (c) 2013-2023 OpenMV LLC。保留所有权利。
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# QRCode示例
#
# 此示例展示了OpenMV摄像头检测二维码的强大能力
# 而无需镜头校正。
import csi
import time
csi0 = csi.CSI()
csi0.reset()
csi0.pixformat(csi.GRAYSCALE)
csi0.framesize(csi.VGA)
csi0.window((240, 240)) # 仅查看VGA分辨率中心的240x240像素。
csi0.snapshot(time=2000)
csi0.auto_gain(False) # 必须关闭此功能以防止图像褪色...
clock = time.clock()
while True:
clock.tick()
img = csi0.snapshot()
for code in img.find_qrcodes():
img.draw_rectangle(code.rect, color=127)
print(code)
print(clock.fps())