NeoGeographyToolkit / StereoPipeline

The NASA Ames Stereo Pipeline is a suite of automated geodesy & stereogrammetry tools designed for processing planetary imagery captured from orbiting and landed robotic explorers on other planets.
Apache License 2.0
479 stars 169 forks source link

Support .obj files in pc_align #243

Open oleg-alexandrov opened 5 years ago

oleg-alexandrov commented 5 years ago

Wavefront .obj files are a pretty widespread way of representing point clouds in many tools, including Blender, Meshlab, CloudCompare, etc. Our point2mesh creates .obj files as well, if invoked with the -t option, and osgviewer can view .obj files as well in addition to .osgb.

This format is convenient, for example, for irregular shapes, like the Ultima Thule body that New Horizons flew by recently. It would be nice if pc_align could support this format.

The format is quite simple, apparently, as shown here: https://en.wikipedia.org/wiki/Wavefront_.obj_file

We'd need to read the file, ignore all lines except those starting with "v ", do the alignment, and then write back files in exactly the same format with a transform applied to the "v " lines and to the normals (only the rotation part of the transform would be applied to the normal).

If the input .obj file has an associated tex.jpg texture file, the output file would use that one as well, by duplicating this file to a new name and also creating an .mtl file in the same format as the input.