OpenSfM开源软件使用小心得

1 常用的开源Structure-from-Motion软件

  1. OpenMVG 3.5k⭐
  2. Colmap 2.9k⭐
  3. OpenSfM (Python) 2.1k⭐
  4. Bundler 1.3k⭐
  5. MVE 758⭐
  6. TheiaSfM 652⭐
  7. MICMAC 292⭐
    (⭐表示Github上的star数)

【注】
Bundler是由SfM创始人的华盛顿大学的Snavely教授所写。
上述7个软件,只有OpenSfM是用Python写的,其他软件语言均为C++。即使是OpenSfM也使用了Python binding。主要原因是OpenSfM也使用了C++的非线性优化包Ceres(基本上每个SfM、SLAM软件都离不开该库)。

2 OpenSfM的简易运行(基于Linux)

(我的操作系统是Ubuntu20.04LTS,OpenSfM纯粹使用CPU运行,没有显卡、显卡驱动那些玩意儿也完全没有关系)
(注:OpenSfM并不是一下载下来就能用,要按照官方文档的步骤,需要安装依赖并编译才能用。这篇博客不涉及安装OpenSfM的步骤。)

运行整个OpenSfM最方便的办法是:终端定位到OpenSfM的根目录,然后输入以下命令

//berlin是存放示例图片的文件夹。
bin/opensfm_run_all data/berlin

实际上,该命令执行了根目录的bin文件夹中的opensfm_run_all data文件,该文件就是8个命令。

$PYTHON $DIR/opensfm extract_metadata $1
$PYTHON $DIR/opensfm detect_features $1
$PYTHON $DIR/opensfm match_features $1
$PYTHON $DIR/opensfm create_tracks $1
$PYTHON $DIR/opensfm reconstruct $1
$PYTHON $DIR/opensfm mesh $1
$PYTHON $DIR/opensfm undistort $1
$PYTHON $DIR/opensfm compute_depthmaps $1

这8个命令执行完了SfM的整个流程,输出数据在根目录下的data/berlin下。

berlin/
├── config.yaml
├── images/
├── masks/
├── gcp_list.txt
├── exif/
├── camera_models.json
├── features/
├── matches/
├── tracks.csv
├── reconstruction.json
├── reconstruction.meshed.json
└── undistorted/
    ├── images/
    ├── masks/
    ├── tracks.csv
    ├── reconstruction.json
    └── depthmaps/
        └── merged.ply

merged.ply可以用Meshlab软件打开,查看重建效果。
merged.ply

reconstruction.json中含有所有重建的三维点坐标(structure),以及相机参数(motion)。格式如下:

// reconstruction.json: [RECONSTRUCTION, ...]

RECONSTRUCTION: {
   
    "cameras": {
   
        CAMERA_ID: CAMERA,
        ...
    },
    "shots": {
   
        SHOT_ID: SHOT,
        ...
    },
    "points": {
   
        POINT_ID: POINT,
        ...
    }
}

CAMERA: {
   
    "projection_type": "perspective",  # Can be perspective, brown, fisheye or equirectangular
    "width": NUMBER,                   # Image width in pixels
    "height": NUMBER,                  # Image height in pixels

    # Depending on the projection type more parameters are stored.
    # These are the parameters of the perspective camera.
    "focal": NUMBER,                   # Estimated focal length
    "k1": NUMBER,                      # Estimated distortion coefficient
    "k2": NUMBER,                      # Estimated distortion coefficient
}

SHOT: {
   
    "camera": CAMERA_ID,
    "rotation": [X, Y, Z],      # Estimated rotation as an angle-axis vector
    "translation": [X, Y, Z],   # Estimated translation
    "gps_position": [X, Y, Z],  # GPS coordinates in the reconstruction reference frame
    "gps_dop": METERS,          # GPS accuracy in meters
    "orientation": NUMBER,      # EXIF orientation tag (can be 1, 3, 6 or 8)
    "capture_time": SECONDS     # Capture time as a UNIX timestamp
}

POINT: {
   
    "coordinates": [X, Y, Z
  • 10
    点赞
  • 45
    收藏
    觉得还不错? 一键收藏
  • 12
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 12
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值