Exemple #1
0
 def test_estimate_vertex_normals(self):
     # normals of a sphere should be scaled versions of the vertices
     m = Mesh(filename=self.test_sphere_path)
     m.v -= np.mean(m.v, axis=0)
     rad = np.linalg.norm(m.v[0])
     vn = np.array(m.estimate_vertex_normals())
     mse = np.mean(np.sqrt(np.sum((vn - m.v / rad)**2, axis=1)))
     self.assertTrue(mse < 0.05)
Exemple #2
0
    def test_vert_normals(self):
        from psbody.mesh.geometry.vert_normals import VertNormals
        from psbody.mesh.mesh import Mesh
        mesh = Mesh(filename=os.path.join(test_data_folder, 'sphere.ply'))
        pred = VertNormals(mesh.v, mesh.f)

        vn_obs = mesh.estimate_vertex_normals().reshape((-1, 3))
        vn_pred = pred.reshape((-1, 3))

        self.assertTrue(np.max(np.abs(vn_pred.flatten() - vn_obs.flatten())) < 1e-15)