Пример #1
0
    def __init__(self, *args, dimsubls=10, dimres=45, **kwargs):
        self.l_dimsubls = dimsubls
        phi_h = 2*np.pi/np.ceil(dimres/(dimsubls - 1))

        self.N = self.N_image = np.prod(self.imagedims)
        self.rhoResolution = (self.N_image,)
        self.rhoGrid, h = cell_centered_grid(self.rhoDomain, self.rhoResolution)
        self.I = [self.curve(self.rhoGrid)]
        ManifoldValuedData.__init__(self, KleinBottle(phi_h), *args, **kwargs)
Пример #2
0
 def __init__(self, *args, **kwargs):
     self.I = synthetic_spd_img(10)
     self.imagedims = self.I.shape[:-1]
     self.d_image = len(self.imagedims)
     self.N = self.N_image = np.prod(self.imagedims)
     self.rhoResolution = self.imagedims
     self.rhoGrid, h = cell_centered_grid(self.rhoDomain, self.rhoResolution)
     s = 10
     h = 2*np.pi*s/5
     ManifoldValuedData.__init__(self, P2(s, h), *args, **kwargs)
Пример #3
0
    def __init__(self, *args, labels=(2, 20), **kwargs):
        assert len(labels) == 2
        dimls, self.l_dimsubls = labels

        self.N = self.N_image = np.prod(self.imagedims)
        self.rhoResolution = (self.N_image,)
        self.rhoGrid, h = cell_centered_grid(self.rhoDomain, self.rhoResolution)
        self.I = [self.curve(self.rhoGrid)]
        ManifoldValuedData.__init__(self, Cube(2.1, dimls), *args, **kwargs)
        self.data_b = self.curve(self.rhoGrid)
Пример #4
0
 def __init__(self, *args, **kwargs):
     self.I = np.array(rgb2hsv(astronaut())[:80, :80, 0], dtype=np.float64)
     self.I *= 2 * np.pi  # I comes with hue normalized to [0,1]
     self.imagedims = self.I.shape
     self.d_image = len(self.imagedims)
     self.N = self.N_image = np.prod(self.imagedims)
     self.rhoResolution = self.imagedims
     self.rhoGrid, h = cell_centered_grid(self.rhoDomain,
                                          self.rhoResolution)
     ManifoldValuedData.__init__(self, Circle(2 * np.pi / 5), *args,
                                 **kwargs)
Пример #5
0
 def __init__(self, *args, **kwargs):
     self.I = np.float64(imread("data/vesuflat.gif")) / 255.0
     self.I *= 2 * np.pi  # I comes with hue normalized to [0,1]
     self.imagedims = self.I.shape
     self.d_image = len(self.imagedims)
     self.N = self.N_image = np.prod(self.imagedims)
     self.rhoResolution = self.imagedims
     self.rhoGrid, h = cell_centered_grid(self.rhoDomain,
                                          self.rhoResolution)
     ManifoldValuedData.__init__(self, Circle(2 * np.pi / 5), *args,
                                 **kwargs)
Пример #6
0
    def __init__(self,
                 *args,
                 dimsubls=6,
                 dimres=50,
                 mode="complete",
                 **kwargs):
        self.l_dimsubls = dimsubls
        so3_h = 2 * np.pi / np.ceil(dimres / (dimsubls - 1))

        nqs = 5 if mode in ["top-bottom", "corners"] else 16
        self.imagedims = (nqs, nqs)

        self.N = self.N_image = np.prod(self.imagedims)
        self.rhoResolution = self.imagedims
        self.rhoGrid, h = cell_centered_grid(self.rhoDomain,
                                             self.rhoResolution)

        q1 = np.array([np.cos(np.pi / 4), 0, np.sin(np.pi / 4), 0])
        q2 = np.array([np.cos(np.pi / 2), np.sin(np.pi / 2), 0, 0])
        qbase = quaternion_prod(q2, q1)
        h1 = -0.3 + np.linspace(0, 2 * np.pi, nqs)[:, None]
        h2 = -0.3 + np.linspace(0, 2 * np.pi, nqs)[None]
        q3 = np.stack((
            -np.cos(h2 / 3) * np.cos(h1 / 2),
            np.cos(h2 / 3) * np.sin(h1 / 2),
            -np.sin(h2 / 3) * np.sin(h1 / 6),
            np.sin(h2 / 3) * np.cos(h1 / 6),
        ),
                      axis=2).reshape(-1, 4)
        q = normalize(quaternion_prod(q3[None], qbase[None, None])[0, :, 0])

        self.I = np.zeros(self.imagedims + (4, ), dtype=np.float64, order='C')
        self.I[:] = q.reshape(self.imagedims + (4, ))
        self.inpaint_msk = np.ones(self.imagedims, dtype=bool)
        self.constr_msk = np.zeros(self.imagedims, dtype=bool)
        if mode == "top-bottom":
            self.inpaint_msk[[0, -1], :5] = False
        elif mode == "corners":
            self.inpaint_msk[[0, 0, -1, -1], [0, -1, 0, -1]] = False
        else:
            if mode == "edge":
                self.I[:, -5:] = np.array(
                    [-np.cos(np.pi / 3), 0, -np.sin(np.pi / 3), 0])[None, None]
            self.inpaint_msk[:, [0, 1, -2, -1]] = False
            self.inpaint_msk[[0, 1, -2, -1], :] = False
        self.constr_msk[:] = np.logical_not(self.inpaint_msk)

        self.inpaint_msk = self.inpaint_msk.reshape(-1)
        self.constr_msk = self.constr_msk.reshape(-1)
        self.I = self.I.reshape(-1, 4)
        self.I[self.inpaint_msk] = [[1, 0, 0, 0]]
        self.constraints = [self.constr_msk, self.I]
        ManifoldValuedData.__init__(self, SO3(so3_h), *args, **kwargs)
Пример #7
0
    def __init__(self, *args, **kwargs):
        np.random.seed(134182)
        self.points = 2 * np.pi * np.random.rand(10, 1)
        self.weights = np.random.rand(10)
        self.weights /= self.weights.sum()
        self.initializer = np.array([np.pi])

        self.d_image = len(self.imagedims)
        self.N = self.N_image = np.prod(self.imagedims)
        self.rhoResolution = self.imagedims
        self.rhoGrid, h = cell_centered_grid(self.rhoDomain,
                                             self.rhoResolution)
        ManifoldValuedData.__init__(self, Circle(2 * np.pi / 3), *args,
                                    **kwargs)
Пример #8
0
 def __init__(self, *args, dimsubls=10, dimres=45, use_hr=False, **kwargs):
     if use_hr:
         self.filename = "data/bullhr-nn.mat"
     self.l_dimsubls = dimsubls
     sph_h = 2 * np.pi / np.ceil(dimres / (dimsubls - 1))
     self.extra = loadmat(self.filename)
     self.imagedims = self.extra['uuh'].shape
     self.d_image = len(self.imagedims)
     self.I = self.extra['nn'].reshape((3, ) + self.imagedims)
     self.I = self.I.transpose(2, 1, 0)
     self.N = self.N_image = np.prod(self.imagedims)
     self.rhoResolution = self.imagedims
     self.rhoGrid, _ = cell_centered_grid(self.rhoDomain,
                                          self.rhoResolution)
     ManifoldValuedData.__init__(self, Sphere(sph_h), *args, **kwargs)