Exemplo n.º 1
0
    def make_img(self, size):
        # Generate Pupil Labs colored gradient
        self._img = np.zeros((size[1], size[0], 3), dtype=np.uint8)
        self._img[:, :, 0] += np.linspace(91, 157, self.frame_size[0], dtype=np.uint8)
        self._img[:, :, 1] += np.linspace(165, 161, self.frame_size[0], dtype=np.uint8)
        self._img[:, :, 2] += np.linspace(35, 112, self.frame_size[0], dtype=np.uint8)

        self._intrinsics = Dummy_Camera(size, self.name)
Exemplo n.º 2
0
 def make_img(self,size):
     c_w ,c_h = max(1,size[0]/30),max(1,size[1]/30)
     coarse = np.random.randint(0,200,size=(int(c_h),int(c_w),3)).astype(np.uint8)
     # coarse[:,:,1] /=5
     # coarse[:,:,2] *=0
     # coarse[:,:,1] /=30
     # self._img = np.ones((size[1],size[0],3),dtype=np.uint8)
     self._img = cv2.resize(coarse,size,interpolation=cv2.INTER_LANCZOS4)
     self._intrinsics = Dummy_Camera(size, self.name)
Exemplo n.º 3
0
 def intrinsics(self):
     if self._intrinsics is None or self._intrinsics.resolution != self.frame_size:
         if self.projection_matrix is None:
             distortion = [[0.0, 0.0, 0.0, 0.0, 0.0]]
             self._intrinsics = Radial_Dist_Camera(
                 self.projection_matrix, distortion, self.frame_size, self.name
             )
         else:
             self._intrinsics = Dummy_Camera(self.frame_size, self.name)
     return self._intrinsics
Exemplo n.º 4
0
 def make_img(self, size):
     self._img = np.zeros((size[1], size[0], 3), dtype=np.uint8)
     self._img[:, :, 0] += np.linspace(91,
                                       157,
                                       self.frame_size[0],
                                       dtype=np.uint8)
     self._img[:, :, 1] += np.linspace(100,
                                       1,
                                       self.frame_size[0],
                                       dtype=np.uint8)
     self._img[:, :, 2] += np.linspace(100,
                                       112,
                                       self.frame_size[0],
                                       dtype=np.uint8)
     self._intrinsics = Dummy_Camera(size, self.name)
Exemplo n.º 5
0
    def intrinsics(self):
        if not self.online:
            return self._intrinsics or Dummy_Camera(self.frame_size, self.name)

        if self._intrinsics is None or self._intrinsics.resolution != self.frame_size:
            lens_params = self.camera.get_lens_parameters()
            c_x, c_y = lens_params.principal_point
            f_x, f_y = lens_params.focal_length
            p_1, p_2 = lens_params.distortion_tangential
            k_1, k_2, *k_other = lens_params.distortion_radial
            K = [[f_x, 0.0, c_x], [0.0, f_y, c_y], [0.0, 0.0, 1.0]]
            D = k_1, k_2, p_1, p_2, *k_other
            self._intrinsics = Radial_Dist_Camera(K, D, self.frame_size, self.name)

            with open(os.path.join(self.g_pool.user_dir, "picoflexx_intrinsics"), "wb") as f:
                pickle.dump([
                    K, D, self.frame_size, self.name
                ], f)
        return self._intrinsics