Source code for torch_geometric.io.ply
import torch
from torch_geometric.data import Data
try:
import openmesh
except ImportError:
openmesh = None
[docs]def read_ply(path):
if openmesh is None:
raise ImportError('`read_ply` requires the `openmesh` package.')
mesh = openmesh.read_trimesh(path)
pos = torch.from_numpy(mesh.points()).to(torch.float)
face = torch.from_numpy(mesh.face_vertex_indices())
face = face.t().to(torch.long).contiguous()
return Data(pos=pos, face=face)