#!/usr/bin/env python #version : 2023.12.31 #language : en from maix import camera, display, zbar, image import sys sys.path.append('/root/CocoPi.py') image.load_freetype("/root/preset/fonts/CascadiaCodePL-Italic.ttf") camera.camera.config(size=(320,240)) while True: canvas = camera.capture() mks = canvas.find_qrcodes() for mk in mks: #外框数据 X = mk['x'] Y = mk['y'] W = mk['w'] H = mk['h'] #二维码信息 string = mk['payload'] #画外框 canvas.draw_rectangle(X, Y, X + W, Y + H, color=(0, 0, 255), thickness = 2) #打印信息 canvas.draw_string(int(X) , int(Y - 35) , str(string), scale = 1, color = (255, 0, 0), thickness = 2) #内框ID canvas.draw_image(image.open("/root/preset/img/exit_ff0000_24x24.png"),288,216,alpha=1) display.show(canvas)