当前位置: 首页>>代码示例>>Python>>正文


Python IkaUtils.dprint方法代码示例

本文整理汇总了Python中ikalog.utils.IkaUtils.dprint方法的典型用法代码示例。如果您正苦于以下问题:Python IkaUtils.dprint方法的具体用法?Python IkaUtils.dprint怎么用?Python IkaUtils.dprint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ikalog.utils.IkaUtils的用法示例。


在下文中一共展示了IkaUtils.dprint方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _http_request_func

# 需要导入模块: from ikalog.utils import IkaUtils [as 别名]
# 或者: from ikalog.utils.IkaUtils import dprint [as 别名]
    def _http_request_func(self, path, payload):
        url_api = '%s%s' % (self.base_uri, path)
        http_headers = {
            'Content-Type': 'application/x-msgpack',
        }
        mp_payload = ''.join(map(chr, umsgpack.packb(payload)))

        try:
            pool = urllib3.PoolManager(timeout=3.0)
            req = pool.urlopen(
                'POST',
                url_api,
                headers=http_headers,
                body=mp_payload,
            )
            return json.loads(req.data.decode('utf-8'))

        except urllib3.exceptions.MaxRetryError:
            fallback = self._fallback  # or .... or ...

            if fallback:
                IkaUtils.dprint(
                    '%s: Remote API Error. Falling back to local mode' % self)
                return self._local_request_func(path, payload)

        raise Exception(
            'API Error: Failed to connect to API endpoint. (No fallback)')
开发者ID:clovervidia,项目名称:IkaLog,代码行数:29,代码来源:client.py

示例2: __init__

# 需要导入模块: from ikalog.utils import IkaUtils [as 别名]
# 或者: from ikalog.utils.IkaUtils import dprint [as 别名]
 def __init__(self, bbox=None):
     '''
     bbox -- bbox Crop bounding box as (x, y, w, h)
     '''
     self._check_import()
     self._bbox = bbox
     self._launch = self._time()
     IkaUtils.dprint('%s: initalizing screen capture' % (self))
开发者ID:apricot385,项目名称:IkaLog,代码行数:10,代码来源:screencapture.py

示例3: init_for_cvfile

# 需要导入模块: from ikalog.utils import IkaUtils [as 别名]
# 或者: from ikalog.utils.IkaUtils import dprint [as 别名]
def init_for_cvfile(args, capture):
    if not capture.is_active():
        IkaUtils.dprint('Failed to initialize with: %s' % capture._source_file)
        sys.exit(1)

    pos_msec = args.get('time_msec') or time_to_msec(args.get('time') or '0:0')
    if pos_msec:
        capture.set_pos_msec(pos_msec)
开发者ID:syptn,项目名称:IkaLog,代码行数:10,代码来源:IkaLog.py

示例4: write_answer_file

# 需要导入模块: from ikalog.utils import IkaUtils [as 别名]
# 或者: from ikalog.utils.IkaUtils import dprint [as 别名]
    def write_answer_file(self, video_file, record):
        answer_fullpath = self.answer_filename(video_file, self.answer_type, None)

        f = open(answer_fullpath, "w")
        f.write(json.dumps(record))
        f.close()

        IkaUtils.dprint("wrote answer file %s" % answer_fullpath)
        return True
开发者ID:Bochozkar,项目名称:IkaLog,代码行数:11,代码来源:ResultDetail.py

示例5: evaluate

# 需要导入模块: from ikalog.utils import IkaUtils [as 别名]
# 或者: from ikalog.utils.IkaUtils import dprint [as 别名]
    def evaluate(self, img_bgr=None, img_gray=None):
        # if not hasattr(self, '_warned_evaluate_is_deprecated'):

        if not self._warned_evaluate_is_deprecated:

            IkaUtils.dprint('%s: evaluate() is depricated.' % self)
            self._warned_evaluate_is_deprecated = True

        return self(img_bgr=img_bgr, img_gray=img_gray)
