https://www.toutiao.com/i6924143326145036804/?tt_from=mobile_qq&utm_campaign=client_share×tamp=1612171870&app=news_article&utm_source=mobile_qq&utm_medium=toutiao_android&use_new_style=1&req_id=202102011731090100270240120B002932&share_token=082c62a0-7505-4f3e-8a43-f37a1d3aef88&group_id=6924143326145036804
我試圖復現這個文章的結果
import cv2
print(cv2.version.opencv_version)
detector = cv2.wechat_qrcode_WeChatQRCode("detect.prototxt", "detect.caffemodel", "sr.prototxt", "sr.caffemodel")
img = cv2.imread("img.jpg")
res, points = detector.detectAndDecode(img)
print(res, points)
結果提示:
4.5.1.48
Traceback (most recent call last):
File "C:/Users/fio/PycharmProjects/untitled2/fff.py", line 5, in <module>
detector = cv2.wechat_qrcode_WeChatQRCode("detect.prototxt", "detect.caffemodel", "sr.prototxt", "sr.caffemodel")
AttributeError: module 'cv2.cv2' has no attribute 'wechat_qrcode_WeChatQRCode'
可是我的2個opencv庫都安裝到最新版本了
opencv-contrib-python 4.5.1.48
opencv-python 4.5.1.48
這是什么原因導致無法跑通呢??
uj5u.com熱心網友回復:
可能是安裝cv程序,有部分檔案沒安裝成功。試試 pip uninstall 再 pip install
uj5u.com熱心網友回復:
你的測驗可以嚒?我試了不行uj5u.com熱心網友回復:
我看說明,那個呼叫方法應該是在opencv-contrib-python里,呼叫這個模塊也是import cv2 嚒?
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/268404.html
上一篇:Python初學
