cdcseacave/openMVS

Missing .mvs Output Files from ReconstructMesh, RefineMesh, and TextureMesh (Only .ply Files Generated)

Majid9287 opened this issue · 4 comments

I'm facing a perplexing issue with OpenMVS that I'm hoping someone in this community might be able to shed some light on.

Problem:

I'm running a 3D reconstruction pipeline using OpenMVS, and I've noticed that the ReconstructMesh, RefineMesh, and TextureMesh steps are not generating the expected .mvs output files (e.g., scene_dense_mesh.mvs, scene_dense_mesh_refine.mvs, scene_dense_mesh_refine_texture.mvs). Instead, I'm only getting the corresponding .ply files (e.g., scene_dense_mesh.ply, scene_dense_mesh_refine.ply, scene_dense_mesh_refine_texture.ply).
`INFO:root:Running subprocess command: /usr/local/bin/OpenMVS/DensifyPointCloud scene.mvs --resolution-level 1
--number-views 8 -w /tmp/tmpq8m3cb27/mvs
INFO:root:Command output: 12:37:21 [App ] OpenMVS x64 v2.3.0
12:37:21 [App ] Build date: May 21 2024, 22:59:34
12:37:21 [App ] CPU: Intel(R) Core(TM) i5-4300U CPU @ 1.90GHz (4 cores)
12:37:22 [App ] RAM: 3.76GB Physical Memory 1.00GB Virtual Memory
12:37:22 [App ] OS: Linux 5.15.146.1-microsoft-standard-WSL2 (x86_64)
12:37:22 [App ] Disk: 937.09GB (1006.85GB) space
12:37:22 [App ] SSE & AVX compatible CPU & OS detected
12:37:22 [App ] Command line: DensifyPointCloud scene.mvs --resolution-level 1 --number-views 8 -w /tmp/tmpq8m3cb27/mvs
12:37:22 [App ] Camera model loaded: platform 0; camera 0; f 1.059x1.059; poses 5
12:37:22 [App ] Scene loaded from interface format (68ms):
5 images (5 calibrated) with a total of 28.74 MPixels (5.75 MPixels/image)
3973 points, 0 vertices, 0 faces
12:37:22 [App ] The camera directions mean is unbalanced; the scene will be considered unbounded (no ROI)
12:37:22 [App ] Point-cloud composed of 3973 points with:

  • visibility info (11692 views - 2.94 views/point):
    0 points with 1- views (0.00%)
    1893 points with 2 views (47.65%)
    922 points with 3 views (23.21%)
    1158 points with 4+ views (29.15%)
    2 min / 2.94286 mean (1.07157 std) / 5 max
    12:37:22 [App ] Preparing images for dense reconstruction completed: 5 images (188ms)
    12:37:22 [App ] Selecting images for dense reconstruction completed: 5 images (2ms)
    Estimated depth-maps 5 (100%, 7m12s985ms)
    Geometric-consistent estimated depth-maps 5 (100%, 1m45s521ms)
    Geometric-consistent estimated depth-maps 5 (100%, 1m53s313ms)
    Filtered depth-maps 5 (100%, 2s282ms)
    Fused depth-maps 5 (100%, 1s756ms)
    12:48:18 [App ] Depth-maps fused and filtered: 5 depth-maps, 3487030 depths, 664763 points (19%%) (1s810ms)
    12:48:18 [App ] Densifying point-cloud completed: 664763 points (10m56s414ms)
    12:48:20 [App ] Point-cloud 'scene_dense.ply' saved: 664763 points (1s484ms)
    12:48:20 [App ] Scene saved to interface format (19ms):
    5 images (5 calibrated)
    3973 points, 0 vertices, 0 faces
    12:48:21 [App ] MEMORYINFO: {
    12:48:21 [App ] VmPeak: 1372376 kB
    12:48:21 [App ] VmSize: 1189036 kB
    12:48:21 [App ] } ENDINFO

INFO:root:Command stderr:
INFO:root:Directory contents of /tmp/tmpq8m3cb27/mvs: ['scene_dense.ply', 'scene_dense.mvs', 'depth0004.dmap', 'depth0002.dmap', 'image_2.jpg', 'depth0003.dmap', 'image_4.jpg', 'depth0001.dmap', 'image_0.jpg', 'scene.mvs', 'DensifyPointCloud-2405281237218B45E7.log', 'image_1.jpg', 'depth0000.dmap', 'image_3.jpg']
INFO:root:Running subprocess command: /usr/local/bin/OpenMVS/ReconstructMesh scene_dense.mvs -w /tmp/tmpq8m3cb27/mvs
INFO:root:Command output: 12:48:21 [App ] OpenMVS x64 v2.3.0
12:48:21 [App ] Build date: May 21 2024, 22:59:34
12:48:21 [App ] CPU: Intel(R) Core(TM) i5-4300U CPU @ 1.90GHz (4 cores)
12:48:21 [App ] RAM: 3.76GB Physical Memory 1.00GB Virtual Memory
12:48:21 [App ] OS: Linux 5.15.146.1-microsoft-standard-WSL2 (x86_64)
12:48:21 [App ] Disk: 936.91GB (1006.85GB) space
12:48:21 [App ] SSE & AVX compatible CPU & OS detected
12:48:21 [App ] Command line: ReconstructMesh scene_dense.mvs -w /tmp/tmpq8m3cb27/mvs
12:48:21 [App ] Camera model loaded: platform 0; camera 0; f 1.059x1.059; poses 5
12:48:21 [App ] Scene loaded from interface format (44ms):
5 images (5 calibrated) with a total of 7.18 MPixels (1.44 MPixels/image)
3973 points, 0 vertices, 0 faces
12:48:22 [App ] Point-cloud 'scene_dense.ply' loaded: 664763 points (692ms)
Points inserted 664763 (100%, 5s752ms)
12:48:28 [App ] Delaunay tetrahedralization completed: 664763 points -> 287500 vertices, 1855242 (+232) cells, 3710600 (+348) faces (6s143ms)
Points weighted 287500 (100%, 15s252ms)
12:48:46 [App ] Delaunay tetrahedras weighting completed: 1855474 cells, 3710948 faces (17s576ms)
12:48:52 [App ] Delaunay tetrahedras graph-cut completed (139945 flow): 286146 vertices, 572645 faces (5s477ms)
12:48:52 [App ] Mesh reconstruction completed: 286366 vertices, 572645 faces (30s143ms)
12:48:57 [App ] Cleaned mesh: 286202 vertices, 571896 faces (5s166ms)
12:49:00 [App ] Cleaned mesh: 286202 vertices, 571896 faces (2s467ms)
12:49:02 [App ] Cleaned mesh: 286202 vertices, 571896 faces (2s11ms)
12:49:02 [App ] Mesh saved: 286202 vertices, 571896 faces (202ms)
12:49:02 [App ] MEMORYINFO: {
12:49:02 [App ] VmPeak: 1018480 kB
12:49:02 [App ] VmSize: 685072 kB
12:49:02 [App ] } ENDINFO

INFO:root:Command stderr:
INFO:root:Directory contents of /tmp/tmpq8m3cb27/mvs: ['scene_dense.ply', 'scene_dense.mvs', 'depth0004.dmap', 'depth0002.dmap', 'image_2.jpg', 'ReconstructMesh-2405281248218B4715.log', 'depth0003.dmap', 'scene_dense_mesh.ply', 'image_4.jpg', 'depth0001.dmap', 'image_0.jpg', 'scene.mvs', 'DensifyPointCloud-2405281237218B45E7.log', 'image_1.jpg', 'depth0000.dmap', 'image_3.jpg']
INFO:root:Running subprocess command: /usr/local/bin/OpenMVS/RefineMesh scene_dense_mesh.mvs --scales 1 --gradient-step 25.05 -w /tmp/tmpq8m3cb27/mvs
INFO:root:Command output: 12:49:02 [App ] OpenMVS x64 v2.3.0
12:49:02 [App ] Build date: May 21 2024, 22:59:34
12:49:02 [App ] CPU: Intel(R) Core(TM) i5-4300U CPU @ 1.90GHz (4 cores)
12:49:02 [App ] RAM: 3.76GB Physical Memory 1.00GB Virtual Memory
12:49:02 [App ] OS: Linux 5.15.146.1-microsoft-standard-WSL2 (x86_64)
12:49:02 [App ] Disk: 936.90GB (1006.85GB) space
12:49:02 [App ] SSE & AVX compatible CPU & OS detected
12:49:02 [App ] Command line: RefineMesh scene_dense_mesh.mvs --scales 1 --gradient-step 25.05 -w /tmp/tmpq8m3cb27/mvs
12:49:02 [App ] MEMORYINFO: {
12:49:02 [App ] VmPeak: 194648 kB
12:49:02 [App ] VmSize: 194648 kB
12:49:02 [App ] } ENDINFO

INFO:root:Command stderr:
ERROR:root:Error in refining the mesh with scales and max face area:
ERROR:root:Error during 3D model generation: Error in refining the mesh with scales and max face area (Exit code: 1)`

