def test_trimesh_init_from_depth_image(): fake_z = np.random.uniform(size=(10, 10)) tm = TriMesh.init_from_depth_image(Image(fake_z)) assert tm.n_points == 100 assert tm.n_dims == 3 assert_allclose(tm.range()[:2], [9, 9]) assert tm.points[:, -1].max() <= 1.0 assert tm.points[:, -1].min() >= 0.0
def test_trimesh_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) tm = TriMesh.init_from_depth_image(im) assert tm.n_points == 16 assert tm.n_dims == 3 assert_allclose(tm.range()[:2], [3, 3]) assert tm.points[:, -1].max() <= 1.0 assert tm.points[:, -1].min() >= 0.0