How To Create QR Code In Python And Decode QR Code

 


In this post We make QR Code Generator and Decode with Python In just 10 Line of Python 

 Firstly We will use qrcode module in Python. If the module is not install in your Python you need to type "pip install qrcode" in Terminal/Command Prompt and for decode the qrcode we will use cv2 module in Python. If the module not install in Python type "pip install opencv-python" in terminal/Command Prompt

Modules used in this application

1. Import qrcode

2. Import cv2

Here is the code.



#This is the example of link
import qrcode
img=qrcode.make("https://codingwithanmol.blogspot.com")
img.save("Code With Anmol.jpg")

#This is the example of text
img=qrcode.make("Code With Anmol")
img.save("Text Code With Anmol.jpg")

Now We will decode our qrcode



import cv2
d=cv2.QRCodeDetector()
retval, points, straight_qrcode=d.detectAndDecode(cv2.imread("Text Code With Anmol.jpg))
print(retval)

Post a Comment

Previous Post Next Post