参考:
https://colmap.github.io/index.html
https://www.bilibili.com/video/BV1x64y1x7Kw/
Colmap稀疏重建Sparse Reconstruction
图片及项目准备
准备图片
![](https://img-blog.csdnimg.cn/b5d53111965a4b4caedc5551ba0532a9.png)
colmap创建工程
![](https://img-blog.csdnimg.cn/cccfefb1f48146f2b9c601dc6b89e42f.png)
![](https://img-blog.csdnimg.cn/065b646292d94089b3bd48fafb8da4a2.png)
Feature extraction
Colmap gui程序:
Camera model只有选择SIMPLE_RADIAL, RADIAL, 和pinhole camera等模式才能使用照片来制作模型的映射贴图.
命令行:
Plaintext colmap feature_extractor \ --database_path $DATASET_PATH/database.db \ --image_path $DATASET_PATH/images |
Feature matching
Colmap gui程序:
命令行:
Plaintext colmap exhaustive_matcher \ --database_path $DATASET_PATH/database.db |
Reconstruction
Colmap gui程序:
![](https://img-blog.csdnimg.cn/f69ac0d59acd42b99237d595582bc9fe.png)
命令行:
Plaintext colmap mapper \ --database_path $DATASET_PATH/database.db \ --image_path $DATASET_PATH/images \ --output_path $DATASET_PATH/sparse |
导出模型
![](https://img-blog.csdnimg.cn/c43e8a6aa4244848b2c99fbd6dcefcf7.png)
![](https://img-blog.csdnimg.cn/082393601fb34cc3a974037313c9f68c.png)
需导出nvm或out格式模型,模型需导出到图片所在目录,后面将模型导入Meshlab中使用时才能正确使用图片数据.
Colmap稠密重建DenseReconstruction
准备
Colmap gui程序:
![](https://img-blog.csdnimg.cn/5cf7f8b265aa434192035c1003c8b98b.png)
![](https://img-blog.csdnimg.cn/4295194b02444c958317ae872bc853e6.png)
![](https://img-blog.csdnimg.cn/e2dfdce9e1fd4f4ba2b7c7fc4ce3d983.png)
![](https://img-blog.csdnimg.cn/381af2df536c4a22b4293326732df3d8.png)
参数设置:
![](https://img-blog.csdnimg.cn/48e83d6063d7429ea27bce33885a6f41.png)
Undistortion去畸变
Colmap gui程序:
![](https://img-blog.csdnimg.cn/860ec157e39249c598d8b4a9ff229d25.png)
命令行:
Plaintext mkdir $DATASET_PATH/dense colmap image_undistorter \ --image_path $DATASET_PATH/images \ --input_path $DATASET_PATH/sparse/0 \ --output_path $DATASET_PATH/dense \ --output_type COLMAP \ --max_image_size 2000 |
Stereo
Colmap gui程序:
![](https://img-blog.csdnimg.cn/e9d4d166fb4648d7a75d7b9282c0b3cc.png)
命令行:
Plaintext colmap patch_match_stereo \ --workspace_path $DATASET_PATH/dense \ --workspace_format COLMAP \ --PatchMatchStereo.geom_consistency true |
Fusion
Colmap gui程序:
![](https://img-blog.csdnimg.cn/a04fac000cc94dc38c6103d29c6406db.png)
命令行:
Plaintext colmap stereo_fusion \ --workspace_path $DATASET_PATH/dense \ --workspace_format COLMAP \ --input_type geometric \ --output_path $DATASET_PATH/dense/fused.ply |
Poisson Mesh
Colmap gui程序:
![](https://img-blog.csdnimg.cn/9cb5959938b04f6ea7c532b005d4c2cd.png)
命令行:
Plaintext colmap poisson_mesher \ --input_path $DATASET_PATH/dense/fused.ply \ --output_path $DATASET_PATH/dense/meshed-poisson.ply |
MeshLab网格处理及贴图
导入稀疏重建的模型
![](https://img-blog.csdnimg.cn/d6ad982d44974b549363ebfaa28a2405.png)
![](https://img-blog.csdnimg.cn/2e0e5bb8bafc468fbb2161762c5a0d44.png)
![](https://img-blog.csdnimg.cn/01ff6e451d6a43168240d9670bbd6f74.png)
导入稠密重建的网格模型:
![](https://img-blog.csdnimg.cn/9b662678f58f40ef8362e9739093fd39.png)
创建UV
![](https://img-blog.csdnimg.cn/a821e68aaf1d455c9cd4635dc39773b3.png)
FlatPlane方式
![](https://img-blog.csdnimg.cn/605b6363275e41c6a606b0b8e5df363c.png)
Trivial Per-Triangle方式
![](https://img-blog.csdnimg.cn/fd20948324714ca9b680f448e008ed5b.png)
使用Trivial Per-Triangle方式在顶点数过多时会失败.
贴图
![](https://img-blog.csdnimg.cn/03915e25d2f140f59e988d36b73ffd50.png)
![](https://img-blog.csdnimg.cn/a58de1a355e146eeb34d02c0c1245dca.png)
导出obj模型和贴图
![](https://img-blog.csdnimg.cn/f09c00b7a143424db6b625c46f7d2e68.png)
![](https://img-blog.csdnimg.cn/d26c05c5e3a744ddab3fb554c872f6ac.png)
![](https://img-blog.csdnimg.cn/5db80847e2b04896a2aab439611051ff.png)
![](https://img-blog.csdnimg.cn/adf0af8eee304b26aea0401fef4df75f.png)
导入Unity查看
重建效果:
![](https://img-blog.csdnimg.cn/8118b1f907c7466aa7250dcedc2b4834.png)
原始效果:
![](https://img-blog.csdnimg.cn/35ec92e62342496aaae7ffaf1c304abe.png)