Do you know QR Code can not only be used for payment or official purpose. You can convert any text to QR code and fun with it!
QR code stands for ‘quick response’. It is advanced version of barcode on which we made a project earlier. Barcode contains information on horizontally whereas QR code can contain information horizontally as well as vertically.
So in this post we will see how to create a own QR code with any information, text you want using python qrcode library, and then you can send that QR code image to your friend.
And using opencv we will detect what is inside that or any other QR code.
QR Code generator using python project
QR Code encoder / decoder using qr code python project
Before starting make sure you have python and pip added to path as we need to install qrcode (external library) using pip.
Write this command on your command prompt. And you should also have an internet connection on your system to downlaod this external library.
Another library that you will need is opencv which we use in almost every computer vision or image related project.
Once you complete this now you need to remember few method to create a qrcode.
QR code generator python 5 line code
you need just this much to create your QR Code with your custom message to your friend in it.
On second line we are specifying our data that we want to be stored in QR code. It can be your gpay account link or any text message.
After that creating a QR image using make() function of qrcode library in which we have to pass the information.
And with save() function we are creating the png file on your disk.
Now a png file something like this will be created on your system.
You can share this to your friend. And only he can see what’s inside it who have qr code detector / decoder.
Creating a QR decoder using python opencv
We will use opencv imread() function to read the qrcode. And then create a QRCodeDetector object.
If you face any difficulty or error try solving with this article.
Once you decoded your qrimage now you can see it.
Here I implemented this a scan the above qr code and got this…
It printed the exact data that I stored earlier on the Above QR code.
QR code generator Python GitHub
I have made a repository on github from where you can download this qr code generator project source code. And there are also other computer vision project to read captcha code and barcode project source code.
You can pull or download the qr code generator source code with logo from there. And scan that logo 🙂 and comment what message was there?
Qr code Python example
That was it. I saw you the implementation of qrcode generator python with example and created and qr code logo and detected what is written on it.
Now its your turn create qr code and send it to your friends and keep it secret. But feel free to share this blog link with your friends so that can know what garbage you are sending to them.