`run_subprocess(
[os.path.join(OPENMVG_SFM_BIN, "openMVG_main_ComputeSfM_DataColor"), "-i", f"{reconstruction_dir}/sfm_data.bin", "-o", os.path.join(reconstruction_dir, "colorized.ply")],
"Error in colorizing structure"
)

        run_subprocess(
            [os.path.join(OPENMVG_SFM_BIN, "openMVG_main_openMVG2openMVS"), "-i", f"{reconstruction_dir}/sfm_data.bin", "-o", f"{mvs_dir}/scene.mvs", "-d", mvs_dir],
            "Error in exporting to OpenMVS"
        )

        try:
            run_subprocess(
                [os.path.join(OPENMVS_BIN, "DensifyPointCloud"), "scene.mvs", "--resolution-level", "1", "--number-views", "8", "-w", mvs_dir],
                "Error in densifying point cloud"
            )
           
        except RuntimeError as e:
            logging.error(f"DensifyPointCloud failed with error: {str(e)}")
            raise

        if not os.path.isfile(os.path.join(mvs_dir, "scene_dense.mvs")):
            raise RuntimeError("The file 'scene_dense.mvs' was not found. Ensure DensifyPointCloud completed successfully.")
        
        logging.info(f"Directory contents of {mvs_dir}: {os.listdir(mvs_dir)}") 
        
        run_subprocess(
            [os.path.join(OPENMVS_BIN, "ReconstructMesh"), "scene_dense.mvs","-w", mvs_dir],
            "Error in reconstructing the mesh"
        )
        
        logging.info(f"Directory contents of {mvs_dir}: {os.listdir(mvs_dir)}") 
        
        run_subprocess(
            [os.path.join(OPENMVS_BIN, "RefineMesh"), "scene_dense_mesh.mvs","--scales", "1", "--gradient-step", "25.05","-w",mvs_dir],
            "Error in refining the mesh with scales and max face area"
        )
        
        logging.info(f"Directory contents of {mvs_dir}: {os.listdir(mvs_dir)}") 
        
        run_subprocess(
            [os.path.join(OPENMVS_BIN, "TextureMesh"), "scene_dense_mesh_refine.mvs", "--decimate", "0.5", "-w",mvs_dir],
            "Error in texturing the mesh"
        )
        
        logging.info(f"Directory contents of {mvs_dir}: {os.listdir(mvs_dir)}")
      
        output_model_file = os.path.join(mvs_dir, "scene_dense_mesh_refine_texture.mvs")
        logging.info({ output_model_file})
          
        if not os.path.isfile(output_model_file):
            raise RuntimeError(f"Final 3D model file {output_model_file} was not created")`

I solved this problem by referring to #1058

Pls see wiki or the python script for using OpenMVS included

Pls see wiki or the python script for using OpenMVS included

When exporting a textured mesh from OpenMVS TextureMesh, I get scene_dense_mesh_refine_texture.ply with no color information. Why is this happening, and how can I get a textured output with color?

Command used: [os.path.join(OPENMVS_BIN, "TextureMesh"), "scene_dense.mvs", "-m" ,"scene_dense_mesh_refine.ply", "-o", "scene_dense_mesh_refine_texture.mvs", "--decimate", "0.5", "-w",mvs_dir]

OpenMVS does not output a mesh with vertex color, only with texture