Generate and Decode QR-Code using Qrcode and Python-Opencv

QR codes are everywhere these days, but how are they made? You can create your own QR code in Python and even decode QR codes. In this tutorial we will learn about how to generate and decode QR-code (Quick Response Code) using qrcode and python-opencv

pip install qrcode[pil]
pip install python-opencv

πŸ’» Code:

πŸ‘• T-shirts for programmers:
πŸ”” Subscribe:


What is GEEK

Buddha Community

Generate and Decode QR-Code using Qrcode and Python-Opencv
Ray  Patel

Ray Patel


top 30 Python Tips and Tricks for Beginners

Welcome to my Blog , In this article, you are going to learn the top 10 python tips and tricks.

1) swap two numbers.

2) Reversing a string in Python.

3) Create a single string from all the elements in list.

4) Chaining Of Comparison Operators.

5) Print The File Path Of Imported Modules.

6) Return Multiple Values From Functions.

7) Find The Most Frequent Value In A List.

8) Check The Memory Usage Of An Object.


#python #python hacks tricks #python learning tips #python programming tricks #python tips #python tips and tricks #python tips and tricks advanced #python tips and tricks for beginners #python tips tricks and techniques #python tutorial #tips and tricks in python #tips to learn python #top 30 python tips and tricks for beginners

Ray  Patel

Ray Patel


Lambda, Map, Filter functions in python

Welcome to my Blog, In this article, we will learn python lambda function, Map function, and filter function.

Lambda function in python: Lambda is a one line anonymous function and lambda takes any number of arguments but can only have one expression and python lambda syntax is

Syntax: x = lambda arguments : expression

Now i will show you some python lambda function examples:

#python #anonymous function python #filter function in python #lambda #lambda python 3 #map python #python filter #python filter lambda #python lambda #python lambda examples #python map

Guide to Generating & Testing QRcode Using OpenCV

Nowadays QR Code scanners have become popular because of their huge usage. QRcode stores some information in it. We can detect the QRcode from the image and we can decode the data in it. Mostly we can see QR codes are used by all e-payment apps and by their customers and every manufacturing product will have the product description in the form of a QRcode By just scanning the QRcode we will get info of that product. In this article, we will try to generate a QRcode and test a QRcode scanner with a few lines of code using the OpenCV modules pyzbar and qrcode.

Topics we cover in this article:-

  • QR Code Generation in Python
  • Introducing pyzbar module
  • How to Generate your own QR code
  • Scanning QR code using images

Hands-On Implementation

Now, we will implement our program on QR Code creation.

Importing required libraries

import cv2

import numpy as np

from google.colab.patches import cv2_imshow

Introducing pyzbar library

Pyzbar is an OpenCV module that is used to decode the QRcode and it is distributed under MIT license. Using this library it illustrates type: whether it is barcode or QRcode, data: the alphanumeric information is hidden in QRcode, and location: edges of the QRcode in the image.

Installing pyzbar library

pip install pyzbar

installing pyzbar

In the below code snippet we are installing the dependencies of the pyzbar library.

!apt install [libzbar](http://libzar/) 

QR code in Pythoninstalling lizar


Creating a QR code scanner

import qrcode

img = qrcode.make('[](')



image = cv2.imread("/content/qrcode_test.png")


QR code in PythonGenerated QR codePIN IT

Here we generated a QRcode code and I stored the Analytics India magazine link in this QRcode so that when scanning this QRcode the link appears.

Scanning QR code using images

image = cv2.imread("/content/download (13).jpg")

scan = pyzbar.decode(image)

for obj in scan:

print("Type:", obj.type)

print("Data:",, "\n")

Data =



QR code in PythonScanning QR codePIN IT

Here you can see we are getting the output type as QRcode and Data is the link we have given in the above snippet and we can try with any QRcode and it scans the information from the QRcode.


In this article, we demonstrated how to generate our own QRcode and how to scan QRcode and display information from it. Using OpenCV modules and a few lines of code in python we implemented the above code snippets.

Provide your comments below


#developers corner #generate qr code #pyzbar #qrcode using opencv #scan qr code #zybar

Verda  Conroy

Verda Conroy


Create a Virtual Pen and Eraser with Python OpenCV - Genial Code

Learn Free how to create a virtual pen and eraser with python and OpenCV with source code and complete guide. This entire application is built fundamentally on contour detection. It can be thought of as something like closed color curves on compromises that have the same color or intensity, it’s like a blob. In this project we use color masking to get the binary mask of our target color pen, then we use the counter detection to find the location of this pen and the contour to find it.

#python #create virtual pen and eraser with opencv #create virtual pen and eraser with python opencv #programming #opencv #python opencv

Python Imread(): Different Ways to Load an Image using The OpenCV.imread() Method

In this tutorial, we will learn how to use imread() method of OpenCV-Python in detail and different ways to load an image using imread() method.

Table of Contents

What is Python imread()?

Importing OpenCV to use Python imread()

Syntax of the Python imread() method

Image formats supported by Python imread() method


#python modules #opencv-python #python imread() #opencv.imread() #python imread(): different ways to load an image using the opencv.imread() method #load an image