Wanli
commited on
Commit
·
b06e115
1
Parent(s):
a39ec0d
fix bugs in wechatQRcode (#153)
Browse files- demo.py +4 -4
- wechatqrcode.py +2 -2
demo.py
CHANGED
|
@@ -28,13 +28,13 @@ parser = argparse.ArgumentParser(
|
|
| 28 |
description="WeChat QR code detector for detecting and parsing QR code (https://github.com/opencv/opencv_contrib/tree/master/modules/wechat_qrcode)")
|
| 29 |
parser.add_argument('--input', '-i', type=str,
|
| 30 |
help='Usage: Set path to the input image. Omit for using default camera.')
|
| 31 |
-
parser.add_argument('--detect_prototxt_path', type=str, default='
|
| 32 |
help='Usage: Set path to detect.prototxt.')
|
| 33 |
-
parser.add_argument('--detect_model_path', type=str, default='
|
| 34 |
help='Usage: Set path to detect.caffemodel.')
|
| 35 |
-
parser.add_argument('--sr_prototxt_path', type=str, default='
|
| 36 |
help='Usage: Set path to sr.prototxt.')
|
| 37 |
-
parser.add_argument('--sr_model_path', type=str, default='
|
| 38 |
help='Usage: Set path to sr.caffemodel.')
|
| 39 |
parser.add_argument('--backend_target', '-bt', type=int, default=0,
|
| 40 |
help='''Choose one of the backend-target pair to run this demo:
|
|
|
|
| 28 |
description="WeChat QR code detector for detecting and parsing QR code (https://github.com/opencv/opencv_contrib/tree/master/modules/wechat_qrcode)")
|
| 29 |
parser.add_argument('--input', '-i', type=str,
|
| 30 |
help='Usage: Set path to the input image. Omit for using default camera.')
|
| 31 |
+
parser.add_argument('--detect_prototxt_path', type=str, default='detect_2021nov.prototxt',
|
| 32 |
help='Usage: Set path to detect.prototxt.')
|
| 33 |
+
parser.add_argument('--detect_model_path', type=str, default='detect_2021nov.caffemodel',
|
| 34 |
help='Usage: Set path to detect.caffemodel.')
|
| 35 |
+
parser.add_argument('--sr_prototxt_path', type=str, default='sr_2021nov.prototxt',
|
| 36 |
help='Usage: Set path to sr.prototxt.')
|
| 37 |
+
parser.add_argument('--sr_model_path', type=str, default='sr_2021nov.caffemodel',
|
| 38 |
help='Usage: Set path to sr.caffemodel.')
|
| 39 |
parser.add_argument('--backend_target', '-bt', type=int, default=0,
|
| 40 |
help='''Choose one of the backend-target pair to run this demo:
|
wechatqrcode.py
CHANGED
|
@@ -15,7 +15,7 @@ class WeChatQRCode:
|
|
| 15 |
sr_prototxt_path,
|
| 16 |
sr_model_path
|
| 17 |
)
|
| 18 |
-
if backendId != 0:
|
| 19 |
raise NotImplementedError("Backend {} is not supported by cv.wechat_qrcode_WeChatQRCode()".format(backendId))
|
| 20 |
if targetId != 0:
|
| 21 |
raise NotImplementedError("Target {} is not supported by cv.wechat_qrcode_WeChatQRCode()")
|
|
@@ -25,7 +25,7 @@ class WeChatQRCode:
|
|
| 25 |
return self.__class__.__name__
|
| 26 |
|
| 27 |
def setBackendAndTarget(self, backendId, targetId):
|
| 28 |
-
if backendId != 0:
|
| 29 |
raise NotImplementedError("Backend {} is not supported by cv.wechat_qrcode_WeChatQRCode()".format(backendId))
|
| 30 |
if targetId != 0:
|
| 31 |
raise NotImplementedError("Target {} is not supported by cv.wechat_qrcode_WeChatQRCode()")
|
|
|
|
| 15 |
sr_prototxt_path,
|
| 16 |
sr_model_path
|
| 17 |
)
|
| 18 |
+
if backendId != 0 and backendId != 3:
|
| 19 |
raise NotImplementedError("Backend {} is not supported by cv.wechat_qrcode_WeChatQRCode()".format(backendId))
|
| 20 |
if targetId != 0:
|
| 21 |
raise NotImplementedError("Target {} is not supported by cv.wechat_qrcode_WeChatQRCode()")
|
|
|
|
| 25 |
return self.__class__.__name__
|
| 26 |
|
| 27 |
def setBackendAndTarget(self, backendId, targetId):
|
| 28 |
+
if backendId != 0 and backendId != 3:
|
| 29 |
raise NotImplementedError("Backend {} is not supported by cv.wechat_qrcode_WeChatQRCode()".format(backendId))
|
| 30 |
if targetId != 0:
|
| 31 |
raise NotImplementedError("Target {} is not supported by cv.wechat_qrcode_WeChatQRCode()")
|