当前位置:网站首页>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 .)
边栏推荐
- “IRuntime”: 未声明的标识符
- day10:声明式事务控制
- [CCNA experiment sharing] routing between VLANs of layer 3 switches
- RISC0:Towards a Unified Compilation Framework for Zero Knowledge
- Sqlserver BCP parameter interpretation, character format selection and fault handling summary
- Today, there's a power failure for one day.... stop working for another day. Don't forget to study
- [development tutorial 6] crazy shell arm function mobile phone - interruption experiment tutorial
- None of the most complete MySQL commands in history is applicable to work and interview (supreme Collection Edition)
- Conditional judgment of Shell Foundation
- 【类的组合(在一个类中定义一个类)】
猜你喜欢

Mathpix formula extractor

Machine learning kmeans

集成Swagger 学习

【二分好题】

RISC0:Towards a Unified Compilation Framework for Zero Knowledge
![[SOC] the first project of SOC Hello World](/img/ae/326312cb3b5a372c7b8b048936a9f2.png)
[SOC] the first project of SOC Hello World

My love lesson 2 - remove webpage pop-up
[email protected]"/>@typescript-eslint/ [email protected]

【考研英语词汇训练营】Day 11 —— offer ,form ,maintain ,critical

day10:声明式事务控制
随机推荐
[blind box app mall system] function introduction after online unpacking
91. (leaflet chapter) leaflet situation plotting - offensive direction drawing
Leetcode: the shortest dice sequence impossible to get [thinking questions + grouping ideas]
Clever use of sort (list & lt; T & gt;, comparator & lt;? Super T & gt;) comparator
2022 Tsinghua summer school notes L1_ NLP and bigmodel Foundation
第二十周作业
[postgraduate entrance examination vocabulary training camp] day 12 - native, separate, figure, contribution, categories, assessment, propose
Shell introduction and variable definition
Big country "grain" policy | wheat expert Liu Luxiang: China's rations are absolutely safe, and the key to increasing grain potential lies in science and technology
Gradle learning - integration of gradle and idea
leetcode:不可能得到的最短骰子序列【思维题 + 分组思想】
中信证券股票开户怎么样安全吗
Which type of database migration is suitable for choosing the self built database access method on ECs?
How to gracefully realize regular backup of MySQL database (glory Collection Edition)
How to output position synchronization of motion control
【考研英语词汇训练营】Day 11 —— offer ,form ,maintain ,critical
Description of differences between esp32c3 led PWM use and esp32
MySQL forced indexing
Diou and ciou loss of loss function
Principle of an automatic nine point calibration tool (including part of the source code)