开发者ID:clovervidia,项目名称:IkaLog,代码行数:11,代码来源:filters.py

示例6: IkaUI_main

# 需要导入模块: from ikalog.utils import IkaUtils [as 别名]
# 或者: from ikalog.utils.IkaUtils import dprint [as 别名]
def IkaUI_main():
    IkaUtils.dprint(_('Hello!'))

    application = wx.App()
    input_plugin = VideoCapture()

    engine = IkaEngine(keep_alive=True)
    engine.close_session_at_eof = True
    engine.set_capture(input_plugin)

    # 設定画面を持つ各種 Output Plugin
    # -> 設定画面の生成とプラグインリストへの登録
    outputs_with_gui = [
        outputs.CSV(),
        # outputs.Fluentd(),
        outputs.JSON(),
        # outputs.Hue(),
        outputs.OBS(),
        outputs.Twitter(),
        outputs.Screenshot(),
        outputs.Boyomi(),
        outputs.Slack(),
        outputs.StatInk(),
        outputs.DebugVideoWriter(),
        outputs.WebSocketServer(),
    ]
    gui = IkaLogGUI(engine, outputs_with_gui)

    plugins = []

    # とりあえずデバッグ用にコンソールプラグイン
    plugins.append(outputs.Console())

    # 各パネルをプラグインしてイベントを受信する
    plugins.append(gui.preview)
    plugins.append(gui.last_result)

    # 設定画面を持つ input plugin もイベントを受信する
    plugins.append(input_plugin)

    # UI 自体もイベントを受信
    plugins.append(gui)

    plugins.extend(outputs_with_gui)

    # 本当に困ったときのデバッグログ増加モード
    if 'IKALOG_DEBUG' in os.environ:
        plugins.append(outputs.DebugLog())

    # プラグインリストを登録
    engine.set_plugins(plugins)

    gui.run()
    application.MainLoop()

    IkaUtils.dprint(_('Bye!'))
开发者ID:hasegaw,项目名称:IkaLog,代码行数:58,代码来源:IkaUI.py

示例7: read_raw

# 需要导入模块: from ikalog.utils import IkaUtils [as 别名]
# 或者: from ikalog.utils.IkaUtils import dprint [as 别名]
    def read_raw(self):
        from PIL import ImageGrab

        try:
            img = ImageGrab.grab(None)
        except TypeError:
            # なぜ発生することがあるのか、よくわからない
            IkaUtils.dprint('%s: Failed to grab desktop image' % self)
            return None

        img = np.asarray(img)
        return img
开发者ID:joythegreat,项目名称:IkaLog,代码行数:14,代码来源:screencapture.py

示例8: read_frame

# 需要导入模块: from ikalog.utils import IkaUtils [as 别名]
# 或者: from ikalog.utils.IkaUtils import dprint [as 别名]
    def read_frame(self):
        try:
            self.lock.acquire()
            if not self.is_active():
                return None

            next_tick = None
            img = self._read_frame_func()

            # Skip some frames for performance.
            try:
                if self.cap_recorded_video:
                    self._skip_frame_recorded()
                else:
                    next_tick = self._skip_frame_realtime()
            except EOFError:
                pass  # EOFError should be captured by the next cycle.

        finally:
            self.lock.release()

        if img is None:
            return None

        if self.cap_optimal_input_resolution:
            res720p = (img.shape[0] == 720) and (img.shape[1] == 1280)
            res1080p = (img.shape[0] == 1080) and (img.shape[1] == 1920)

            if not (res720p or res1080p):
                IkaUtils.dprint(
                    'Invalid input resolution (%dx%d). Acceptable res: 1280x720 or 1920x1080' %
                    (img.shape[1], img.shape[0])
                )
                return None

        if next_tick is not None:
            self.last_tick = next_tick

        # need stratch?
        stratch = (
            img.shape[0] != self.output_geometry[0] or
            img.shape[1] != self.output_geometry[1])

        if stratch:
            img = cv2.resize(
                img,
                (self.output_geometry[1], self.output_geometry[0]),
                # fixme
            )

        img = self._offset_filter.execute(img)
        return img
