Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

QR CODE READER

Group:- Codeflocks
Members:- Shubham Kumar Giri (R17CS392)
Harsha Wardhan (R17CS149)
Himanshu Ranjan(R17CS151)
Reeshav(R17CS442)
Title:- QR Code Scanner
Objective:- Scans the QR code of any shop and
gives user about the current offers available on
the items.
Methods and Materials:-
from __future__ import print_function
import pyzbar.pyzbar as pyzbar
import numpy as np
import cv2

def decode(im) :
# Find barcodes and QR codes
decodedObjects = pyzbar.decode(im)

# Print results
for obj in decodedObjects:
print('Type : ', obj.type)
print('Data : ', obj.data,'\n')

return decodedObjects

# Display barcode and QR code location


def display(im, decodedObjects):

# Loop over all decoded objects


for decodedObject in decodedObjects:
points = decodedObject.polygon

# If the points do not form a quad, find convex hull


if len(points) > 4 :
hull = cv2.convexHull(np.array([point for point in points], dtype=np.float32))
hull = list(map(tuple, np.squeeze(hull)))
else :
hull = points;

# Number of points in the convex hull


n = len(hull)

# Draw the convext hull


for j in range(0,n):
cv2.line(im, hull[j], hull[ (j+1) % n], (255,0,0), 3)

# Display results
cv2.imshow("Results", im);
cv2.waitKey(0);

# Main
if __name__ == '__main__':

# Read image
cap = cv2.VideoCapture(0)

while(True):
ret, frame = cap.read()
rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2BGRA)

cv2.imshow('frame', rgb)
if cv2.waitKey(1) & 0xFF == ord('q'):
out = cv2.imwrite('capture.jpg', frame)
break

cap.release()
cv2.destroyAllWindows()
im=cv2.imread('C:\Users\user\capture.jpg')
decodedObjects = decode(im)
display(im, decodedObjects)

Importance for society:-


This app eases the effort on the part of business owners
by letting shoppers scan QR codes to learn about offers.
It automatically notifies registered users about ad
campaigns.
Can be scanned using a smartphone or any other phone with
scanning capability. QR codesare versatile, the can encode almost all
types of data e.g. numeric, alphabets, special and binary. Like other 2-
d barcodes, QR code has good fault tolerance.
QR codes are versatile, the can encode almost all types of data e.g. numeric,
alphabets, special and binary.
• Extremely fast scanning.
• Like other 2-d barcodes, QR code has good fault tolerance. Even if some part
of the code is damaged, information can still be decoded from the code.
• Stores large amount of information unlike 1-d barcodes.

You might also like