Skip to content

Instantly share code, notes, and snippets.

@R3DHULK
Created February 10, 2023 06:49
Show Gist options
  • Save R3DHULK/37aeecd2941d7dee84d0f8093ab85f9d to your computer and use it in GitHub Desktop.
Save R3DHULK/37aeecd2941d7dee84d0f8093ab85f9d to your computer and use it in GitHub Desktop.
QR Code Scanner In Python
#pip install cv2
#pip install numpy
import cv2
import numpy as np
def decode(im) :
# Find barcodes and QR codes
decodedObjects = cv2.QRCodeDetector().detectAndDecode(im)
# Print results
for obj in decodedObjects:
print("Type:", obj[0])
print("Data : ", obj[1], "\n")
return decodedObjects
# Main
if __name__ == '_main_' :
# Read image
im = cv2.imread("image.png")
decodedObjects = decode(im)
cv2.imshow("Results", im)
cv2.waitKey(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment