JeVoisBase  1.22
JeVois Smart Embedded Machine Vision Toolkit Base Modules
Share this page:
Loading...
Searching...
No Matches
wechatqrcode.py
Go to the documentation of this file.
1# This file is part of OpenCV Zoo project.
2# It is subject to the license terms in the LICENSE file found in the same directory.
3#
4# Copyright (C) 2021, Shenzhen Institute of Artificial Intelligence and Robotics for Society, all rights reserved.
5# Third party copyrights are property of their respective owners.
6
7import numpy as np
8import cv2 as cv # needs to have cv.wechat_qrcode_WeChatQRCode, which requires compile from source with opencv_contrib/modules/wechat_qrcode
9
11 def __init__(self, detect_prototxt_path, detect_model_path, sr_prototxt_path, sr_model_path):
12 self._model = cv.wechat_qrcode_WeChatQRCode(
13 detect_prototxt_path,
14 detect_model_path,
15 sr_prototxt_path,
16 sr_model_path
17 )
18
19 @property
20 def name(self):
21 return self.__class__.__name__
22
23 def setBackend(self, backend_id):
24 # self._model.setPreferableBackend(backend_id)
25 if backend_id != 0:
26 raise NotImplementedError("Backend {} is not supported by cv.wechat_qrcode_WeChatQRCode()")
27
28 def setTarget(self, target_id):
29 # self._model.setPreferableTarget(target_id)
30 if target_id != 0:
31 raise NotImplementedError("Target {} is not supported by cv.wechat_qrcode_WeChatQRCode()")
32
33 def infer(self, image):
34 return self._model.detectAndDecode(image)
setBackend(self, backend_id)
__init__(self, detect_prototxt_path, detect_model_path, sr_prototxt_path, sr_model_path)
setTarget(self, target_id)