本文整理汇总了Python中utool.noinject函数的典型用法代码示例。如果您正苦于以下问题:Python noinject函数的具体用法?Python noinject怎么用?Python noinject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了noinject函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: color_orimag
# I'm not quite sure how to organize these functions yet
from __future__ import absolute_import, division, print_function
# Standard
from six.moves import zip
# Science
import numpy as np
import cv2
# Matplotlib
import matplotlib.pyplot as plt
# VTool
import vtool.histogram as htool
import utool as ut
ut.noinject(__name__, '[pt.other]')
def color_orimag(gori, gmag):
# Turn a 0 to 1 orienation map into hsv colors
gori_01 = (gori - gori.min()) / (gori.max() - gori.min())
cmap_ = plt.get_cmap('hsv')
flat_rgb = np.array(cmap_(gori_01.flatten()), dtype=np.float32)
rgb_ori_alpha = flat_rgb.reshape(np.hstack((gori.shape, [4])))
rgb_ori = cv2.cvtColor(rgb_ori_alpha, cv2.COLOR_RGBA2RGB)
hsv_ori = cv2.cvtColor(rgb_ori, cv2.COLOR_RGB2HSV)
# Desaturate colors based on magnitude
hsv_ori[:, :, 1] = (gmag / 255.0)
hsv_ori[:, :, 2] = (gmag / 255.0)
# Convert back to bgr
bgr_ori = cv2.cvtColor(hsv_ori, cv2.COLOR_HSV2RGB)
return bgr_ori
开发者ID:Erotemic,项目名称:plottool,代码行数:29,代码来源:other.py
示例2: read_thumb_size
"""
CommandLine:
rm -rf /media/raid/work/PZ_MTEST/_ibsdb/_ibeis_cache/match_thumbs/
python -m ibeis.gui.inspect_gui --test-test_inspect_matches --show --verbose-thumb
"""
from __future__ import absolute_import, division, print_function
from guitool.__PYQT__ import QtGui, QtCore
#import cv2 # NOQA
#import numpy as np
#import time
#from six.moves import zip
import vtool as vt
from os.path import exists
from vtool import geometry
import utool as ut
ut.noinject(__name__, '[APIThumbDelegate]')
VERBOSE_QT = ut.get_argflag(('--verbose-qt', '--verbqt'))
VERBOSE_THUMB = ut.VERBOSE or ut.get_argflag(('--verbose-thumb', '--verbthumb')) or VERBOSE_QT
MAX_NUM_THUMB_THREADS = 1
def read_thumb_size(thumb_path):
if VERBOSE_THUMB:
print('[ThumbDelegate] Reading thumb size')
npimg = vt.imread(thumb_path, delete_if_corrupted=True)
(height, width) = npimg.shape[0:2]
del npimg
开发者ID:Erotemic,项目名称:guitool,代码行数:31,代码来源:api_thumb_delegate.py
示例3:
# flake8: noqa
from __future__ import absolute_import, division, print_function
__version__ = '1.0.0.dev1'
import utool as ut
ut.noinject(__name__, '[pyrf.__init__]')
from ._pyrf import *
开发者ID:WildbookOrg,项目名称:pyrf,代码行数:10,代码来源:__init__.py
示例4: slot_
from __future__ import absolute_import, division, print_function
import functools
from guitool.__PYQT__ import QtCore, QtGui # NOQA
from guitool.__PYQT__.QtCore import Qt # NOQA
import utool as ut
from utool._internal import meta_util_six
ut.noinject(__name__, '[guitool.decorators]', DEBUG=False)
DEBUG = False
signal_ = QtCore.pyqtSignal
# SLOT DECORATOR
def slot_(*types): # This is called at wrap time to get args
"""
wrapper around pyqtslot decorator
*args = types
"""
def pyqtSlotWrapper(func):
#printDBG('[GUITOOL._SLOT] Wrapping: %r' % func.__name__)
funcname = meta_util_six.get_funcname(func)
@QtCore.pyqtSlot(*types, name=funcname)
@ut.ignores_exc_tb
def slot_wrapper(self, *args, **kwargs):
result = func(self, *args, **kwargs)
return result
slot_wrapper = functools.update_wrapper(slot_wrapper, func)
return slot_wrapper
return pyqtSlotWrapper
开发者ID:Erotemic,项目名称:guitool,代码行数:31,代码来源:guitool_decorators.py
示例5: testdata_sifts
from __future__ import absolute_import, division, print_function
# Standard
from itertools import product as iprod
from six.moves import zip, range
# Science
import numpy as np
# Matplotlib
import matplotlib as mpl
import utool as ut
from plottool import color_funcs as color_fns # NOQA
ut.noinject(__name__, '[pt.mpl_sift]')
TAU = 2 * np.pi # References: tauday.com
BLACK = np.array((0.0, 0.0, 0.0, 1.0))
RED = np.array((1.0, 0.0, 0.0, 1.0))
def testdata_sifts():
# make random sifts
randstate = np.random.RandomState(1)
sifts_float = randstate.rand(1, 128)
sifts_float = sifts_float / np.linalg.norm(sifts_float)
sifts_float[sifts_float > .2] = .2
sifts_float = sifts_float / np.linalg.norm(sifts_float)
sifts = (sifts_float * 512).astype(np.uint8)
return sifts
def _cirlce_rad2xy(radians, mag):
return np.cos(radians) * mag, np.sin(radians) * mag
开发者ID:Erotemic,项目名称:plottool,代码行数:31,代码来源:mpl_sift.py
示例6:
# flake8: noqa
from __future__ import absolute_import, division, print_function
import sys
import utool as ut
ut.noinject(__name__, '[cyth.__init__]')
__version__ = '1.0.0.dev1'
from cyth.cyth_args import WITH_CYTH, CYTH_WRITE, DYNAMIC
from cyth.cyth_importer import import_cyth_execstr
from cyth.cyth_script import translate, translate_all
from cyth.cyth_decorators import macro
from cyth import cyth_helpers
from cyth import cyth_importer
from cyth import cyth_decorators
from cyth import cyth_macros
'''
Cyth:
* Create Cyth, to cythonize the code, make it faster
annotate variable names with types in a scoped comment
then type the variable names
* Cythonize spatial verification and other parts of vtool
* Cythonize matching_functions
Cyth Technical Description:
开发者ID:aweinstock314,项目名称:cyth,代码行数:30,代码来源:__init__.py
示例7: inject_print_functions
# -*- coding: utf-8 -*-
"""
custom sqlite3 module that supports numpy types
"""
from __future__ import absolute_import, division, print_function
import sys
import six
import io
import uuid
import numpy as np
#from utool.util_inject import inject_print_functions
#print, print_, printDBG = inject_print_functions(__name__, '[SQLITE3]', DEBUG=False)
import utool as ut
ut.noinject(__name__, '[ibeis.control.__SQLITE3__]', DEBUG=False)
VERBOSE_SQL = '--veryverbose' in sys.argv or '--verbose' in sys.argv or '--verbsql' in sys.argv
TRY_NEW_SQLITE3 = False
# SQL This should be the only file which imports sqlite3
if not TRY_NEW_SQLITE3:
from sqlite3 import * # NOQA
#try:
# # Try to import the correct version of sqlite3
# if VERBOSE_SQL:
# from pysqlite2 import dbapi2
# import sqlite3
# print('dbapi2.sqlite_version = %r' % dbapi2.sqlite_version)
# print('sqlite3.sqlite_version = %r' % sqlite3.sqlite_version)
# print('using dbapi2 as lite')
开发者ID:Erotemic,项目名称:ibeis,代码行数:31,代码来源:__SQLITE3__.py
示例8:
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import utool as ut
ut.noinject(__name__, "[ibeis.tests.__init__]", DEBUG=False)
开发者ID:Erotemic,项目名称:ibeis,代码行数:6,代码来源:__init__.py
示例9: MultiImageInteraction
#import matplotlib.image as mpimg
from plottool import viz_image2
from plottool import interact_annotations
from plottool import draw_func2 as df2
from plottool import plot_helpers as ph
from plottool import interact_helpers as ih
from plottool import abstract_interaction
from matplotlib.widgets import Button # NOQA
import matplotlib.pyplot as plt # NOQA
import matplotlib as mpl # NOQA
import six
import vtool as vt
#import utool
import utool as ut
ut.noinject(__name__, '[pt.interact_multiimage]')
BASE_CLASS = abstract_interaction.AbstractInteraction
#BASE_CLASS = object
class MultiImageInteraction(BASE_CLASS):
"""
CommandLine:
python -m plottool.interact_multi_image --exec-MultiImageInteraction --show
Example:
>>> # ENABLE_DOCTEST
>>> from plottool.interact_multi_image import * # NOQA
开发者ID:Erotemic,项目名称:plottool,代码行数:31,代码来源:interact_multi_image.py
示例10: print_all_backends
CommandLine:
python -m plottool.draw_func2 --exec-imshow --show --mplbe=GTKAgg
python -m plottool.draw_func2 --exec-imshow --show --mplbe=TkAgg
python -m plottool.draw_func2 --exec-imshow --show --mplbe=WxAgg
python -m plottool.draw_func2 --exec-imshow --show --mplbe=WebAgg
python -m plottool.draw_func2 --exec-imshow --show --mplbe=gdk
python -m plottool.draw_func2 --exec-imshow --show --mplbe=cairo
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import sys
import os
import utool as ut
ut.noinject(__name__, '[plottool.__MPL_INIT__]')
__IS_INITIALIZED__ = False
__WHO_INITIALIZED__ = None
VERBOSE_MPLINIT = ut.get_argflag(('--verb-mpl', '--verbose'))
TARGET_BACKEND = ut.get_argval(('--mpl-backend', '--mplbe'), type_=str, default=None)
FALLBACK_BACKEND = ut.get_argval(('--mpl-fallback-backend', '--mplfbbe'), type_=str, default='agg')
def print_all_backends():
import matplotlib.rcsetup as rcsetup
print(rcsetup.all_backends)
valid_backends = [u'GTK', u'GTKAgg', u'GTKCairo', u'MacOSX', u'Qt4Agg',
开发者ID:Erotemic,项目名称:plottool,代码行数:29,代码来源:__MPL_INIT__.py
示例11: FilterProxyModel
from __future__ import absolute_import, division, print_function
from guitool.__PYQT__ import QtGui, QtCore # NOQA
from guitool.__PYQT__.QtCore import Qt
import utool
utool.noinject(__name__, '[APIItemView]', DEBUG=False)
#BASE_CLASS = QtGui.QAbstractProxyModel
BASE_CLASS = QtGui.QSortFilterProxyModel
# BASE_CLASS = QtGui.QIdentityProxyModel
class FilterProxyModel(BASE_CLASS):
__metaclass__ = utool.makeForwardingMetaclass(
lambda self: self.sourceModel(),
['_set_context_id', '_get_context_id', '_set_changeblocked',
'_get_changeblocked', '_about_to_change', '_change', '_update',
'_rows_updated', 'name', 'get_header_name'],
base_class=BASE_CLASS)
def __init__(self, parent=None):
BASE_CLASS.__init__(self, parent=parent)
self.filter_dict = {}
def proxy_to_source(self, row, col, parent=QtCore.QModelIndex()):
r2, c2, p2 = row, col, parent
return r2, c2, p2
def source_to_proxy(self, row, col, parent=QtCore.QModelIndex()):
r2, c2, p2 = row, col, parent
return r2, c2, p2
开发者ID:Erotemic,项目名称:guitool,代码行数:31,代码来源:filter_proxy_model.py
示例12: get_recognition_query_aids
# -*- coding: utf-8 -*-
"""
Dependencies: flask, tornado
"""
from __future__ import absolute_import, division, print_function, unicode_literals
from ibeis.control import accessor_decors, controller_inject
from ibeis.algo.hots import pipeline
from flask import url_for, request, current_app # NOQA
from os.path import join, dirname, abspath
import numpy as np # NOQA
import utool as ut
#import vtool as vt
#import cv2 # NOQA
import dtool
from ibeis.web import appfuncs as appf
ut.noinject('[apis_query]')
CLASS_INJECT_KEY, register_ibs_method = (
controller_inject.make_ibs_register_decorator(__name__))
register_api = controller_inject.get_ibeis_flask_api(__name__)
register_route = controller_inject.get_ibeis_flask_route(__name__)
@register_ibs_method
@accessor_decors.default_decorator
@register_api('/api/query/recognition_query_aids/', methods=['GET'])
def get_recognition_query_aids(ibs, is_known, species=None):
"""
DEPCIRATE
开发者ID:Erotemic,项目名称:ibeis,代码行数:30,代码来源:apis_query.py
示例13: _test_base01
from __future__ import absolute_import, division, print_function
from six.moves import range, zip, map # NOQA
from plottool import custom_constants # NOQA
import colorsys
import numpy as np # NOQA
import utool as ut
#from plottool import colormaps as cmaps2
#(print, print_, printDBG, rrr, profile) = utool.inject(__name__, '[colorfuncs]', DEBUG=False)
ut.noinject(__name__, '[colorfuncs]')
def _test_base01(channels):
tests01 = {
'is_float': all([ut.is_float(c) for c in channels]),
'is_01': all([c >= 0.0 and c <= 1.0 for c in channels]),
}
return tests01
def _test_base255(channels):
tests255 = {
#'is_int': all([ut.is_int(c) for c in channels]),
'is_255': all([c >= 0.0 and c <= 255.0 for c in channels]),
}
return tests255
def is_base01(channels):
""" check if a color is in base 01 """
return all(_test_base01(channels).values())
开发者ID:Erotemic,项目名称:plottool,代码行数:30,代码来源:color_funcs.py
示例14: APIDelegate
from __future__ import absolute_import, division, print_function
from guitool.__PYQT__ import QtCore, QtGui
import utool as ut
ut.noinject(__name__, '[guitool.delegates]', DEBUG=False)
class APIDelegate(QtGui.QItemDelegate):
is_persistant_editable = True
def __init__(self, parent):
QtGui.QItemDelegate.__init__(self, parent)
def sizeHint(option, qindex):
# QStyleOptionViewItem option
return QtCore.QSize(50, 50)
class ImageDelegate(QtGui.QStyledItemDelegate):
def __init__(self, parent):
print(dir(self))
QtGui.QStyledItemDelegate.__init__(self, parent)
def paint(self, painter, option, index):
painter.fillRect(option.rect, QtGui.QColor(191, 222, 185))
# path = "path\to\my\image.jpg"
self.path = "image.bmp"
image = QtGui.QImage(str(self.path))
pixmap = QtGui.QPixmap.fromImage(image)
pixmap.scaled(50, 40, QtCore.Qt.KeepAspectRatio)
开发者ID:Erotemic,项目名称:guitool,代码行数:31,代码来源:guitool_delegates.py
示例15: report_thread_error
"""
old code ported from utool
"""
from __future__ import absolute_import, division, print_function
import sys
import six
import traceback
from utool.Preferences import Pref, PrefNode, PrefChoice
from guitool.__PYQT__ import QtCore, QtGui
from guitool.__PYQT__ import QVariantHack
from guitool.__PYQT__.QtCore import Qt, QAbstractItemModel, QModelIndex, QObject, pyqtSlot
from guitool.__PYQT__.QtGui import QWidget
from guitool import qtype
import utool as ut
from utool import util_type
ut.noinject(__name__, '[PreferenceWidget]', DEBUG=False)
VERBOSE_PREF = ut.get_argflag('--verbpref')
def report_thread_error(fn):
""" Decorator to help catch errors that QT wont report """
def report_thread_error_wrapper(*args, **kwargs):
try:
ret = fn(*args, **kwargs)
return ret
except Exception as ex:
print('\n\n *!!* Thread Raised Exception: ' + str(ex))
print('\n\n *!!* Thread Exception Traceback: \n\n' + traceback.format_exc())
sys.stdout.flush()
et, ei, tb = sys.exc_info()
开发者ID:Erotemic,项目名称:guitool,代码行数:31,代码来源:PreferenceWidget.py
示例16: QueryVerificationInteraction
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import six
import utool as ut
from ibeis import constants as const # NOQA
from plottool import interact_helpers as ih
import plottool as pt
from ibeis.viz.interact import interact_matches # NOQA
# from ibeis.gui import guiback
from functools import partial
import guitool
from ibeis.viz import viz_chip
from ibeis.viz import viz_matches
from plottool.abstract_interaction import AbstractInteraction
ut.noinject(__name__, '[interact_query_decision]')
#(print, print_, printDBG, rrr, profile) = ut.inject(__name__,
# '[interact_query_decision]', DEBUG=False)
#==========================
# query interaction
#==========================
NUM_TOP = 3
class QueryVerificationInteraction(AbstractInteraction):
"""
CommandLine:
python -m ibeis.viz.interact.interact_query_decision --test-QueryVerificationInteraction --show
python -m ibeis --imgsetid 2 --inc-query --yes
开发者ID:Erotemic,项目名称:ibeis,代码行数:31,代码来源:interact_query_decision.py
示例17: import
# flake8: noqa
from __future__ import absolute_import, print_function, division
__version__ = '1.2'
import utool as ut
ut.noinject(__name__, '[pyhesaff.__init__]')
from pyhesaff import ctypes_interface
from pyhesaff import _pyhesaff
from pyhesaff._pyhesaff import (DESC_DIM, HESAFF_CLIB,
HESAFF_PARAM_DICT, HESAFF_PARAM_TYPES,
HESAFF_TYPED_PARAMS, KPTS_DIM,
adapt_scale, alloc_kpts,
alloc_patches, alloc_vecs,
argparse_hesaff_params,
detect_feats, detect_feats2,
detect_feats_in_image, detect_feats_list,
detect_num_feats_in_image,
extract_desc_from_patches, extract_patches,
extract_vecs, get_cpp_version,
get_hesaff_default_params,
get_is_debug_mode,
hesaff_kwargs_docstr_block, img32_dtype,
test_rot_invar,
vtool_adapt_rotation,)
#from pyhesaff._pyhesaff import (extract_vecs, detect_feats, detect_feats_list,
# adapt_scale, vtool_adapt_rotation, kpts_dtype, vecs_dtype,
# get_hesaff_default_params, extract_desc_from_patches,
开发者ID:Erotemic,项目名称:hesaff,代码行数:31,代码来源:__init__.py
示例18: draw_chip_overlay
from __future__ import absolute_import, division, print_function
from six.moves import zip, map
import utool
import plottool.draw_func2 as df2
from plottool import custom_constants
#(print, print_, printDBG, rrr, profile) = utool.inject(__name__, '[viz_img2]', DEBUG=False)
utool.noinject(__name__, '[viz_img2]')
def draw_chip_overlay(ax, bbox, theta, text, is_sel):
""" Draw an annotation around a chip in the image """
lbl_alpha = .75 if is_sel else .6
bbox_alpha = .95 if is_sel else .6
lbl_color = custom_constants.BLACK * lbl_alpha
bbox_color = (custom_constants.ORANGE if is_sel else custom_constants.DARK_ORANGE) * bbox_alpha
df2.draw_bbox(bbox, text, bbox_color, lbl_color, theta=theta, ax=ax)
def draw_image_overlay(ax, bbox_list=[], theta_list=None, text_list=None,
sel_list=None, draw_lbls=True):
if not draw_lbls:
text_list = [''] * len(bbox_list)
if theta_list is None:
theta_list = [0] * len(bbox_list)
if text_list is None:
text_list = list(map(str, range(len(bbox_list))))
if sel_list is None:
sel_list = [False] * len(bbox_list)
# Draw all bboxes on top on image
annotation_iter = zip(bbox_list, theta_list, text_list, sel_list)
for bbox, theta, text, is_sel in annotation_iter:
开发者ID:Erotemic,项目名称:plottool,代码行数:31,代码来源:viz_image2.py
示例19: print
TODO: LAZY IMPORTS?
http://code.activestate.com/recipes/473888-lazy-module-imports/
"""
# flake8: noqa
from __future__ import absolute_import, division, print_function, unicode_literals
try:
import utool as ut
import dtool
except ImportError as ex:
print('[ibeis !!!] ERROR: Unable to load all core utility modules.')
print('[ibeis !!!] Perhaps try super_setup.py pull')
raise
ut.noinject(__name__, '[ibeis.__init__]')
if ut.VERBOSE:
print('[ibeis] importing ibeis __init__')
if ut.is_developer():
standard_visualization_functions = [
'show_image',
'show_chip',
'show_chipmatch',
'show_chipmatches',
'show_vocabulary',
#'show_vocabulary',
]
# If we dont initialize plottool before <something>
开发者ID:heroinlin,项目名称:ibeis,代码行数:30,代码来源:__init__.py
示例20: get_qtapp
from __future__ import absolute_import, division, print_function
# Python
# import atexit
import sys
from guitool.__PYQT__ import QtCore, QtGui
from guitool.__PYQT__.QtCore import pyqtRemoveInputHook
import utool
# print, print_, printDBG, rrr, profile = utool.inject(__name__, '[guitool]', DEBUG=False)
import utool as ut
ut.noinject(__name__, "[guitool.main]", DEBUG=False)
IS_ROOT_WINDOW = False
QAPP = None
VERBOSE = "--verbose" in sys.argv
QUIET = "--quiet" in sys.argv
def get_qtapp():
global QAPP
return QAPP
class GuitoolApplication(QtGui.QApplication):
"""
http://codeprogress.com/python/libraries/pyqt/showPyQTExample.php?index=378&key=QApplicationKeyPressGlobally
"""
开发者ID:Erotemic,项目名称:guitool,代码行数:30,代码来源:guitool_main.py
注:本文中的utool.noinject函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论