示例#1
0
 def test_hc(self):
     Z = ct.hierarchical_cluster(self.seed_pts, self.nx, self.ny)
     clusters = ct.fclusters(Z, self.seed_pts, nclusters=4)
     eq_(clusters,
             [
             set([(255, 256), (255, 255)]),
             set([(256, 0), (256, 511)]),
             set([(0, 256), (511, 256)]),
             set([(0, 1), (0, 0), (510, 3), (511, 511), (0, 511), (511, 0), (1, 1)]),
             ])
示例#2
0
 def test_bounding_box(self):
     Z = ct.hierarchical_cluster(self.seed_pts, self.nx, self.ny)
     clusters = ct.fclusters(Z, self.seed_pts, nclusters=4)
     bbs = []
     for cluster in clusters:
         bbs.append(ct.bounding_box(cluster, self.nx, self.ny))