开发者ID:hasegaw,项目名称:IkaLog,代码行数:54,代码来源:input.py

示例9: __init__

# 需要导入模块: from ikalog.utils import IkaUtils [as 别名]
# 或者: from ikalog.utils.IkaUtils import dprint [as 别名]
    def __init__(self, bbox=None):
        '''
        bbox -- bbox Crop bounding box as (x, y, w, h)
        '''
        self._check_import()

        self._launch = self._time()

        self._offset_filter = WarpFilter(self)
        self._calibration_requested = False
        if bbox is not None:
            self._offset_filter.set_bbox(
                bbox[0], bbox[1], bbox[2], bbox[3],
            )
            self._offset_filter.enable()

        IkaUtils.dprint('%s: initalizing screen capture' % (self))
开发者ID:tkymsd,项目名称:IkaLog,代码行数:19,代码来源:screencapture.py

示例10: predict

# 需要导入模块: from ikalog.utils import IkaUtils [as 别名]
# 或者: from ikalog.utils.IkaUtils import dprint [as 别名]
    def predict(self, img_weapon):
        t1 = time.time()
        feat_weapon = self.image_to_feature(img_weapon)
        # print(feat_weapon.shape)

        y = forward_mlp(feat_weapon, self._layers)
        y_id = np.argmax(y, axis=1)

        # print(y)
        # print(y_id)
        # print(self._weapons_keys[y_id[0]])
        # print(self._weapons_keys.index('sshooter'))

        t2 = time.time()

        IkaUtils.dprint('%s: predict %s took %s seconds' % (self, self._weapons_keys[y_id[0]], t2-t1))

        return self._weapons_keys[y_id[0]], 0
开发者ID:hasegaw,项目名称:IkaLog,代码行数:20,代码来源:weapon.py

示例11: _set_values

# 需要导入模块: from ikalog.utils import IkaUtils [as 别名]
# 或者: from ikalog.utils.IkaUtils import dprint [as 别名]
def _set_values(fields, dest, src):
    for field in fields:

        f_type = field[0]
        f_statink = field[1]
        f_ikalog = field[2]

        if (f_ikalog in src) and (src[f_ikalog] is not None):
            if f_type == 'int':
                try:
                    dest[f_statink] = int(src[f_ikalog])
                except:  # ValueError
                    IkaUtils.dprint('%s: field %s failed: src[%s] == %s' % (
                        self, f_statink, f_ikalog, src[f_ikalog]))
                    pass
            elif f_type == 'str':
                dest[f_statink] = str(src[f_ikalog])
            elif f_type == 'str_lower':
                dest[f_statink] = str(src[f_ikalog]).lower()
开发者ID:clovervidia,项目名称:IkaLog,代码行数:21,代码来源:reprocess_screenshots.py

示例12: auto_calibrate

# 需要导入模块: from ikalog.utils import IkaUtils [as 别名]
# 或者: from ikalog.utils.IkaUtils import dprint [as 别名]
 def auto_calibrate(self, img):
     r = self._warp_filter.calibrateWarp(
         img,
         validation_func=self.on_validate_warp
     )
     if r:
         self._warp_filter.enable()
         IkaUtils.dprint(_('Calibration succeeded!'))
         return True
     else:
         msg = '\n'.join([
             _('Calibration failed! Cannot detect WiiU display.'),
             _('IkaLog expects 1280 x 720, or 1920 x 1080 as input resolution.'),
         ])
         try:
             r = wx.MessageDialog(None, msg, _('Warning'),
                                  wx.OK | wx.ICON_ERROR).ShowModal()
         except:
             IkaUtils.dprint(msg)
         return False
开发者ID:joythegreat,项目名称:IkaLog,代码行数:22,代码来源:screencapture.py

示例13: auto_calibrate

