Colmap根据相机内外参数重建稀疏模型
官方文档:https://colmap.github.io/faq.html#reconstruct-sparse-dense-model-from-known-camera-poses
参考博客:http://www.mamicode.com/info-detail-2838274.html
1.创建稀疏模型工作文件夹
已知相机的位姿,手动创建文件cameras.txt
,points3D.txt
以及images.txt
文件价路径:
+── .../created/sparse
│ +── cameras.txt
│ +── images.txt
│ +── points3D.txt
其中相机内参存放在cameras.txt
中,外参(camera extrinsics)存放在 images.txt
,points3D.txt
为空文件。
cameras.txt
示例:
# Camera list with one line of data per camera:
# CAMERA_ID, MODEL, WIDTH, HEIGHT, PARAMS[]
# Number of cameras: 1
1 OPENCV 1280 720 913.603 915.366 651.568 366.541 0.0961 -0.1858 0 0
只使用一台相机,若有多台相机在下一行分别填写相机参数即可。使用OPENCV相机模型。
images.txt
示例:
# Image list with two lines of data per image:
# IMAGE_ID, QW, QX, QY, QZ, TX, TY, TZ, CAMERA_ID, NAME
# POINTS2D[] as (X, Y, POINT3D_ID)
# Number of images: 2, mean observations per image: 2
1 0.477458 0.543198 -0.521067 0.453276 0.0447519 0.146365 -0.115584 1 image0001.jpg
# Make sure every other line is left empty
2 0.477646 0.543413 -0.520842 0.453078 0.0401251 0.155332 -0.182149 1 image0002.jpg
3 0.477833 0.543629 -0.520617 0.452881 0.0353862 0.1643 -0.24872 1 image0003.jpg
4 0.478038 0.543864 -0.520372 0.452665 0.0247215 0.202905 -0.535662 1 image0004.jpg
数据存放的顺序即为IMAGE_ID, QW, QX, QY, QZ, TX, TY, TZ, CAMERA_ID, NAME的顺序,IMAGE_ID为对应