def __init__(self, tracker): self.tracker = tracker self.button_click_radius = 15 self.heatmap_mode = Heatmap_Mode.WITHIN_SURFACE self.show_heatmap = False self.show_marker_ids = False self._edit_surf_corners = set() self._edit_surf_markers = set() self.heatmap_textures = {} self.surface_windows = {} self.color_primary_rgb = (255, 51, 153) self.color_secondary_rgb = (26, 217, 255) self.color_tertiary_rgb = (0, 209, 102) text_font_color_rgba = rgb_to_rgba( PUPIL_COLOR_RGB_PRIMARY_IRIS_LIGHT_BLUE) self.glfont = pyglui.pyfontstash.fontstash.Context() self.glfont.add_font("opensans", pyglui.ui.get_opensans_font_path()) self.glfont.set_size(23) self.glfont.set_color_float(text_font_color_rgba) self._draw_circle_filled = draw_circle_filled_func_builder()
def __init__(self, g_pool, fullscreen=False, monitor_idx=0): super().__init__(g_pool) self.collect_new = False self.calculated = False self.obj_grid = _gen_pattern_grid((4, 11)) self.img_points = [] self.obj_points = [] self.count = 10 self.display_grid = _make_grid() self._window = None self.menu = None self.button = None self.clicks_to_close = 5 self.window_should_close = False self.monitor_idx = monitor_idx self.fullscreen = fullscreen self.dist_mode = "Fisheye" self.glfont = fontstash.Context() self.glfont.add_font("opensans", get_opensans_font_path()) self.glfont.set_size(32) self.glfont.set_color_float((0.2, 0.5, 0.9, 1.0)) self.glfont.set_align_string(v_align="center") self.undist_img = None self.show_undistortion = False self.show_undistortion_switch = None if (hasattr(self.g_pool.capture, "intrinsics") and self.g_pool.capture.intrinsics): logger.info( "Click show undistortion to verify camera intrinsics calibration." ) logger.info( "Hint: Straight lines in the real world should be straigt in the image." ) else: logger.info( "No camera intrinsics calibration is currently set for this camera!" ) self._draw_circle_filled = draw_circle_filled_func_builder()
def __init__(self, marker_scale: float): # Public properties self.marker_scale = marker_scale self.is_marker_detected = False # Private state self.__state: _MarkerWindowState = MarkerWindowStateClosed() self.__window = GUIWindow() self.__window.add_observer("on_left_click", self._on_left_click) self.__window.add_observer("on_key_press_escape", self._on_key_press_escape) # Private font self.__glfont = fontstash.Context() self.__glfont.add_font("opensans", get_opensans_font_path()) self.__glfont.set_size(32) self.__glfont.set_color_float((0.2, 0.5, 0.9, 1.0)) self.__glfont.set_align_string(v_align="center") # Private helper self.__draw_circle_filled = draw_circle_filled_func_builder( cache_size=4)
def __init__(self, g_pool): super().__init__(g_pool) self.order = 0.8 self.pupil_display_list = [] self._draw_circle_filled = draw_circle_filled_func_builder()
See COPYING and COPYING.LESSER for license details. ---------------------------------------------------------------------------~(*) """ import logging from typing import Dict, Tuple import cv2 from pyglui.cygl.utils import RGBA, draw_polyline from gl_utils import draw_circle_filled_func_builder from pupil_detector_plugins import color_scheme logger = logging.getLogger(__name__) _draw_circle_filled = draw_circle_filled_func_builder() def draw_ellipse( ellipse: Dict, rgba: Tuple, thickness: float, draw_center: bool = False ): try: pts = cv2.ellipse2Poly( center=(int(ellipse["center"][0]), int(ellipse["center"][1])), axes=(int(ellipse["axes"][0] / 2), int(ellipse["axes"][1] / 2)), angle=int(ellipse["angle"]), arcStart=0, arcEnd=360, delta=8, ) except Exception as e:
def __init__(self, g_pool, **kwargs): super().__init__(g_pool, **kwargs) self.__number_of_ref_points_gathered_from_last_click = 0 self.__previously_detected_feature = None self.__feature_tracker = NaturalFeatureTracker() self._draw_circle_filled = draw_circle_filled_func_builder()