コード例 #1
0
ファイル: test_cut.py プロジェクト: Germanc/supreme
 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[:])
コード例 #2
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[:])
コード例 #3
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]])
コード例 #4
0
ファイル: test_cut.py プロジェクト: Germanc/supreme
    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]])
コード例 #5
0
ファイル: coord_path.py プロジェクト: stefanv/supreme
def add_line(img, c0, c1, col=[1., 0, 0]):
    p = cp.build(cp.line(c0, c1))
    add_path(img, p, col)
コード例 #6
0
 def test_line(self):
     l = coord_path.line((0, 0), (0, 1))
     c = [coord for coord in l]
     assert_array_equal(c[0], [0, 0])
     assert_array_equal(c[-1], [0, 1])
     assert (len(c) >= 2)
コード例 #7
0
ファイル: test_cut.py プロジェクト: Germanc/supreme
 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)
コード例 #8
0
ファイル: test_cut.py プロジェクト: Germanc/supreme
 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)
コード例 #9
0
ファイル: coord_path.py プロジェクト: Germanc/supreme
def add_line(img,c0,c1,col=[1.,0,0]):
    p = cp.build(cp.line(c0,c1))
    add_path(img,p,col)
コード例 #10
0
ファイル: test_coord_path.py プロジェクト: Germanc/supreme
 def test_line(self):
     l = coord_path.line((0, 0), (0, 1))
     c = [coord for coord in l]
     assert_array_equal(c[0], [0, 0])
     assert_array_equal(c[-1], [0, 1])
     assert(len(c) >= 2)
コード例 #11
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)
コード例 #12
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)