# QRCode Example
#
# 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, image, time, lcd, pyb
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000)
sensor.set_auto_gain(False) # must turn this off to prevent image washout...
clock = time.clock()
lcd.init() # Initialize the lcd screen.
while(True):
clock.tick()
img = sensor.snapshot()
for i in range(10):
x = (pyb.rng() % (2*img.width())) - (img.width()//2)
y = (pyb.rng() % (2*img.height())) - (img.height()//2)
r = (pyb.rng() % 127) + 128
g = (pyb.rng() % 127) + 128
b = (pyb.rng() % 127) + 128
img.lens_corr(1.8) # strength of 1.8 is good for the 2.8mm lens.
for code in img.find_qrcodes():
img.draw_rectangle(code.rect(), color = (255, 0, 0))
print(code)
img.draw_string(img.draw_string(x, y, code.payload(), color = (r, g, b), scale = 2, mono_space = False)
)
lcd.display(img)
print(clock.fps())你要好好检查一下你的代码。
检查了好几遍,自己也改了,不对,一扫到二维码就出现错误。。。。
你34行多了一个括号是什么意思,而且看上去你好像不知道这个代码的意义。。。
我看到了,哇没注意