For programmers to need to generate or read QR code image by python,this tested source code is useful.
It is available to generate and read QR code image.
Also it is available to capture and read QR code image from PC camera.
Specification
ID | STCD_0000000001 |
Language | Python |
Steps | 69 |
Purpose | Create and Read QR code. |
Function | Convert text to QR code image file(PNG file). Convert QR code image file(PNG file) to text. Capture QR code image from PC camera and Convert to text. |
Environment | Anaconda3(Python 3.9.7) IDE : Visual Studio Code qrcode( to create QR code image) cv2( to read QR code image) |
Restriction | free license You can use source code copy as owner . You can customize and distribute it freely. |
Price | 7 dollars or 700 yen (Pay with PayPal) |
References | cv::QRCodeDetector Class Reference – About QR code(japanese site) https://www.keyence.co.jp/ss/products/autoid/codereader/basic2d-qr-types.jsp https://engineer-lifestyle-blog.com/code/python/qrcode-generator-save-reader-with-sample-code/ https://www.qrcode.com/about/version.html |
Source Code
Test Result
NO | test case | result |
01 | version pattern test – Change version(1-40) | Though highest created verison was 40, highest read verison was 5. (This limitation may be regarding cv2.QRCodeDetector.) |
02 | error collect pattern test – Change error collect | OK ( with version 5 ) |
03 | box size pattern test – Change box size(1-10) | Only box size = 1 was NG. |
04 | text length pattern test – Change text length with version(1-5) | Though text length of version 5 was max 122 ,it was max 90. |
05 | camera test – Capture QR code from PC camera and read text. | OK |
06 | tilt image test – Read some tilt QR code images. | All patterns were OK. |
Test Code
*) Modify “qrcode_file_path” along your PC environment.
History
01/11/2022 created
Provider Profile
Nick name is “Dead Fish” employed as an engineer in Japan.
I am grad if you need my code.
Thanks !
Download
Get download passwordSTCD_0000000001
1 file(s) 0.18 KB
Following files and data are zipped.
├── [ 11862 Nov 6 09:42] QRCodeClass.py # source code and test code └── [ 4096 Nov 6 09:23] tilt # data dir for TEST CASE 06 ├── [ 5579 Nov 9 2020] test.png ├── [ 6334 Nov 6 08:58] test_180.png ├── [ 6053 Nov 6 08:58] test_270.png ├── [ 15196 Nov 6 09:14] test_315.png ├── [ 15421 Nov 6 09:14] test_45.png └── [ 6053 Nov 6 08:58] test_90.png
Remarks
None
Comments