QR Code Class

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

IDSTCD_0000000001
LanguagePython
Steps69
PurposeCreate and Read QR code.
FunctionConvert 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.
EnvironmentAnaconda3(Python 3.9.7)
IDE : Visual Studio Code
qrcode( to create QR code image)
cv2( to read QR code image)
Restrictionfree license
You can use source code copy as owner .
You can customize and distribute it freely.
Price7 dollars or 700 yen
(Pay with PayPal)
Referencescv::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

NOtest caseresult
01version pattern test
– Change version(1-40)
Though highest created verison was 40,
highest read verison was 5. (This limitation may be regarding cv2.QRCodeDetector.)
02error collect pattern test
– Change error collect
OK ( with version 5 )
03box size pattern test
– Change box size(1-10)
Only box size = 1 was NG.
04text length pattern test
– Change text length with version(1-5)
Though text length of version 5 was max 122 ,it was max 90.
05camera test
– Capture QR code from PC camera and read text.
OK
06tilt 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 password

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

Copied title and URL