Satyam Goyal
commited on
Commit
·
6148871
1
Parent(s):
a7efcf6
Merge pull request #95 from Satgoy152:adding-doc
Browse filesImproved help messages for demo programs (#95)
- Added Demo Documentation
- Updated help messages
- Changed exception link
README.md
CHANGED
|
@@ -3,17 +3,22 @@
|
|
| 3 |
WeChatQRCode for detecting and parsing QR Code, contributed by [WeChat Computer Vision Team (WeChatCV)](https://github.com/WeChatCV). Visit [opencv/opencv_contrib/modules/wechat_qrcode](https://github.com/opencv/opencv_contrib/tree/master/modules/wechat_qrcode) for more details.
|
| 4 |
|
| 5 |
Notes:
|
|
|
|
| 6 |
- Model source: [opencv/opencv_3rdparty:wechat_qrcode_20210119](https://github.com/opencv/opencv_3rdparty/tree/wechat_qrcode_20210119)
|
| 7 |
- The APIs `cv::wechat_qrcode::WeChatQRCode` (C++) & `cv.wechat_qrcode_WeChatQRCode` (Python) are both designed to run on default backend (OpenCV) and target (CPU) only. Therefore, benchmark results of this model are only available on CPU devices, until the APIs are updated with setting backends and targets.
|
| 8 |
|
| 9 |
## Demo
|
| 10 |
|
| 11 |
Run the following command to try the demo:
|
|
|
|
| 12 |
```shell
|
| 13 |
# detect on camera input
|
| 14 |
python demo.py
|
| 15 |
# detect on an image
|
| 16 |
python demo.py --input /path/to/image
|
|
|
|
|
|
|
|
|
|
| 17 |
```
|
| 18 |
|
| 19 |
### Example outputs
|
|
@@ -27,4 +32,4 @@ All files in this directory are licensed under [Apache 2.0 License](./LICENSE).
|
|
| 27 |
## Reference:
|
| 28 |
|
| 29 |
- https://github.com/opencv/opencv_contrib/tree/master/modules/wechat_qrcode
|
| 30 |
-
- https://github.com/opencv/opencv_3rdparty/tree/wechat_qrcode_20210119
|
|
|
|
| 3 |
WeChatQRCode for detecting and parsing QR Code, contributed by [WeChat Computer Vision Team (WeChatCV)](https://github.com/WeChatCV). Visit [opencv/opencv_contrib/modules/wechat_qrcode](https://github.com/opencv/opencv_contrib/tree/master/modules/wechat_qrcode) for more details.
|
| 4 |
|
| 5 |
Notes:
|
| 6 |
+
|
| 7 |
- Model source: [opencv/opencv_3rdparty:wechat_qrcode_20210119](https://github.com/opencv/opencv_3rdparty/tree/wechat_qrcode_20210119)
|
| 8 |
- The APIs `cv::wechat_qrcode::WeChatQRCode` (C++) & `cv.wechat_qrcode_WeChatQRCode` (Python) are both designed to run on default backend (OpenCV) and target (CPU) only. Therefore, benchmark results of this model are only available on CPU devices, until the APIs are updated with setting backends and targets.
|
| 9 |
|
| 10 |
## Demo
|
| 11 |
|
| 12 |
Run the following command to try the demo:
|
| 13 |
+
|
| 14 |
```shell
|
| 15 |
# detect on camera input
|
| 16 |
python demo.py
|
| 17 |
# detect on an image
|
| 18 |
python demo.py --input /path/to/image
|
| 19 |
+
|
| 20 |
+
# get help regarding various parameters
|
| 21 |
+
python demo.py --help
|
| 22 |
```
|
| 23 |
|
| 24 |
### Example outputs
|
|
|
|
| 32 |
## Reference:
|
| 33 |
|
| 34 |
- https://github.com/opencv/opencv_contrib/tree/master/modules/wechat_qrcode
|
| 35 |
+
- https://github.com/opencv/opencv_3rdparty/tree/wechat_qrcode_20210119
|
demo.py
CHANGED
|
@@ -21,13 +21,13 @@ def str2bool(v):
|
|
| 21 |
|
| 22 |
parser = argparse.ArgumentParser(
|
| 23 |
description="WeChat QR code detector for detecting and parsing QR code (https://github.com/opencv/opencv_contrib/tree/master/modules/wechat_qrcode)")
|
| 24 |
-
parser.add_argument('--input', '-i', type=str, help='
|
| 25 |
-
parser.add_argument('--detect_prototxt_path', type=str, default='detect_2021sep.prototxt', help='
|
| 26 |
-
parser.add_argument('--detect_model_path', type=str, default='detect_2021sep.caffemodel', help='
|
| 27 |
-
parser.add_argument('--sr_prototxt_path', type=str, default='sr_2021sep.prototxt', help='
|
| 28 |
-
parser.add_argument('--sr_model_path', type=str, default='sr_2021sep.caffemodel', help='
|
| 29 |
-
parser.add_argument('--save', '-s', type=str2bool, default=False, help='Set
|
| 30 |
-
parser.add_argument('--vis', '-v', type=str2bool, default=True, help='
|
| 31 |
args = parser.parse_args()
|
| 32 |
|
| 33 |
def visualize(image, res, points, points_color=(0, 255, 0), text_color=(0, 255, 0), fps=None):
|
|
|
|
| 21 |
|
| 22 |
parser = argparse.ArgumentParser(
|
| 23 |
description="WeChat QR code detector for detecting and parsing QR code (https://github.com/opencv/opencv_contrib/tree/master/modules/wechat_qrcode)")
|
| 24 |
+
parser.add_argument('--input', '-i', type=str, help='Usage: Set path to the input image. Omit for using default camera.')
|
| 25 |
+
parser.add_argument('--detect_prototxt_path', type=str, default='detect_2021sep.prototxt', help='Usage: Set path to detect.prototxt.')
|
| 26 |
+
parser.add_argument('--detect_model_path', type=str, default='detect_2021sep.caffemodel', help='Usage: Set path to detect.caffemodel.')
|
| 27 |
+
parser.add_argument('--sr_prototxt_path', type=str, default='sr_2021sep.prototxt', help='Usage: Set path to sr.prototxt.')
|
| 28 |
+
parser.add_argument('--sr_model_path', type=str, default='sr_2021sep.caffemodel', help='Usage: Set path to sr.caffemodel.')
|
| 29 |
+
parser.add_argument('--save', '-s', type=str2bool, default=False, help='Usage: Set “True” to save file with results (i.e. bounding box, confidence level). Invalid in case of camera input. Default will be set to “False”.')
|
| 30 |
+
parser.add_argument('--vis', '-v', type=str2bool, default=True, help='Usage: Default will be set to “True” and will open a new window to show results. Set to “False” to stop visualizations from being shown. Invalid in case of camera input.')
|
| 31 |
args = parser.parse_args()
|
| 32 |
|
| 33 |
def visualize(image, res, points, points_color=(0, 255, 0), text_color=(0, 255, 0), fps=None):
|