请问这个扫码识别得到的code.payload(),扫码结果是123+321 ,我将它赋值给message,然后通过比对message是否等于字符串123+321,一直显示不相等,请问这个code,payload()输出的是什么类型的数据啊?
while(b==1):
img = sensor.snapshot()
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))
message = code.payload()
if message =='123+321'
print("0")就是字符串,估计你的代码写错了,或者是二维码错了。

# QRCode Example
#
# This example shows the power of the OpenMV Cam to detect QR Codes
# without needing lens correction.
import sensor, image, time
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.VGA)
sensor.set_windowing((240, 240)) # look at center 240x240 pixels of the VGA resolution.
sensor.skip_frames(time = 2000)
sensor.set_auto_gain(False) # must turn this off to prevent image washout...
clock = time.clock()
while(True):
clock.tick()
img = sensor.snapshot()
for code in img.find_qrcodes():
if code.payload() == '123+321':
print("yes")