Linux安装教程,注意该方法只适应于18.04
开启xrdp服务: sudo service xrdp restart
详情可参考此处链接的(二.更换源),此处不做详细说明,仅列出相关指令
查看Ubuntu版本号
lsb_release -a
备份源文件
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
打开源文件
sudo vim /etc/apt/sources.list
进入编辑后,按下“i”键开始编辑
使用“#”注释掉源文件中的所有行
将2.2任意源复制到文档的最后末尾处
按“ESC”退出编辑模式,输入 “:wq” 保存并退出文本
输入以下指令更新源
sudo apt update
sudo apt upgrade -y
更多版本清华镜像,点击这里
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
#ubuntu 20.04 LTS的阿里源镜像
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
ubuntu 20.04 LTS的清华源镜像
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
OpenMVG官网安装指南
需要环境:
CMake 可通过指令安装: sudo apt install cmake
Git 系统常自带
C/C++ compiler (GCC, Visual Studio or Clang) 系统常自带GCC
(sudo update-alternatives --config gcc 可切换gcc版本)
非必要
QT version >= v5.4
部分安装需要权限,输入:sudo -s 可在当前路径获取权限
由于QT编译原因,导致的报错,可以通过关闭DOpenMVG_BUILD_GUI_SOFTWARES方式通过编译
cmake -DCMAKE_BUILD_TYPE=RELEASE -DOpenMVG_BUILD_GUI_SOFTWARES=OFF …/openMVG/src/
(可选)由于工作需要此处修改了部分源码,代码文件的替换步骤在以下步骤处,在查看教程时,可根据需要进行修改。
……………
……………
……………
#OpenMVS
git clone https://github.com/cdcseacave/openMVS.git openMVS
**************************************************************
**本项目替换了 /home/lgn/openMVS/libs/MVS/SceneDensify.cpp 文件**
**************************************************************
mkdir openMVS_build && cd openMVS_build
cmake . ../openMVS -DCMAKE_BUILD_TYPE=Release -DVCG_ROOT="$main_path/vcglib"
#If you want to use OpenMVS as shared library, add to the CMake command:
-DBUILD_SHARED_LIBS=ON
#Install OpenMVS library (optional):
make -j2 && sudo make install
[可选]此处为官方提供的测试指令,可能会出现报错,可跳过该步骤
cd openMVG_Build/software/SfM/
python SfM_SequentialPipeline.py /home/lgnzgxl/Test/Image/ /home/lgnzgxl/Test/Result/
python SfM_GlobalPipeline.py /home/lgnzgxl/Test/Image/ /home/lgnzgxl/Test/Result/
正式使用
dataset=/home/lgnzgxl/Test/Image
dataset_out=/home/lgnzgxl/Test/Result2
focal=4800
openMVG_main_SfMInit_ImageListing -i $dataset -f $focal -o $dataset_out
openMVG_main_ComputeFeatures -i $dataset_out/sfm_data.json -o $dataset_out
openMVG_main_ComputeMatches -i $dataset_out/sfm_data.json -o $dataset_out
openMVG_main_IncrementalSfM -i $dataset_out/sfm_data.json -m $dataset_out -o $dataset_out/reconstruction
openMVG_main_ComputeSfM_DataColor -i $dataset_out/reconstruction/sfm_data.bin -o $dataset_out/colored.ply
openMVG_main_openMVG2MVSTEXTURING -i $dataset_out/reconstruction/sfm_data.bin -o $dataset_out/camera
openMVG_main_openMVG2openMVS -i $dataset_out/reconstruction/sfm_data.bin -o $dataset_out/scene.mvs -d $dataset_out/scene_undistorted_images
[可选]此命令产生的 robust.bin 似乎可以直接用sfm_data.bin取代
openMVG_main_ComputeStructureFromKnownPoses -i $dataset_out/reconstruction/sfm_data.bin -m $dataset_out -o $dataset_out/reconstruction/robust.bin -f $dataset_out/matches.f.bin
openMVG_main_openMVG2openMVS -i $dataset_out/reconstruction/robust.bin -o $dataset_out/reconstruction/scene.mvs
[可选]全景影像的应用
dataset=/home/lgnzgxl/Test/PanoFlat/OpenMVG/Image/
dataset_out=/home/lgnzgxl/Test/PanoFlat/OpenMVG/
openMVG_main_SfMInit_ImageListing -i $dataset -o $dataset_out/matches -f 1 -c 7
openMVG_main_ComputeFeatures -i $dataset_out/matches/sfm_data.json -o $dataset_out/matches
openMVG_main_ComputeMatches -i $dataset_out/matches/sfm_data.json -o $dataset_out/matches -g a
openMVG_main_IncrementalSfM -i $dataset_out/matches/sfm_data.json -m $dataset_out/matches -o $dataset_out/reconstruction
openMVG_main_openMVGSpherical2Cubic -i $dataset_out/reconstruction/sfm_data.bin -o $dataset_out/reconstruction/cubic
openMVG_main_openMVG2openMVS -i $dataset_out/reconstruction/cubic/sfm_data_perspective.bin -o $dataset_out/reconstruction/cubic/scene.mvs -d $dataset_out/reconstruction/cubic/openmvs_images
DensifyPointCloud $dataset_out/reconstruction/cubic/scene.mvs
生成稠密点云
DensifyPointCloud scene.mvs
生成Mesh
ReconstructMesh -d 4 scene_dense.mvs
构建精细化Mesh
RefineMesh --resolution-level=4 scene_dense_mesh.mvs
贴图纹理
TextureMesh scene_dense_mesh_refine.mvs
当各个模块都没有问题后,可直接修改三个参数后
直接复制全部指令进行执行所有OpoenMVS与OpenMVG的操作。
dataset=/home/lgnzgxl/Test/Image
dataset_out=/home/lgnzgxl/Test/Result2
focal=4800
openMVG_main_SfMInit_ImageListing -i $dataset -f $focal -o $dataset_out
openMVG_main_ComputeFeatures -i $dataset_out/sfm_data.json -o $dataset_out
openMVG_main_ComputeMatches -i $dataset_out/sfm_data.json -o $dataset_out
openMVG_main_IncrementalSfM -i $dataset_out/sfm_data.json -m $dataset_out -o $dataset_out/reconstruction
openMVG_main_ComputeSfM_DataColor -i $dataset_out/reconstruction/sfm_data.bin -o $dataset_out/colored.ply
openMVG_main_openMVG2MVSTEXTURING -i $dataset_out/reconstruction/sfm_data.bin -o $dataset_out/camera
openMVG_main_openMVG2openMVS -i $dataset_out/reconstruction/sfm_data.bin -o $dataset_out/scene.mvs -d $dataset_out/scene_undistorted_images
mkdir $dataset_out/OpenMVS
cp -r $dataset_out/scene.mvs $dataset_out/OpenMVS
cp -r $dataset_out/scene_undistorted_images $dataset_out/OpenMVS
mv $dataset_out/OpenMVS/scene_undistorted_images $dataset_out/OpenMVS/undistorted_images
cd $dataset_out/OpenMVS
DensifyPointCloud scene.mvs
ReconstructMesh -d 4 scene_dense.mvs
RefineMesh --resolution-level=4 scene_dense_mesh.mvs
TextureMesh scene_dense_mesh_refine.mvs
针对全景直接复制全部指令进行执行所有OpoenMVS与OpenMVG的操作。
dataset=/home/lgnzgxl/Test/PanoFlat/OpenMVG/Image/
dataset_out=/home/lgnzgxl/Test/PanoFlat/OpenMVG/
openMVG_main_SfMInit_ImageListing -i $dataset -o $dataset_out/matches -f 1 -c 7
openMVG_main_ComputeFeatures -i $dataset_out/matches/sfm_data.json -o $dataset_out/matches
openMVG_main_ComputeMatches -i $dataset_out/matches/sfm_data.json -o $dataset_out/matches -g a
openMVG_main_IncrementalSfM -i $dataset_out/matches/sfm_data.json -m $dataset_out/matches -o $dataset_out/reconstruction
openMVG_main_openMVGSpherical2Cubic -i $dataset_out/reconstruction/sfm_data.bin -o $dataset_out/reconstruction/cubic
openMVG_main_openMVG2openMVS -i $dataset_out/reconstruction/cubic/sfm_data_perspective.bin -o $dataset_out/reconstruction/cubic/scene.mvs -d $dataset_out/reconstruction/cubic/openmvs_images
mkdir $dataset_out/OpenMVS
cp -r $dataset_out/reconstruction/cubic/scene.mvs $dataset_out/OpenMVS
cp -r $dataset_out/reconstruction/cubic/openmvs_images $dataset_out/OpenMVS
mv $dataset_out/OpenMVS/openmvs_images $dataset_out/OpenMVS/undistorted_images
cd $dataset_out/OpenMVS
DensifyPointCloud scene.mvs
ReconstructMesh -d 4 scene_dense.mvs
RefineMesh --resolution-level=4 scene_dense_mesh.mvs
TextureMesh scene_dense_mesh_refine.mvs
授予文件权限
sudo chmod -R 777 某一目录
文件的拷贝
mt的文件路径
将数据拷贝到windows
cp -r /home/lgnzgxl/Test/MyTest/scene_dense.ply /mnt/e