1. 安装meshroom

git clone --recursive git://github.com/alicevision/meshroom
cd meshroom
git checkout v2021.1.0 # <- 版本必须和Alicevision的版本相同
pip install -r requirements.txt

2. 不编译AliceVision使用meshroom

  • 下载一个合适的 release 版本
  • Checkout corresponding Meshroom (ui) version/tag to avoid versions incompatibilities
  • LD_LIBRARY_PATH=~/foo/Meshroom-2021.1.0/aliceVision/lib/ PATH=$PATH:~/foo/Meshroom-2021.1.0/aliceVision/bin/ PYTHONPATH=$PWD python3 meshroom/ui
#meshroom alicevision
export LD_LIBRARY_PATH=/algorithm/xxx/meshroom_save/Meshroom-2021.1.0-av2.4.0-centos7-cuda10.2/aliceVision/lib:$LD_LIBRARY_PATH
export PATH=/algorithm/xxx/meshroom_save/Meshroom-2021.1.0-av2.4.0-centos7-cuda10.2/aliceVision/bin:$PATH
  • 安装cx_Freeze (不打包项目,不用setup.py就不装)

    ~~pip3 install --upgrade pip
    pip install -i https://marcelotduarte.github.io/packages/ cx_Freeze
    python -m pip install cx_Freeze --upgrade~~
    
    conda install -c conda-forge cx_freeze
    

3. 命令行运行Meshroom

  • 各模块的数据保存在参数cache对应的文件夹下
export PYTHONPATH=$PWD
python bin/meshroom_batch --input /algorithm/xxx/graphics_primitives/ex_dataset_5/BuOu/images --cache /algorithm/xxx/meshroom_save/MeshroomCache_BuOu_command_test_1
/algorithm/xxx/graphics_primitives/ex_dataset_5/SaiChe/images_png
  • 问题,运行报错:

    [2022-06-02 16:01:56,160][WARNING] == The following "submitters" plugins could not be loaded ==
      * simpleFarmSubmitter: No module named 'simpleFarm'
    ...
    
  • 问题,运行报错:

    (meshroom) xxx@3090_a:meshroom$ python bin/meshroom_batch --input /algorithm/xxx/graphics_primitives/ex_dataset_5/BuOu/images --output /algorithm/xxx/meshroom_save/Meshroom_BuOu_command_test_1 --cache /algorithm/xxx/meshroom_save/MeshroomCache_BuOu_command_test_1
    Program called with the following parameters:
     * allowSingleView = 1
     * allowedCameraModels = "pinhole,radial1,radial3,brown,fisheye4,fisheye1,3deanamorphic4,3deradial4,3declassicld"
     * defaultCameraModel = "" (default)
     * defaultFieldOfView = 45
     * defaultFocalLengthPix = -1 (default)
     * defaultIntrinsic = "" (default)
     * groupCameraFallback =  Unknown Type "20EGroupCameraFallback"
     * imageFolder = "" (default)
     * input = "/tmp/tmp8xqjy59g/CameraInit/f9436e97e444fa71a05aa5cf7639b206df8ba282/viewpoints.sfm"
     * output = "/tmp/tmp8xqjy59g/CameraInit/f9436e97e444fa71a05aa5cf7639b206df8ba282/cameraInit.sfm"
     * sensorDatabase = ""
     * useInternalWhiteBalance = 1
     * verboseLevel = "info"
     * viewIdMethod =  Unknown Type "N11aliceVision9sfmDataIO13EViewIdMethodE"
     * viewIdRegex = ".*?(\d+)" (default)
    
    [16:23:28.919566][fatal] 3deanamorphic4
    Traceback (most recent call last):
      File "bin/meshroom_batch", line 165, in <module>
        views, intrinsics = cameraInit.nodeDesc.buildIntrinsics(cameraInit, filesByType.images)
      File "/algorithm/xxx/meshroom_save/meshroom/meshroom/nodes/aliceVision/CameraInit.py", line 311, in buildIntrinsics
        raise RuntimeError('CameraInit failed with error code {}.\nCommand was: "{}".\n'.format(
    RuntimeError: CameraInit failed with error code 1.
    Command was: "aliceVision_cameraInit  --sensorDatabase "" --defaultFieldOfView 45.0 --groupCameraFallback folder --allowedCameraModels pinhole,radial1,radial3,brown,fisheye4,fisheye1,3deanamorphic4,3deradial4,3declassicld --useInternalWhiteBalance True --viewIdMethod metadata --verboseLevel info --output "/tmp/tmp8xqjy59g/CameraInit/f9436e97e444fa71a05aa5cf7639b206df8ba282/cameraInit.sfm" --allowSingleView 1 --input "/tmp/tmp8xqjy59g/CameraInit/f9436e97e444fa71a05aa5cf7639b206df8ba282/viewpoints.sfm"".
    
    • 解释:The alicevision version and meshroom version do not match. Try installing the latest alicevision from the develop branch
    • 解决:使用相同版本的alicevision和meshroom
      • 下载发行版meshroom v2021.1.0 使用其中的Alicevision

        git clone --recursive git://github.com/alicevision/meshroom
        git checkout v2021.1.0
        

4. 自定义pipline

  1. 在GUI界面修改pipline,保存project(.mg文件)
  2. 命令行调用的时候增加参数-p /your/path/to/project.mg

5. 需要输出的结果

  • 需要的结果

    StructureFromMotion

    ./StructureFromMotion/*/sfm.abc

    DepthMapFilter 计算深度图估计

    ./DepthMapFilter//_depthMap.exr

    ./DepthMapFilter//_depthMap.png

    Meshing 网格模型

    网格模型 ./Meshing/*/mesh.obj

    点云 ./Meshing/*/densePointCloud.abc

    MeshFiltering 网格修复后的模型

    网格模型 ./MeshFiltering/*/mesh.obj

    Texturing 纹理映射

    ./Texturing/*/texturedMesh.obj

    ./Texturing/*/texturedMesh.mtl

    ./Texturing//.png


  • 06_06 meshroom cache

    tankandtemples

    BigBIRD_20samples

    custom_data

    MeshroomCache_custom_data_ZhouXiaoHei_fps

    dtu_images

    MeshroomCache_dtu_images_scan

  • 使用的图片数据

    /algorithm/chenshundong/mvs_reconstruction_dataset

    1. Bigbird
      1. rgb_higher
        1. 3m_high_tack_spray_adhesive sift特征提取算法重建模失败, 使用akaze, akaze也不行
    2. tankandtemp
      1. train
    3. dta_images
      1. images
    4. custom_data
  • 稠密重建文件结构和格式

    /algorithm/chenshundong/mvs_reconstruction_outputs/
        colmap/     # COLMAP 稀疏重建的结果
            dataset/smaple/
                colmap_sparse   # COLMAP 格式的SfM结果
                colmap_text     # txt 格式的SfM结果
        openmvg/    # OpenMVG 稀疏重建的结果
            dataset/smaple/
                reconstruction_sequential/sfm_data.bin  # OpenMVG 原始的SfM结果
                openmvs_format/   # 转为 OpenMVS 格式的结果
                colmap_format_text/   # 转为 COLMAP 格式的结果
    
  • 限制cpu参与计算的核心

    taskset -c [core number start]-[core number end] python xxx.py
    

6. 单独运行各node

看运行的log文件可以找到每个node的命令