Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import http.client
- import cv2
- import numpy as np
- import sys
- import time
- if len(sys.argv)>1:
- inputImage = cv2.imread(sys.argv[1])
- else:
- inputImage = cv2.imread("address.jpeg")
- # Display barcode and QR code location
- def display(im, bbox):
- n = len(bbox)
- for j in range(n):
- cv2.line(im, tuple(bbox[j][0]), tuple(bbox[ (j+1) % n][0]), (255,0,0), 3)
- #cv2.imshow("Results", im) # Display results
- # Create a qrCodeDetector Object
- qrDecoder = cv2.QRCodeDetector()
- # Detect and decode the qrcode
- t = time.time()
- data,bbox,rectifiedImage = qrDecoder.detectAndDecode(inputImage)
- print("Time Taken for Detect and Decode : {:.3f} seconds".format(time.time() - t))
- if len(data)>0:
- print("Decoded Data : {}".format(data))
- display(inputImage, bbox)
- rectifiedImage = np.uint8(rectifiedImage);
- # cv2.imshow("Rectified QRCode", rectifiedImage); #imshow sie sypie w opencv4
- else:
- print("QR Code not detected")
- # cv2.imshow("Results", inputImage)
- cv2.imwrite("output.jpg",inputImage)
- # w3w
- address=data
- import what3words
- from os import environ
- api_key = '0I0IARIK'
- w3w = what3words.Geocoder(api_key)
- res = w3w.forward(address)
- print(res)
- # 0I0IARIK
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement