Gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)ĭecode the QR image using pyzbar: from pyzbar.pyzbar import decode Read the image and convert to Grayscale: img = cv2.imread('QR-code.png') You may use the following stages for reading and decoding the QR code: I am using Python 3.6 and Windows 10, and there are no errors. I don't know the reason for the error messages. N:John you can see, the information is readable. #qrData = Qr_img_to_text(image_file_name) Img2 = cv2.resize(img, (img.shape*2, img.shape*2), interpolation=cv2.INTER_LANCZOS4) # Resize by x2 using LANCZOS4 interpolation method.įrom pyaadhaar.utils import Qr_img_to_text, isSecureQr Img = cv2.imread(image_file_name, cv2.IMREAD_GRAYSCALE) # Read image as grayscale. Reading, resizing and saving as a new image: import cv2 Resizing the input by a factor of 2 allows reading the QR code: The posted sample is just an example, and not a real "Secure QR code", but just an example ( isSecureQR returns false).The quality of the posted sample image is not good enough.Raise MalformedIntegerReceived('Decompression failed, please send a valid integer received from QR code')Ī: Decompression failed, please send a valid integer received from QR code Secure_qr = AadhaarSecureQR(integer_scanned_from_qr)įile "/home/piyush/libs/p圓8/lib/python3.8/site-packages/aadhaar/qr.py", line 57, in init Zlib.error: Error -3 while decompressing data: incorrect header checkĭuring handling of the above exception, another exception occurred: compressed_byte_array = compress(te_array, wbits=16+zlib.MAX_WBITS) Stacktrace below:įile "/home/piyush/libs/p圓8/lib/python3.8/site-packages/aadhaar/qr.py", line 55, in init Stacktrace below: File "/home/piyush/libs/p圓8/lib/python3.8/site-packages/pyaadhaar/deocde.py", line 23, in _init_īytes_array = base10encodedstring.to_bytes(5000, 'big').lstrip(b'\x00')ĪttributeError: 'str' object has no attribute 'to_bytes'Īadhaar-py: Secure QR decoding fails cause it is unable to validate integer received from QR code. NOTE: For Old QR Code format of Aadhaar card, pyaadhaar library works well, this issue only occurs for Secure QR code. Pyaadhaar: Secure QR code decoding code, tries to convert base10 string to bytes and fails. Here are the issues I am facing with these libraries: Secure_qr = AadhaarSecureQR(int(qrData))ĭecoded_secure_qr_data = secure_qr.extract_data() # secure_qr = AadhaarSecureQR(integer_scanned_from_qr) Python version: 3.8 from pyaadhaar.utils import Qr_img_to_text, isSecureQrįrom ocde import AadhaarSecureQrįrom ocde import AadhaarOldQr Here is my code for decoding secure QR code using these libraries. Please recommend possible resolutions or some other methods to achieve this task Information on Secure QR code is available here. I am unable to decode Secure QR code using them on Aadhaar cards. These 2 libraries seem particularly useful for this use case: To extract the info - I have been looking into python libraries that read and decode Secure QR codes on Indian Aadhaar cards. I am able to identify the region with QR code. I am trying to extract the complete Aadhar number (12 digits) from the image of an Aadhar card (India)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |