cdcseacave / openMVS

open Multi-View Stereo reconstruction library
http://cdcseacave.github.io
GNU Affero General Public License v3.0
3.18k stars 890 forks source link

[Question] how to filter the dense point cloud #264

Open massimo-tech3d opened 6 years ago

massimo-tech3d commented 6 years ago

this seems to be a recurring question, either asked to openMVG or openMVS, but I found no suitable solution so far for the openMVS part of the workflow. I'm trying to implement a cylindrical filter, i.e. eliminate from the scene all points, then faces, which fall outside the circle of cameras (actually a cylinder of cameras).

I tried fiddling with openMVG filtering app. It works quite well but openMVS then is not able to reconstruct a complete dense point cloud.

I tried filtering the scene_dense.ply file generated by DensifyPointCloud, but the following ReconstructMesh simply ignores it, uses only the scene_dense.mvs and therefore it creates a full blown mesh including the portions of the scene that need to be left out.

I tried using the "--archive-type 0" argument, to get an ASCII *mvs file and filter that, but it comes out binary anyway. Using "--archive-type -1" to use the interface format, simply copies the scene file generated by openMVG and does not densify anything.

Am I overlooking anything ? if not, what would be the best place in openMVS code to implement a filter for the unwanted points ? Unfortunately I don't speak much of C++ and I may be able to do something if I get directed to the right place. If I need to find it mysefl browsing the code... I won't be able to do it.

Let me say that this is a very neat application, with a very high quality of generated meshes and textures, unfortunately the choice not to use an open file format (e.g. json) is limiting quite a lot the possible use cases.

thank you in advance

cdcseacave commented 6 years ago

ReconstructMesh simply reconstructs the points you supply, if you filtered them out, ReconstructMesh can not generate them back

massimo-tech3d commented 6 years ago

As far as I understand, ReconstructMesh takes the points from scene_dense.mvs (binary file) and not from the plyfile. I can filter the plyfile but not the scene. Or am I wrong ?

cdcseacave commented 6 years ago

the ply is only for vizualization, it is not used

massimo-tech3d commented 6 years ago

thanks for confirming. Hence I need to filter the scene_dense.mvs, which is what I'm asking about.

ryanismert commented 6 years ago

@massimo-tech3d did you ever find a solution?

cdcseacave commented 6 years ago

one solution is to finish the reconstruction, and sample the final mesh at the desired density; this way the resulted point cloud will not only be clean, but at constant density

massimo-tech3d commented 6 years ago

unfortunately not. I had to give up, as I anticipated I was not able to find by myself where in the code to attempt the modifications.

regarding the possible solution suggested now by cdcseacave, that's the only way to do this now. To manually remove the unwanted parts. But the whole purpose of my question was to automate it, so this answer does not help. Also I think there where issues with the texture generation, if the mesh was manually cleaned up, IIRC