Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed ply generation to support official ply headers (mapillary#932)
Summary: This PR is in regards to the issue mapillary#741. As open3D does not currently support user-defined headers, the following command fails to load colors from the ply file because OpenSfM generates ply file with `diffuse_` prefix to the color headers. ``` import open3d as o3d pcd = o3d.io.read_point_cloud('merged.ply') print(pcd.colors) >>pcd.colors => std::vector<Eigen::Vector3d> with 0 elements. ``` To support [official ply headers](http://paulbourke.net/dataformats/ply/), `point_cloud_to_ply` and `ply_header` functions have been modified in the `OpenSfM/opensfm/io.py`. ``` def point_cloud_to_ply( points: np.ndarray, normals: np.ndarray, colors: np.ndarray, labels: np.ndarray, fp: TextIO, ) -> None: ... fp.write("property uchar red\n") # Changed from diffuse_red fp.write("property uchar green\n") # Changed from diffuse_green fp.write("property uchar blue\n") # Changed from diffuse_blue fp.write("property uchar class\n") fp.write("end_header\n") ... ``` Pull Request resolved: mapillary#932 Reviewed By: YanNoun Differential Revision: D37817489 Pulled By: fabianschenk fbshipit-source-id: cde2a8172a2bf2f8256c9772a6bad4decaa9de78
- Loading branch information