def __init__(self, g_pool, world_camera_intrinsics , cal_ref_points_3d, cal_observed_points_3d, eye_camera_to_world_matrix0 , cal_gaze_points0_3d, eye_camera_to_world_matrix1 = np.eye(4) , cal_gaze_points1_3d = [], run_independently = False , name = "Calibration Visualizer" ): super().__init__( g_pool,name, run_independently) self.image_width = 640 # right values are assigned in update self.focal_length = 620 self.image_height = 480 self.eye_camera_to_world_matrix0 = eye_camera_to_world_matrix0 self.eye_camera_to_world_matrix1 = eye_camera_to_world_matrix1 self.cal_ref_points_3d = cal_ref_points_3d self.cal_observed_points_3d = cal_observed_points_3d self.cal_gaze_points0_3d = cal_gaze_points0_3d self.cal_gaze_points1_3d = cal_gaze_points1_3d if world_camera_intrinsics: self.world_camera_width = world_camera_intrinsics['resolution'][0] self.world_camera_height = world_camera_intrinsics['resolution'][1] self.world_camera_focal = (world_camera_intrinsics['camera_matrix'][0][0] + world_camera_intrinsics['camera_matrix'][1][1] ) / 2.0 else: self.world_camera_width = 0 self.world_camera_height = 0 self.world_camera_focal = 0 camera_fov = math.degrees(2.0 * math.atan( self.window_size[0] / (2.0 * self.focal_length))) self.trackball = Trackball(camera_fov) self.trackball.distance = [0,0,-80.] self.trackball.pitch = 210 self.trackball.roll = 0
def __init__(self, g_pool, world_camera_intrinsics , cal_ref_points_3d, eye_to_world_matrix0 , cal_gaze_points0_3d, eye_to_world_matrix1 = np.eye(4) , cal_gaze_points1_3d = [], name = "Debug Calibration Visualizer", run_independently = False): # super(Visualizer, self).__init__() self.g_pool = g_pool self.image_width = 640 # right values are assigned in update self.focal_length = 620 self.image_height = 480 self.eye_to_world_matrix0 = eye_to_world_matrix0 self.eye_to_world_matrix1 = eye_to_world_matrix1 self.cal_ref_points_3d = cal_ref_points_3d self.cal_gaze_points0_3d = cal_gaze_points0_3d self.cal_gaze_points1_3d = cal_gaze_points1_3d self.world_camera_width = world_camera_intrinsics['resolution'][0] self.world_camera_height = world_camera_intrinsics['resolution'][1] self.world_camera_focal = (world_camera_intrinsics['camera_matrix'][0][0] + world_camera_intrinsics['camera_matrix'][1][1] ) / 2.0 # transformation matrices self.anthromorphic_matrix = self.get_anthropomorphic_matrix() self.adjusted_pixel_space_matrix = self.get_adjusted_pixel_space_matrix(1) self.name = name self.window_size = (640,480) self.window = None self.input = None self.run_independently = run_independently camera_fov = math.degrees(2.0 * math.atan( self.window_size[0] / (2.0 * self.focal_length))) self.trackball = Trackball(camera_fov) self.trackball.distance = [0,0,-0.1] self.trackball.pitch = 0 self.trackball.roll = 180
def __init__(self,g_pool , focal_length ): super(Eye_Visualizer, self).__init__(g_pool , "Debug Visualizer", False) self.focal_length = focal_length self.image_width = 640 # right values are assigned in update self.image_height = 480 camera_fov = math.degrees(2.0 * math.atan( self.image_height / (2.0 * self.focal_length))) self.trackball = Trackball(camera_fov)
def open_window(self): if not self._window: if self.fullscreen: monitor = glfwGetMonitors()[self.monitor_idx] mode = glfwGetVideoMode(monitor) height, width = mode[0], mode[1] else: monitor = None height, width = ( 640, int(640.0 / (self.real_world_size["x"] / self.real_world_size["y"])), ) # open with same aspect ratio as surface self._window = glfwCreateWindow( height, width, "Reference Surface: " + self.name, monitor=monitor, share=glfwGetCurrentContext(), ) if not self.fullscreen: glfwSetWindowPos( self._window, self.window_position_default[0], self.window_position_default[1], ) self.trackball = Trackball() self.input = {"down": False, "mouse": (0, 0)} # Register callbacks glfwSetFramebufferSizeCallback(self._window, self.on_resize) glfwSetKeyCallback(self._window, self.on_window_key) glfwSetWindowCloseCallback(self._window, self.on_close) glfwSetMouseButtonCallback(self._window, self.on_window_mouse_button) glfwSetCursorPosCallback(self._window, self.on_pos) glfwSetScrollCallback(self._window, self.on_scroll) self.on_resize(self._window, *glfwGetFramebufferSize(self._window)) # gl_state settings active_window = glfwGetCurrentContext() glfwMakeContextCurrent(self._window) basic_gl_setup() make_coord_system_norm_based() # refresh speed settings glfwSwapInterval(0) glfwMakeContextCurrent(active_window)
def __init__(self,focal_length, name = "Debug Visualizer", run_independently = False): # super(Visualizer, self).__init__() self.focal_length = focal_length self.image_width = 640 # right values are assigned in update self.image_height = 480 # transformation matrices self.anthromorphic_matrix = self.get_anthropomorphic_matrix() self.name = name self.window_size = (640,480) self._window = None self.input = None self.run_independently = run_independently camera_fov = math.degrees(2.0 * math.atan( self.image_height / (2.0 * self.focal_length))) self.trackball = Trackball(camera_fov)
def __init__(self, g_pool, focal_length): super().__init__(g_pool, "Debug Visualizer", False) self.focal_length = focal_length self.image_width = 192 # right values are assigned in update self.image_height = 192 camera_fov = math.degrees(2.0 * math.atan(self.image_height / (2.0 * self.focal_length))) self.trackball = Trackball(camera_fov) # self.residuals_single_means = deque(np.zeros(50), 50) # self.residuals_single_stds = deque(np.zeros(50), 50) # self.residuals_means = deque(np.zeros(50), 50) # self.residuals_stds = deque(np.zeros(50), 50) self.eye = LeGrandEye() self.cost_history = deque([], maxlen=200) self.optimization_number = 0