__all__ = ['op', 'kernel']
import sys
import cv2 as cv
# NB: Register function in specific module
def register(mname):
def parameterized(func):
sys.modules[mname].__dict__[func.__name__] = func
return func
return parameterized
@register('cv2.gapi')
def networks(*args):
return cv.gapi_GNetPackage(list(map(cv.detail.strip, args)))
@register('cv2.gapi')
def compile_args(*args):
return list(map(cv.GCompileArg, args))
@register('cv2')
def GIn(*args):
return [*args]
@register('cv2')
def GOut(*args):
return [*args]
@register('cv2')
def gin(*args):
return [*args]
@register('cv2.gapi')
def descr_of(*args):
return [*args]
@register('cv2')
class GOpaque():
# NB: Inheritance from c++ class cause segfault.
# So just aggregate cv.GOpaqueT instead of inheritance
def __new__(cls, argtype):
return cv.GOpaqueT(argtype)
class Bool():
def __new__(self):
return cv.GOpaqueT(cv.gapi.CV_BOOL)
class Int():
def __new__(self):
return cv.GOpaqueT(cv.gapi.CV_INT)
class Double():
def __new__(self):
return cv.GOpaqueT(cv.gapi.CV_DOUBLE)
class Float():
def __new__(self):
return cv.GOpaqueT(cv.gapi.CV_FLOAT)
class String():
def __new__(self):
return cv.GOpaqueT(cv.gapi.CV_STRING)
class Point():
def __new__(self):
return cv.GOpaqueT(cv.gapi.CV_POINT)
class Point2f():
def __new__(self):
return cv.GOpaqueT(cv.gapi.CV_POINT2F)
class Size():
def __new__(self):
return cv.GOpaqueT(cv.gapi.CV_SIZE)
class Rect():
def __new__(self):
return cv.GOpaqueT(cv.gapi.CV_RECT)
class Prim():
def __new__(self):
return cv.GOpaqueT(cv.gapi.CV_DRAW_PRIM)
class Any():
def __new__(self):
return cv.GOpaqueT(cv.gapi.CV_ANY)
@register('cv2')
class GArray():
# NB: Inheritance from c++ class cause segfault.
# So just aggregate cv.GArrayT instead of inheritance
def __new__(cls, argtype):
return cv.GArrayT(argtype)
class Bool():
def __new__(self):
return cv.GArrayT(cv.gapi.CV_BOOL)
class Int():
def __new__(self):
return cv.GArrayT(cv.gapi.CV_INT)
class Double():
def __new__(self):
return cv.GArrayT(cv.gapi.CV_DOUBLE)
class Float():
def __new__(self):
return cv.GArrayT(cv.gapi.CV_FLOAT)
class String():
def __new__(self):
return cv.GArrayT(cv.gapi.CV_STRING)
class Point():
def __new__(self):
return cv.GArrayT(cv.gapi.CV_POINT)
class Point2f():
def __new__(self):
return cv.GArrayT(cv.gapi.CV_POINT2F)
class Size():
def __new__(self):
return cv.GArrayT(cv.gapi.CV_SIZE)
class Rect():
def __new__(self):
return cv.GArrayT(cv.gapi.CV_RECT)
class Scalar():
def __new__(self):
return cv.GArrayT(cv.gapi.CV_SCALAR)
class Mat():
def __new__(self):
return cv.GArrayT(cv.gapi.CV_MAT)
class GMat():
def __new__(self):
return cv.GArrayT(cv.gapi.CV_GMAT)
class Prim():
def __new__(self):
return cv.GArray(cv.gapi.CV_DRAW_PRIM)
class Any():
def __new__(self):
return cv.GArray(cv.gapi.CV_ANY)
# NB: Top lvl decorator takes arguments
def op(op_id, in_types, out_types):
garray_types= {
cv.GArray.Bool: cv.gapi.CV_BOOL,
cv.GArray.Int: cv.gapi.CV_INT,
cv.GArray.Double: cv.gapi.CV_DOUBLE,
cv.GArray.Float: cv.gapi.CV_FLOAT,
cv.GArray.String: cv.gapi.CV_STRING,
cv.GArray.Point: cv.gapi.CV_POINT,
cv.GArray.Point2f: cv.gapi.CV_POINT2F,
cv.GArray.Size: cv.gapi.CV_SIZE,
cv.GArray.Rect: cv.gapi.CV_RECT,
cv.GArray.Scalar: cv.gapi.CV_SCALAR,
cv.GArray.Mat: cv.gapi.CV_MAT,
cv.GArray.GMat: cv.gapi.CV_GMAT,
cv.GArray.Prim: cv.gapi.CV_DRAW_PRIM,
cv.GArray.Any: cv.gapi.CV_ANY
}
gopaque_types= {
cv.GOpaque.Size: cv.gapi.CV_SIZE,
cv.GOpaque.Rect: cv.gapi.CV_RECT,
cv.GOpaque.Bool: cv.gapi.CV_BOOL,
cv.GOpaque.Int: cv.gapi.CV_INT,
cv.GOpaque.Double: cv.gapi.CV_DOUBLE,
cv.GOpaque.Float: cv.gapi.CV_FLOAT,
cv.GOpaque.String: cv.gapi.CV_STRING,
cv.GOpaque.Point: cv.gapi.CV_POINT,
cv.GOpaque.Point2f: cv.gapi.CV_POINT2F,
cv.GOpaque.Size: cv.gapi.CV_SIZE,
cv.GOpaque.Rect: cv.gapi.CV_RECT,
cv.GOpaque.Prim: cv.gapi.CV_DRAW_PRIM,
cv.GOpaque.Any: cv.gapi.CV_ANY
}
type2str = {
cv.gapi.CV_BOOL: 'cv.gapi.CV_BOOL' ,
cv.gapi.CV_INT: 'cv.gapi.CV_INT' ,
cv.gapi.CV_DOUBLE: 'cv.gapi.CV_DOUBLE' ,
cv.gapi.CV_FLOAT: 'cv.gapi.CV_FLOAT' ,
cv.gapi.CV_STRING: 'cv.gapi.CV_STRING' ,
cv.gapi.CV_POINT: 'cv.gapi.CV_POINT' ,
cv.gapi.CV_POINT2F: 'cv.gapi.CV_POINT2F' ,
cv.gapi.CV_SIZE: 'cv.gapi.CV_SIZE',
cv.gapi.CV_RECT: 'cv.gapi.CV_RECT',
cv.gapi.CV_SCALAR: 'cv.gapi.CV_SCALAR',
cv.gapi.CV_MAT: 'cv.gapi.CV_MAT',
cv.gapi.CV_GMAT: 'cv.gapi.CV_GMAT',
cv.gapi.CV_DRAW_PRIM: 'cv.gapi.CV_DRAW_PRIM'
}
# NB: Second lvl decorator takes class to decorate
def op_with_params(cls):
if not in_types:
raise Exception('{} operation should have at least one input!'.format(cls.__name__))
if not out_types:
raise Exception('{} operation should have at least one output!'.format(cls.__name__))
for i, t in enumerate(out_types):
if t not in [cv.GMat, cv.GScalar, *garray_types, *gopaque_types]:
raise Exception('{} unsupported output type: {} in possition: {}'
.format(cls.__name__, t.__name__, i))
def on(*args):
if len(in_types) != len(args):
raise Exception('Invalid number of input elements!\nExpected: {}, Actual: {}'
.format(len(in_types), len(args)))
for i, (t, a) in enumerate(zip(in_types, args)):
if t in garray_types:
if not isinstance(a, cv.GArrayT):
raise Exception("{} invalid type for argument {}.\nExpected: {}, Actual: {}"
.format(cls.__name__, i, cv.GArrayT.__name__, type(a).__name__))
elif a.type() != garray_types[t]:
raise Exception("{} invalid GArrayT type for argument {}.\nExpected: {}, Actual: {}"
.format(cls.__name__, i, type2str[garray_types[t]], type2str[a.type()]))
elif t in gopaque_types:
if not isinstance(a, cv.GOpaqueT):
raise Exception("{} invalid type for argument {}.\nExpected: {}, Actual: {}"
.format(cls.__name__, i, cv.GOpaqueT.__name__, type(a).__name__))
elif a.type() != gopaque_types[t]:
raise Exception("{} invalid GOpaque type for argument {}.\nExpected: {}, Actual: {}"
.format(cls.__name__, i, type2str[gopaque_types[t]], type2str[a.type()]))
else:
if t != type(a):
raise Exception('{} invalid i
没有合适的资源?快使用搜索试试~ 我知道了~
迷鹿自动化编辑器简单的脚本自行工具
共115个文件
pyd:39个
dll:34个
qm:23个
1星 需积分: 1 6 下载量 8 浏览量
2024-01-15
15:24:50
上传
评论
收藏 58.15MB ZIP 举报
温馨提示
可以执行windos程序,图色自定义脚本,一看就会的软件
资源推荐
资源详情
资源评论
收起资源包目录
迷鹿自动化编辑器简单的脚本自行工具 (115个子文件)
libopenblas.67LVI5PIPIPYANQC3VAWDE6KZKQBFZON.gfortran-win32.dll 26.73MB
opencv_videoio_ffmpeg455.dll 18.48MB
Qt5Gui.dll 5.62MB
Qt5Core.dll 5.13MB
mfc140u.dll 4.82MB
Qt5Widgets.dll 4.25MB
python38.dll 3.87MB
qtmlin.dll 2.53MB
libcrypto-1_1.dll 2.13MB
qwindows.dll 1.16MB
qminimal.dll 685KB
qoffscreen.dll 614KB
pythoncom38.dll 550KB
libssl-1_1.dll 525KB
MSVCP140.dll 443KB
qwebp.dll 403KB
qwebgl.dll 397KB
qjpeg.dll 365KB
qtiff.dll 345KB
Qt5Svg.dll 258KB
qwindowsvistastyle.dll 130KB
pywintypes38.dll 117KB
VCRUNTIME140.dll 74KB
python3.dll 59KB
qxdgdesktopportal.dll 53KB
qicns.dll 37KB
qsvgicon.dll 35KB
qgif.dll 33KB
qico.dll 31KB
libffi-7.dll 29KB
MSVCP140_1.dll 28KB
qsvg.dll 28KB
qtga.dll 27KB
qwbmp.dll 26KB
迷鹿自动化编辑器.exe 4.61MB
updata.exe 1.4MB
upd.ico 9KB
icon.ico 6KB
cacert.pem 270KB
__init__.py 10KB
__init__.py 7KB
__init__.py 900B
config-3.py 748B
__init__.py 344B
load_config_py3.py 271B
load_config_py2.py 157B
config.py 123B
version.py 95B
version.py 79B
__init__.py 73B
__init__.py 38B
cv2.pyd 44.39MB
QtWidgets.pyd 3.7MB
_imaging.cp38-win32.pyd 2.59MB
_multiarray_umath.cp38-win32.pyd 2.28MB
QtGui.pyd 1.87MB
QtCore.pyd 1.83MB
win32ui.pyd 1.19MB
unicodedata.pyd 1.04MB
minloo.pyd 1.04MB
_generator.cp38-win32.pyd 624KB
mtrand.cp38-win32.pyd 531KB
_webp.cp38-win32.pyd 411KB
main.pyd 301KB
_bounded_integers.cp38-win32.pyd 225KB
_decimal.pyd 224KB
win32gui.pyd 166KB
pyexpat.pyd 165KB
_common.cp38-win32.pyd 162KB
_lzma.pyd 156KB
_ssl.pyd 140KB
_umath_linalg.cp38-win32.pyd 137KB
bit_generator.cp38-win32.pyd 123KB
_ctypes.pyd 115KB
_multiarray_tests.cp38-win32.pyd 109KB
win32api.pyd 105KB
sip.cp38-win32.pyd 91KB
_pcg64.cp38-win32.pyd 79KB
_bz2.pyd 78KB
_pocketfft_internal.cp38-win32.pyd 74KB
_socket.pyd 69KB
_mt19937.cp38-win32.pyd 64KB
_philox.cp38-win32.pyd 60KB
win32print.pyd 60KB
_sfc64.cp38-win32.pyd 44KB
_hashlib.pyd 39KB
_queue.pyd 26KB
select.pyd 25KB
lapack_lite.cp38-win32.pyd 15KB
_imagingtk.cp38-win32.pyd 13KB
qtbase_de.qm 215KB
qtbase_ca.qm 205KB
qtbase_ru.qm 199KB
qtbase_tr.qm 190KB
qtbase_gd.qm 185KB
qtbase_da.qm 177KB
qtbase_fi.qm 176KB
qtbase_cs.qm 171KB
qtbase_fr.qm 162KB
qtbase_bg.qm 161KB
共 115 条
- 1
- 2
资源评论
- whswf2024-02-07无法正常使用
一只菜鸟儿
- 粉丝: 0
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功