Example: 04-Barcodes/qrcodes_with_lens_corr.py
# 本作品采用MIT许可证授权。
# 版权所有 (c) 2013-2023 OpenMV LLC。保留所有权利。
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# QRCode示例
#
# This example shows the power of the OpenMV Cam to detect QR Codes
# using lens correction (see the qrcodes_with_lens_corr.py script for higher performance).
import sensor
import time
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time=2000)
sensor.set_auto_gain(False) # 必须关闭此功能以防止图像褪色...
clock = time.clock()
while True:
clock.tick()
img = sensor.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())