示例#1
0
    def test_xyz2luv(self):
        assert_array_almost_equal(xyz2luv(self.xyz_array), self.luv_array, decimal=3)

        # Test the conversion with the rest of the illuminants.
        for I in ["d50", "d55", "d65", "d75"]:
            for obs in ["2", "10"]:
                fname = "luv_array_{0}_{1}.npy".format(I, obs)
                luv_array_I_obs = np.load(os.path.join(os.path.dirname(__file__), "data", fname))
                assert_array_almost_equal(luv_array_I_obs, xyz2luv(self.xyz_array, I, obs), decimal=2)
        for I in ["a", "e"]:
            fname = "luv_array_{0}_2.npy".format(I)
            luv_array_I_obs = np.load(os.path.join(os.path.dirname(__file__), "data", fname))
            assert_array_almost_equal(luv_array_I_obs, xyz2luv(self.xyz_array, I, "2"), decimal=2)
示例#2
0
    def test_xyz2luv(self):
        assert_array_almost_equal(xyz2luv(self.xyz_array),
                                  self.luv_array, decimal=3)

        # Test the conversion with the rest of the illuminants.
        for I in ["d50", "d55", "d65", "d75"]:
            for obs in ["2", "10"]:
                fname = "color/tests/data/luv_array_{0}_{1}.npy".format(I, obs)
                luv_array_I_obs = np.load(fetch(fname))
                assert_array_almost_equal(luv_array_I_obs,
                                          xyz2luv(self.xyz_array, I, obs),
                                          decimal=2)
        for I in ["a", "e"]:
            fname = "color/tests/data/luv_array_{0}_2.npy".format(I)
            luv_array_I_obs = np.load(fetch(fname))
            assert_array_almost_equal(luv_array_I_obs,
                                      xyz2luv(self.xyz_array, I, "2"),
                                      decimal=2)
示例#3
0
    def test_xyz2luv(self):
        assert_array_almost_equal(xyz2luv(self.xyz_array),
                                  self.luv_array, decimal=3)

        # Test the conversion with the rest of the illuminants.
        for I in ["d50", "d55", "d65", "d75"]:
            for obs in ["2", "10"]:
                fname = "luv_array_{0}_{1}.npy".format(I, obs)
                luv_array_I_obs = np.load(
                    os.path.join(os.path.dirname(__file__), 'data', fname))
                assert_array_almost_equal(luv_array_I_obs,
                                          xyz2luv(self.xyz_array, I, obs),
                                          decimal=2)
        for I in ["a", "e"]:
            fname = "luv_array_{0}_2.npy".format(I)
            luv_array_I_obs = np.load(
                os.path.join(os.path.dirname(__file__), 'data', fname))
            assert_array_almost_equal(luv_array_I_obs,
                                      xyz2luv(self.xyz_array, I, "2"),
                                      decimal=2)
示例#4
0
    def test_xyz2luv(self):
        assert_array_almost_equal(xyz2luv(self.xyz_array),
                                  self.luv_array,
                                  decimal=3)

        # Test the conversion with the rest of the illuminants.
        for I in ["A", "B", "C", "d50", "d55", "d65"]:
            I = I.lower()
            for obs in ["2", "10", "R"]:
                obs = obs.lower()
                fname = f'color/tests/data/luv_array_{I}_{obs}.npy'
                luv_array_I_obs = np.load(fetch(fname))
                assert_array_almost_equal(luv_array_I_obs,
                                          xyz2luv(self.xyz_array, I, obs),
                                          decimal=2)
        for I in ["d75", "e"]:
            fname = f'color/tests/data/luv_array_{I}_2.npy'
            luv_array_I_obs = np.load(fetch(fname))
            assert_array_almost_equal(luv_array_I_obs,
                                      xyz2luv(self.xyz_array, I, "2"),
                                      decimal=2)
示例#5
0
    def test_xyz2luv_dtype(self):
        img = self.xyz_array.astype('float64')
        img32 = img.astype('float32')

        assert xyz2luv(img).dtype == img.dtype
        assert xyz2luv(img32).dtype == img32.dtype
示例#6
0
 def test_xyz2luv(self):
     assert_array_almost_equal(xyz2luv(self.xyz_array),
                               self.luv_array, decimal=3)
示例#7
0
 def test_xyz2luv(self):
     assert_array_almost_equal(xyz2luv(self.xyz_array),
                               self.luv_array,
                               decimal=3)
示例#8
0
 def test_xyz2luv_channel_axis(self, channel_axis):
     # test conversion with channels along a specified axis
     xyz = np.moveaxis(self.xyz_array, source=-1, destination=channel_axis)
     luv = xyz2luv(xyz, channel_axis=channel_axis)
     luv = np.moveaxis(luv, source=channel_axis, destination=-1)
     assert_array_almost_equal(luv, self.luv_array, decimal=3)
示例#9
0
文件: image.py 项目: zshipko/imagepy
 def to_luv_from_xyz(self):
     return Image(xyz2luv(self.to_rgb_from_gray()[:, :, :3])).convert_type(self.dtype)