JeVoisBase  1.20
JeVois Smart Embedded Machine Vision Toolkit Base Modules
Share this page:
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 
7 import numpy as np
8 import 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)
wechatqrcode.WeChatQRCode.name
def name(self)
Definition: wechatqrcode.py:20
wechatqrcode.WeChatQRCode.infer
def infer(self, image)
Definition: wechatqrcode.py:33
wechatqrcode.WeChatQRCode.__init__
def __init__(self, detect_prototxt_path, detect_model_path, sr_prototxt_path, sr_model_path)
Definition: wechatqrcode.py:11
wechatqrcode.WeChatQRCode._model
_model
Definition: wechatqrcode.py:12
wechatqrcode.WeChatQRCode
Definition: wechatqrcode.py:10
wechatqrcode.WeChatQRCode.setBackend
def setBackend(self, backend_id)
Definition: wechatqrcode.py:23
wechatqrcode.WeChatQRCode.setTarget
def setTarget(self, target_id)
Definition: wechatqrcode.py:28