当前位置:网站首页>Maixll dock QR code recognition
Maixll dock QR code recognition
2022-07-24 22:02:00 【Salted fish shell】
Maixll-Dock QR code recognition
I don't need to say more about QR code recognition
Salted fish products , Just use it. ~
Choose version :v831-m2dock-maixpy3-0.5.0-20220601
Two dimensional bar code / QR code (2-dimensional bar code)
Use a specific geometric figure to move on the plane according to a certain law ( Two dimensional ) Distributed black and white graphics record data symbol information ; A number of geometric shapes corresponding to binary are used to represent literal numerical information , Through image input device or photoelectric scanning device to read automatically to achieve automatic information processing :
It has some common features of bar code technology :
- Each code system has its own specific character set ; Each character has a certain width ; It has certain verification function, etc .
- At the same time, it also has the function of automatic identification of different information 、 And processing the rotation change point of the graph .
image modular :find_qrcodes
One 、 The import module
from maix import image
Two 、 Basic usage
from maix import image
x=image.find_qrcodes()
print(x)
Get the outline coordinates : Read find_qrcodes() The key value in the dictionary returned by the function is : x , y , w , h The value of is used as the coordinate information of the outline of the QR code ( Blue box ). > Get the coordinates of the inner frame : Read find_qrcodes() The key value in the dictionary returned by the function is : corners The values in the list of are used as the coordinates of the inner box of the QR code ( Green box ).
Get QR code information : Read find_qrcodes() The key value in the dictionary returned by the function is : payload As QR code information .
The key values of the dictionary are as follows :‘x’ , ‘y’ , ‘w’ , ‘h’ , ‘payload’ , ‘version’ , ‘ecc_level’ , ‘mask’ , ‘data_type’ , ‘eci’ , ‘corners’.
| Key value | explain |
|---|---|
| x | Returns the bounding box of the QR code x coordinate (int). |
| y | Returns the bounding box of the QR code y coordinate (int). |
| w | Returns the bounding box of the QR code w coordinate (int). |
| h | Returns the bounding box of the QR code h coordinate (int). |
| payload | Returns the string of QR code payload , for example URL . |
| version | Returns the version number of the QR code (int). |
| ecc_level | Return QR code ECC level (int). |
| mask | Returns the mask of the QR code (int). |
| data_type | Return the data type of QR code |
| eci | Return QR code ECI.ECI Stored QR The code in which data bytes are stored . |
| qrcode.corners | Returns a four tuple consisting of the four corners of the object (x,y) A list of . The four corners are usually returned clockwise from the upper left corner . |
Case study : Identify QR code
see find_qrcodes() Return information
from maix import display, camera
while True:
t = camera.capture()
mks = t.find_qrcodes()
print(mks) # Output information
display.show(t)
The information obtained is as follows : It's a dictionary
[{‘x’: 49, ‘y’: 41, ‘w’: 168, ‘h’: 160, ‘payload’: ‘xianyujun’, ‘version’: 1, ‘ecc_level’: 3, ‘mask’: 1, ‘data_type’: 4, ‘eci’: 0, ‘corners’: [[49, 52], [211, 41], [217, 201], [69, 196]]}]

After getting the dictionary, we will understand the following code .
Identify QR code
from maix import display, camera
while True:
t = camera.capture()
mks = t.find_qrcodes()
for mk in mks:
# Outline data
X = mk['x']
Y = mk['y']
W = mk['w']
H = mk['h']
# QR code information
string = mk['payload']
# Inner frame data
x1,y1 = mk['corners'][0] # Access the list of dictionaries
x2,y2 = mk['corners'][1]
x3,y3 = mk['corners'][2]
x4,y4 = mk['corners'][3]
# Draw frame
t.draw_rectangle(X, Y, X + W, Y + H, color=(0, 0, 255), thickness = 2)
# Print information
t.draw_string(int(X) , int(Y - 35) , str(string), scale = 2.0, color = (255, 0, 0), thickness = 2) # Inner frame ID
# Draw the inner frame
t.draw_line(x1, y1, x2, y2, color = (0, 255, 0), thickness = 3)
t.draw_line(x2, y2, x3, y3, color = (0, 255, 0), thickness = 3)
t.draw_line(x3, y3, x4, y4, color = (0, 255, 0), thickness = 3)
t.draw_line(x4, y4, x1, y1, color = (0, 255, 0), thickness = 3)
display.show(t)
design sketch :( Can't recognize complex QR code , The gorgeous one doesn't work .)
边栏推荐
- Gradle 学习 ----Gradle 与Idea整合
- 模板的使用
- With this PDF, I successfully got offers from ant, jd.com, Xiaomi, Tencent and other major manufacturers
- Circom 2.0: A Scalable Circuit Compiler
- Gradle learning - integration of gradle and idea
- LED digital display driver IC and anti-interference LED digital tube display driver ic-vk1s68c ssop24 are applicable to finger clip pulse oximeter, arm electronic sphygmomanometer, thermometer, fetal
- Today's nft/ digital collection hotspot
- 微机原理:CPU架构详解
- 小程序地理位置接口申请
- 731. My schedule II (segment tree or scoring array)
猜你喜欢

01_ UE4 advanced_ PBR material

实现redis哨兵,模拟master故障场景
![[Matplotlib drawing]](/img/ac/dea6fa0aff6f02477fba48c929fadc.png)
[Matplotlib drawing]

Volcano engine releases cloud growth solutions for six industries
![[blind box app mall system] function introduction after online unpacking](/img/c9/3d13409113a3671555c4744eeb3913.jpg)
[blind box app mall system] function introduction after online unpacking

None of the most complete MySQL commands in history is applicable to work and interview (supreme Collection Edition)

How to gracefully realize regular backup of MySQL database (glory Collection Edition)

Gradle 学习 ----Gradle 进阶说明

day10:声明式事务控制

Gather relevant knowledge points and expand supplements
随机推荐
2022 Niuke multi school 7.23
How to gracefully realize regular backup of MySQL database (glory Collection Edition)
[pyspark foundation] row to column and column to row (when there are more than one column)
Thank Huawei for sharing the developer plan
Makefile basics -- extensions
Drawing library Matplotlib styles and styles
Drawing library Matplotlib drawing
【类的组合(在一个类中定义一个类)】
Huawei cloud data governance production line dataarts, let "data 'wisdom' speak"
深入理解事务
Today, there's a power failure for one day.... stop working for another day. Don't forget to study
Mathematical derivation in [pumpkin Book ml] (task4) neural network
Mathpix formula extractor
C# 回看委托与事件
You must make good use of MySQL and JSON
Dtable launched in the public beta, which is not only a table, but also a business application builder
支付宝上股票开户安全吗
【考研英语词汇训练营】Day 11 —— offer ,form ,maintain ,critical
RISC0:Towards a Unified Compilation Framework for Zero Knowledge
What is a database password?