def wechat_qrcode(image): # img_strong = image_enhancement(image) detector = cv2.wechat_qrcode_WeChatQRCode( model_path + "/" + "detect.prototxt", model_path + "/" + "detect.caffemodel", model_path + "/" + "sr.prototxt", model_path + "/" + "sr.caffemodel") res_qrcode, _ = detector.detectAndDecode(image) return res_qrcode, _
import time def displayBbox(im, bbox): if bbox is not None: bbox = [bbox[0].astype(int)] n = len(bbox[0]) for i in range(n): cv2.line(im, tuple(bbox[0][i]), tuple(bbox[0][(i + 1) % n]), (0, 255, 0), 3) # INITIALIZATION. # Instantiate QR Code detector object. detector = cv2.wechat_qrcode_WeChatQRCode("../model/detect.prototxt", "../model/detect.caffemodel", "../model/sr.prototxt", "../model/sr.caffemodel") if __name__ == '__main__': # Load image. if len(sys.argv) > 1: img = cv2.imread(sys.argv[1]) else: img = cv2.imread('sample-qrcode.jpg') t1 = time.time() # Detect and decode. res, points = detector.detectAndDecode(img) t2 = time.time() # Detected outputs. if len(res) > 0:
def buildAppWeixin(): image = cv2.imread("/Users/sqlxx/Downloads/reimburseqr2.png") detector = cv2.wechat_qrcode_WeChatQRCode() val, points = detector.detectAndDecode(image) print(val, points);
import cv2 detector = cv2.wechat_qrcode_WeChatQRCode( "opencv_3rdparty-wechat_qrcode/detect.prototxt", "opencv_3rdparty" "-wechat_qrcode/detect" ".caffemodel", "opencv_3rdparty-wechat_qrcode/sr.prototxt", "opencv_3rdparty-wechat_qrcode" "/sr.caffemodel") img = cv2.imread("pictures/qrcode.jpg") # gray = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY) res, points = detector.detectAndDecode(img) print(res)