OpenMVS学习笔记(一):WSL编译安装测试
1.CUDA和CUDNN安装
- [1] WSL版本cuda安装:
>> wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin >> sudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600 >> wget https://developer.download.nvidia.com/compute/cuda/11.7.1/local_installers/cuda-repo-wsl-ubuntu-11-7-local_11.7.1-1_amd64.deb >> sudo dpkg -i cuda-repo-wsl-ubuntu-11-7-local_11.7.1-1_amd64.deb >> sudo cp /var/cuda-repo-wsl-ubuntu-11-7-local/cuda-*-keyring.gpg /usr/share/keyrings/ >> sudo apt-get update >> sudo apt-get -y install cuda
- [2] cudnn安装:
# 1.下载cudnn-linux-x86_64-8.9.2.26_cuda11-archive.tar.xz文件 # 2.解压cudnn压缩包 >> tar -xf cudnn-linux-x86_64-8.9.2.26_cuda11-archive.tar.xz # 3.将include和lib文件夹下文件拷贝到cuda安装目录下 >> sudo cp cudnn-linux-x86_64-8.9.2.26_cuda11-archive/include/*cudnn.h /usr/local/cuda/include/ >> sudo cp cudnn-linux-x86_64-8.9.2.26_cuda11-archive/lib/libcudnn* /usr/local/cuda/lib64 # 4.修改库的权限 >> sudo chmod a+r /usr/local/lib64/libcudnn*
- [3] 添加系统环境变量(.zshrc或.bashrc)
export CUDA_PATH=/usr/local/cuda export CUDA_BIN=/usr/local/cuda/bin export PATH=$PATH::$CUDA_PATH:$CUDA_BIN
- [4] 刷新一下系统环境变量
# 1.zsh >> source ~/.zshrc # 2.bash >> source ~/.bashrc
- [5] 查询cuda版本
>> nvcc --version nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2022 NVIDIA Corporation Built on Wed_Jun__8_16:49:14_PDT_2022 Cuda compilation tools, release 11.7, V11.7.99 Build cuda_11.7.r11.7/compiler.31442593_0
2.安装依赖库
2.1 apt安装依赖库
sudo apt-get -y install git cmake libpng-dev libjpeg-dev libtiff-dev libglu1-mesa-dev sudo apt-get -y install libboost-iostreams-dev libboost-program-options-dev libboost-system-dev libboost-serialization-dev sudo apt-get -y install libcgal-dev libcgal-qt5-dev sudo apt-get install libglfw3-dev
2.2 OpenCV安装
- 网上一大堆,懒得写了
3.OpenMVS编译
# 1.下载VCG源码 >> git clone https://github.com/cdcseacave/VCG.git vcglib # 2.下载OpenMVS源码 >> cmake .. -DVCG_ROOT=[VCG源码路径]/vcglib -DCMAKE_BUILD_TYPE=Release
- 生成目录层级:
. ├── CMakeCache.txt ├── CMakeFiles │ ├── 3.16.3 │ ├── 3.27.0-rc3 │ ├── CMakeConfigureLog.yaml │ ├── CMakeDirectoryInformation.cmake │ ├── CMakeOutput.log │ ├── CMakeRuleHashes.txt │ ├── CMakeScratch │ ├── CMakeTmp │ ├── Export │ ├── FindOpenMP │ ├── Makefile.cmake │ ├── Makefile2 │ ├── TargetDirectories.txt │ ├── cmake.check_cache │ ├── pkgRedirects │ ├── progress.marks │ └── uninstall.dir ├── CTestTestfile.cmake ├── ConfigLocal.h ├── Makefile ├── Modules │ ├── FindBREAKPAD.cmake │ ├── FindEigen3.cmake │ └── FindVCG.cmake ├── OpenMVSConfig.cmake ├── OpenMVSConfigVersion.cmake ├── Templates │ ├── ConfigLocal.h.in │ ├── OpenMVSConfig.cmake.in │ └── cmake_uninstall.cmake.in ├── Utils.cmake ├── apps │ ├── CMakeFiles │ ├── DensifyPointCloud │ ├── InterfaceCOLMAP │ ├── InterfaceMVSNet │ ├── InterfaceMetashape │ ├── InterfacePolycam │ ├── Makefile │ ├── ReconstructMesh │ ├── RefineMesh │ ├── Tests │ ├── TextureMesh │ ├── TransformScene │ ├── Viewer │ └── cmake_install.cmake ├── bin │ ├── DensifyPointCloud │ ├── InterfaceCOLMAP │ ├── InterfaceMVSNet │ ├── InterfaceMetashape │ ├── InterfacePolycam │ ├── ReconstructMesh │ ├── RefineMesh │ ├── Tests │ ├── TextureMesh │ ├── TransformScene │ └── Viewer ├── cmake_install.cmake ├── cmake_uninstall.cmake ├── docs │ ├── CMakeFiles │ ├── Makefile │ └── cmake_install.cmake ├── lib │ ├── libCommon.a │ ├── libIO.a │ ├── libMVS.a │ ├── libMath.a │ └── pyOpenMVS.so └── libs ├── CMakeFiles ├── Common ├── IO ├── MVS ├── Makefile ├── Math └── cmake_install.cmake
4.效果测试
4.0 测试数据
- openMVS_sample
4.1 稠密点云重建(可选项)
- 当场景部分缺失时,稠密点云重建模块可以估算一个稠密点云来恢复它们,默认采用patch匹配方法:
>> ./bin/DensifyPointCloud -w [openMVS_sample路径]/mvs-data scene.mvs
- 使用meshlab打开点云结果scene_dense.ply
4.2 粗略网格重建
- 先前获取得到的稀疏或稠密点云被用于网格重建模块:
>> ./bin/ReconstructMesh -w [openMVS_sample]/mvs-data scene_dense.mvs -p scene_dense.ply
- 使用meshlab打开网格生成结果scene_dense_mesh.ply:
4.3 网格细化(可选项)
- 从点云获取到的网格可以进一步细化,进而恢复所有好的细节,更有甚者,恢复更大缺失的部分:
- (a) 细化由稀疏点云获取到的网格:
>> ./bin/RefineMesh -w [openMVS_sample]/mvs-data scene.mvs -m scene_dense_mesh.ply -o scene_sparse_mesh_refine.mvs
- 看一下结果:
- (b) 细化由稠密点云获取到的网格:
>> ./bin/RefineMesh -w [openMVS_sample]/mvs-data scene_dense.mvs -m scene_dense_mesh.ply -o scene_dense_mesh_refine.mvs
- 使用meshlab打开网格生成结果scene_dense_mesh.ply:
- 先前获取得到的稀疏或稠密点云被用于网格重建模块:
- 使用meshlab打开点云结果scene_dense.ply
- 当场景部分缺失时,稠密点云重建模块可以估算一个稠密点云来恢复它们,默认采用patch匹配方法:
- openMVS_sample
- 生成目录层级:
- 网上一大堆,懒得写了
- [5] 查询cuda版本
- [4] 刷新一下系统环境变量
- [3] 添加系统环境变量(.zshrc或.bashrc)
- [2] cudnn安装:
文章版权声明:除非注明,否则均为主机测评原创文章,转载或复制请以超链接形式并注明出处。