Created
February 10, 2023 06:49
-
-
Save R3DHULK/37aeecd2941d7dee84d0f8093ab85f9d to your computer and use it in GitHub Desktop.
QR Code Scanner In Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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