Exemplo n.º 1
0
 def test_colour_cut(self):
     p = coord_path.build(coord_path.line((0, 0), (0, 0)))
     image = np.arange(27).reshape((3, 3, 3))
     cp = cut.along_path(p, image, shape=(3, 3), centre=(0, 0))
     cut_img = cp.next()
     assert_equal(cut_img.shape, (3, 3, 3))
     assert_equal(cut_img[:], image[:])
Exemplo n.º 2
0
    def test_centre_cut(self):
        p = coord_path.build(coord_path.line((1, 1), (1, 1)))
        image = np.arange(12).reshape((4, 3))
        cp = cut.along_path(p, image, shape=(3, 3))

        cut_img = cp.next()
        assert_equal(cut_img.shape, (3, 3))
        assert_array_almost_equal(cut_img, [[0, 1, 2], [3, 4, 5], [6, 7, 8]])
Exemplo n.º 3
0
 def test_dtype(self):
     p = coord_path.build(coord_path.line((0, 0), (0, 0)))
     image = np.arange(12).reshape((4, 3)).astype(np.uint8)
     cut_img = cut.along_path(p, image).next()
     assert_equal(image.dtype, cut_img.dtype)
Exemplo n.º 4
0
 def test_2D(self):
     cut.along_path(None, None, shape=(3, 3, 3)).next()
Exemplo n.º 5
0
 def test_completely_outside(self):
     p = (50, 50)
     image = np.arange(12).reshape((4, 3))
     cp = cut.along_path(p, image, shape=(5, 5), centre=(0, 0))
     list(cp)
Exemplo n.º 6
0
 def test_outside(self):
     p = coord_path.build(coord_path.line((4, 4), (4, 4)))
     image = np.arange(12).reshape((4, 3))
     cp = cut.along_path(p, image, shape=(5, 5), centre=(0, 0))
     list(cp)