Exemple #1
0
 def test_yuv_roundtrip(self):
     img_rgb = img_as_float(self.img_rgb)[::16, ::16]
     assert_array_almost_equal(yuv2rgb(rgb2yuv(img_rgb)), img_rgb)
     assert_array_almost_equal(yiq2rgb(rgb2yiq(img_rgb)), img_rgb)
     assert_array_almost_equal(ypbpr2rgb(rgb2ypbpr(img_rgb)), img_rgb)
     assert_array_almost_equal(ycbcr2rgb(rgb2ycbcr(img_rgb)), img_rgb)
     assert_array_almost_equal(ydbdr2rgb(rgb2ydbdr(img_rgb)), img_rgb)
 def test_yuv_roundtrip(self):
     img_rgb = img_as_float(self.img_rgb)[::16, ::16]
     assert_array_almost_equal(yuv2rgb(rgb2yuv(img_rgb)), img_rgb)
     assert_array_almost_equal(yiq2rgb(rgb2yiq(img_rgb)), img_rgb)
     assert_array_almost_equal(ypbpr2rgb(rgb2ypbpr(img_rgb)), img_rgb)
     assert_array_almost_equal(ycbcr2rgb(rgb2ycbcr(img_rgb)), img_rgb)
     assert_array_almost_equal(ydbdr2rgb(rgb2ydbdr(img_rgb)), img_rgb)
 def test_yuv_roundtrip(self, channel_axis):
     img_rgb = img_as_float(self.img_rgb)[::16, ::16]
     img_rgb = np.moveaxis(img_rgb, source=-1, destination=channel_axis)
     assert_array_almost_equal(
         yuv2rgb(rgb2yuv(img_rgb, channel_axis=channel_axis),
                 channel_axis=channel_axis), img_rgb)
     assert_array_almost_equal(
         yiq2rgb(rgb2yiq(img_rgb, channel_axis=channel_axis),
                 channel_axis=channel_axis), img_rgb)
     assert_array_almost_equal(
         ypbpr2rgb(rgb2ypbpr(img_rgb, channel_axis=channel_axis),
                   channel_axis=channel_axis), img_rgb)
     assert_array_almost_equal(
         ycbcr2rgb(rgb2ycbcr(img_rgb, channel_axis=channel_axis),
                   channel_axis=channel_axis), img_rgb)
     assert_array_almost_equal(
         ydbdr2rgb(rgb2ydbdr(img_rgb, channel_axis=channel_axis),
                   channel_axis=channel_axis), img_rgb)