解决微信生成个性添加好友的二维码,识别不了的情况
pip install opencv-python==4.5.2.54 opencv-contrib-python==4.5.2.54 # 只能是这个版本
depro = 'test_files/detect.prototxt'
decaf = 'test_files/detect.caffemodel'
srpro = 'test_files/sr.prototxt'
srcaf = 'test_files/sr.caffemodel'
detector = cv2.wechat_qrcode_WeChatQRCode(depro, decaf, srpro, srcaf) # 这四个参数可以不填,填上是为了识别一张图有多个二维码的情况
image = cv2.imread(file_path)
# 转为灰度图像
# gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
barcodes, points = detector.detectAndDecode(image) # 使用灰度图像将image换成gray
print(barcodes)