# 需要导入模块: from ikalog.utils import IkaUtils [as 别名]
# 或者: from ikalog.utils.IkaUtils import dprint [as 别名]
 def auto_calibrate(self, img):
     r = self._warp_filter.calibrateWarp(
         img,
         validation_func=self.on_validate_warp
     )
     if r:
         self._warp_filter.enable()
         IkaUtils.dprint('キャリブレーション成功')
         return True
     else:
         msg = '\n'.join([
             'WiiU の画面が検知できませんでした',
             '入力サイズは 1280 x 720 もしくは 1920 x 1080 です。',
             'キャリブレーションを中断します。'
         ])
         try:
             r = wx.MessageDialog(None, msg, 'Warining',
                                  wx.OK | wx.ICON_ERROR).ShowModal()
         except:
             IkaUtils.dprint(msg)
         return False
开发者ID:Bochozkar,项目名称:IkaLog,代码行数:23,代码来源:screencapture.py

示例14: on_validate_warp

# 需要导入模块: from ikalog.utils import IkaUtils [as 别名]
# 或者: from ikalog.utils.IkaUtils import dprint [as 别名]
    def on_validate_warp(self, points):
        w = int(points[1][0] - points[0][0])
        h = int(points[2][1] - points[1][1])
        print('on_validate_warp: ', w, h)

        acceptable_geoms = [[720, 1280], [1080, 1920]]

        acceptable = False
        exact = False
        for geom in acceptable_geoms:
            if (geom[0] - 3 < h) and (h < geom[0] + 3):
                if (geom[1] - 3 < w) and (w < geom[1] + 3):
                    acceptable = True

            if geom[0] == h and geom[1] == w:
                exact = True

        if exact:
            pass

        elif acceptable:
            msg = '\n'.join([
                'キャリブレーションできましたが、期待する画面サイズと異なります (%d x %d)' % (w, h),
                'IkaLog への入力サイズは 1280 x 720 もしくは 1920 x 1080 です。',
                '各種認識が正常に動作しない可能性があります。', '',
                '再度キャリブレーションすると改善する場合があります。',
                '',
            ])
            try:
                r = wx.MessageDialog(None, msg, 'Warining',
                                     wx.OK | wx.ICON_ERROR).ShowModal()
            except:
                IkaUtils.dprint(msg)
        else:
            return False

        self.last_capture_geom = (h, w)
        return True
开发者ID:Bochozkar,项目名称:IkaLog,代码行数:40,代码来源:screencapture.py

示例15: on_validate_warp

# 需要导入模块: from ikalog.utils import IkaUtils [as 别名]
# 或者: from ikalog.utils.IkaUtils import dprint [as 别名]
    def on_validate_warp(self, points):
        w = int(points[1][0] - points[0][0])
        h = int(points[2][1] - points[1][1])
        print('on_validate_warp: ', w, h)

        acceptable_geoms = [[720, 1280], [1080, 1920]]

        acceptable = False
        exact = False
        for geom in acceptable_geoms:
            if (geom[0] - 3 < h) and (h < geom[0] + 3):
                if (geom[1] - 3 < w) and (w < geom[1] + 3):
                    acceptable = True

            if geom[0] == h and geom[1] == w:
                exact = True

        if exact:
            pass

        elif acceptable:
            msg = '\n'.join([
                _('Calibration succeeded!'),
                _('Due to the input resultion (%d x %d) some recognition may fail unexpectedly.') % (w, h),
                _('IkaLog expects 1280 x 720, or 1920 x 1080 as input resolution.'),
            ])
            try:
                r = wx.MessageDialog(None, msg, _('Warning'),
                                     wx.OK | wx.ICON_ERROR).ShowModal()
            except:
                IkaUtils.dprint(msg)
        else:
            return False

        self.last_capture_geom = (h, w)
        return True
开发者ID:joythegreat,项目名称:IkaLog,代码行数:38,代码来源:screencapture.py


注:本文中的ikalog.utils.IkaUtils.dprint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。