def build_point_cloud(self, projector_camera: Camera, camera: Camera): w, h = self._wh camera_ps3d = self._create_pixels_3d(camera, w, h) projector_ps3d = self._create_pixels_3d(projector_camera, 2**self._max_projector_lod, 2) is_central_line_pixel = self._line_extraction_processor.process( self._stripe_ids_img) self._is_ok_mask = self._is_ok_mask & is_central_line_pixel points_3d = [] y_ids, x_ids = np.nonzero(self._is_ok_mask) for y_id, x_id in zip(y_ids, x_ids): # TODO: this is bottle-neck ray = math.normalize(camera_ps3d[x_id, y_id] - camera.get_position()) stripe_id = self._stripe_ids_img[y_id, x_id] stripe_plane = math.plane_by_points([ projector_camera.get_position(), projector_ps3d[stripe_id, 0], projector_ps3d[stripe_id, 1] ]) p3d = math.intersect_plane_line(stripe_plane, ray, camera.get_position()) points_3d.append(p3d) return np.array(points_3d)
def get_mv_matrix(self): camera_position = self.target - math.normalize( self._get_camera_direction()) * self.distance return math.look_at_matrix(camera_position, self.target, up=[0, 0, 1], right=self._get_direction(self.course + 90))
def build_point_cloud(self, projector_camera: Camera, camera: Camera): w, h = self._wh camera_ps3d = self._create_pixels_3d(camera, w, h) projector_ps3d = self._create_pixels_3d(projector_camera, 2 ** self._max_projector_lod, 2) is_central_line_pixel = self._line_extraction_processor.process(self._stripe_ids_img) self._is_ok_mask = self._is_ok_mask & is_central_line_pixel points_3d = [] y_ids, x_ids = np.nonzero(self._is_ok_mask) for y_id, x_id in zip(y_ids, x_ids): # TODO: this is bottle-neck ray = math.normalize(camera_ps3d[x_id, y_id] - camera.get_position()) stripe_id = self._stripe_ids_img[y_id, x_id] stripe_plane = math.plane_by_points([projector_camera.get_position(), projector_ps3d[stripe_id, 0], projector_ps3d[stripe_id, 1]]) p3d = math.intersect_plane_line(stripe_plane, ray, camera.get_position()) points_3d.append(p3d) return np.array(points_3d)
def get_mv_matrix(self): camera_position = self.target - math.normalize(self._get_camera_direction()) * self.distance return math.look_at_matrix(camera_position, self.target, up=[0, 0, 1], right=self._get_direction(self.course + 90))
def get_position(self): return self.target - math.normalize(self._get_camera_direction()) * self.distance
def get_position(self): return self.target - math.normalize( self._get_camera_direction()) * self.distance