实现多个二维码同时识别定位怎么更改,求指教
-
import sensor, image, time from pyb import UART import json black_threshold = (0, 20, -18, 127, -8, 22) #black green_threshold = (0, 70, -128, -28, 22, 127) #green red_threshold = (0, 50, -128, 127, 12, 127) #red thresholds = (0,0,50,50) QRCode_1="www.xt.com"; QRCode_2="www.gym.com"; QRCode_3="www.gyt.com"; QRCode_4="www.jgz.com"; QRCode_5="www.njs.com"; qr = 0 a = 1 sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QQVGA) sensor.skip_frames(time = 2000) sensor.set_auto_gain(False) # must be turned off for color tracking sensor.set_auto_whitebal(False) # must be turned off for color tracking clock = time.clock() uart = UART(3, 115200) #识别二维码 while(a): 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)) if code.payload() == QRCode_1 : qr=1; elif code.payload() == QRCode_2 : qr=2; elif code.payload() == QRCode_3 : qr=3; elif code.payload() == QRCode_4 : qr=4; else : qr=5; print("二维码",code) print(qr) output_str="%d,%d,%d,%d,%d" % (code.x(), code.y(),code.w(),code.h(),qr) uart.write(output_str+'\r\n')
-
你的代码有什么问题?
-
代码没问题,不知道如何同时识别多个二维码
-
@na3m 你的代码已经可以同时识别多个二维码啊