本文整理汇总了Python中menpo.shape.PointUndirectedGraph.init_from_depth_image方法的典型用法代码示例。如果您正苦于以下问题:Python PointUndirectedGraph.init_from_depth_image方法的具体用法?Python PointUndirectedGraph.init_from_depth_image怎么用?Python PointUndirectedGraph.init_from_depth_image使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类menpo.shape.PointUndirectedGraph
的用法示例。
在下文中一共展示了PointUndirectedGraph.init_from_depth_image方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_init_from_depth_image
# 需要导入模块: from menpo.shape import PointUndirectedGraph [as 别名]
# 或者: from menpo.shape.PointUndirectedGraph import init_from_depth_image [as 别名]
def test_init_from_depth_image():
fake_z = np.random.uniform(size=(10, 10))
g = PointTree.init_from_depth_image(Image(fake_z))
assert g.n_dims == 3
assert g.root_vertex == 55
assert g.adjacency_matrix.nnz == 99
assert g.n_points == 100
g = PointUndirectedGraph.init_from_depth_image(Image(fake_z))
assert g.n_dims == 3
assert g.adjacency_matrix.nnz == 360
assert g.n_points == 100
g = PointDirectedGraph.init_from_depth_image(Image(fake_z))
assert g.n_dims == 3
assert g.adjacency_matrix.nnz == 360
assert g.n_points == 100
示例2: test_init_from_depth_image_masked
# 需要导入模块: from menpo.shape import PointUndirectedGraph [as 别名]
# 或者: from menpo.shape.PointUndirectedGraph import init_from_depth_image [as 别名]
def test_init_from_depth_image_masked():
fake_z = np.random.uniform(size=(10, 10))
mask = np.zeros(fake_z.shape, dtype=np.bool)
mask[2:6, 2:6] = True
im = MaskedImage(fake_z, mask=mask)
g = PointTree.init_from_depth_image(im)
assert g.n_dims == 3
assert g.root_vertex == 0
assert g.adjacency_matrix.nnz == 15
assert g.n_points == 16
g = PointUndirectedGraph.init_from_depth_image(im)
assert g.n_dims == 3
assert g.adjacency_matrix.nnz == 48
assert g.n_points == 16
g = PointDirectedGraph.init_from_depth_image(im)
assert g.n_dims == 3
assert g.adjacency_matrix.nnz == 48
assert g.n_points == 16