当前位置: 首页 > news >正文

COLMAP原理讲解与使用教程

COLMAP论文简单介绍

COLMAP论文名: Structure-from-Motion Revisited

COLMAP是一个经典的增量式SfM(incremental structure from motion)方法

Incremental的SfM的pipeline的思想就是从一系列多视角图像中找到对应的feature的关系,然后选取两张质量好的视角图片进行初始化,通过增量的方式一步步还原出3D场景和每个图片对应的摄像机位姿。

COLMAP对incremental structure from motion的各个模块做了改进,具体的细节不是本文的重点,总而言之,COLMAP是一个典型的incremental SfM方法。

下面是Image-based 3D reconstruction和Structure-from-Motion以及Multi-View Stereo之间的关系(来自COLMAP文档)

Image-based 3D reconstruction from images traditionally first recovers a sparse representation of the scene and the camera poses of the input images using Structure-from-Motion.

This output then serves as the input to Multi-View Stereo to recover a dense representation of the scene.

Multi-View Stereo

MVS 的作用是根据SfM得到的初步的信息来还原每张图片像素级别的depth和normal的信息,然后还原出dense的3D场景,同时还可以根据normal的信息还原出3D surface

Multi-View Stereo (MVS) takes the output of SfM to compute depth and/or normal information for every pixel in an image. Fusion of the depth and normal maps of multiple images in 3D then produces a dense point cloud of the scene. Using the depth and normal information of the fused point cloud, algorithms such as the (screened) Poisson surface reconstruction [kazhdan2013] can then recover the 3D surface geometry of the scene. More information on Multi-View Stereo in general and the algorithms in COLMAP can be found in [schoenberger16mvs].


COLMAP安装

COLMAP官方仓库地址:

https://github.com/colmap/colmaphttps://github.com/colmap/colmap

COLMAP官方文档地址:

https://colmap.github.io/https://colmap.github.io/

环境安装:

conda create -n colmap python=3.10 -y
conda activate colmap

COLMAP安装:

https://anaconda.org/conda-forge/colmaphttps://anaconda.org/conda-forge/colmap

直接使用conda安装

conda install conda-forge::colmap
conda install conda-forge/label/colmap_dev::colmap

稀疏重建代码:

由于没有图形界面,直接选择使用命令行操作

首先cd 到项目文件夹,创建一个images的文件夹存放图片:

# 特征提取
colmap feature_extractor --database_path ./database.db --image_path ./images# 特征匹配
colmap exhaustive_matcher --database_path ./database.db# 稀疏重建
mkdir sparse
colmap mapper --database_path ./database.db --image_path ./images --output_path ./sparse

最终得到以下重建结果

可能在这里看到多个模型结果,说明场景的图片不是连通的:

得到的文件解释:

查看重建效果:

colmap model_analyzer --path ./sparse/0

最终还要转换成ply文件才方便打开

colmap model_converter \--input_path ./sparse/0 \--output_path ./sparse/0/model.ply \--output_type PLY

可用的可视化打开方式:

在meshlab中:

meshlab sparse/0/points3D.ply

在python中:

import open3d as o3d
pcd = o3d.io.read_point_cloud("sparse/0/points3D.ply")
o3d.visualization.draw_geometries([pcd])

稠密重建代码:

# Step 1: 去畸变
colmap image_undistorter \--image_path ./images \--input_path ./sparse/0 \--output_path ./dense# Step 2: 深度图计算
colmap patch_match_stereo \--workspace_path ./dense \--workspace_format COLMAP \--PatchMatchStereo.geom_consistency true# Step 3: 深度融合
colmap stereo_fusion \--workspace_path ./dense \--workspace_format COLMAP \--input_type geometric \--output_path ./dense/fused.ply

得到dense的重建结果:

同时还能生成带mesh的可视化结果:


# 这个速度非常慢,不建议
colmap poisson_mesher \--input_path ./dense/fused.ply \--output_path ./dense/meshed-poisson.ply# 或更轻量的:colmap delaunay_mesher \--input_path ./dense \--output_path ./dense/meshed-delaunay.ply

最终可视化效果:

稀疏点云重建效果:

其实重建的只有稀疏的特征点的信息

稠密点云重建效果:

fused.ply文件可以在mac上可以用meshlab打开,可以看到效果其实一般般:

Mesh重建效果:

得到的粗糙的mesh的可视化结果

http://www.dtcms.com/a/490290.html

相关文章:

  • 定位守护童年,科技构筑安全屏障
  • AWS EC2 Jenkins 自动化部署与 Python 环境管理
  • Linux中快速部署Elasticsearch(基础TLS配置)
  • 2025吉比特-游戏引擎开发-一面复盘
  • java数据结构--List的介绍
  • 网站主页不收录肥城房产网
  • 计算机视觉(opencv)——基于 MediaPipe 的实时面部表情识别
  • C++设计模式_行为型模式_观察者模式Observer(发布-订阅(Publish-Subscribe))
  • 怎么解决ModuleNotFoundError: No module named ‘Cython‘
  • 电子商务网站规划流程手机主题制作网站
  • 微信小程序 Button 组件 open-type 完全指南:从用户信息获取到客服分享的实战应用
  • 阿里云白皮书-架构
  • Rokid 开发空间小程序 实战
  • RAG系统搭建指南:5种主流框架的易用性和效果对比
  • 网站后台怎么添加代码哪里有免费的域名注册建网站
  • Jetson AGX Orin+GMSL+AI视觉开发套件,支持自动驾驶,机器人,工业视觉等应用
  • 【JETSON+FPGA+GMSL+AI】自动驾驶与移动机器人的摄像头如何实现高精度时间同步?
  • Java 设计模式——建造者模式:从原理到实战的极简指南
  • 怎么找做企业网站的雁塔区住房和城乡建设局网站
  • 哈尔滨电商企业服务器托管方案
  • 机器学习基础入门(第五篇):半监督学习与强化学习
  • 建网站解决方案代运营网店公司
  • 网站建设网页制作软件wordpress 移动到回收站发生错误
  • 5G安全深入解析:EAP-AKA、EAP-AKA‘与5G-AKA详解
  • YOLO 系列演进:从 V1 到 V2 的目标检测革命
  • 云栖实录|MaxCompute全新升级:AI时代的原生数据仓库
  • 基于Multi-Agent开发的SmartCare系统自动化运维管家
  • 终结浏览器隐患:自动化安全审计与报表
  • 笔记本卡顿,拖慢的不止是CAD看图评审速度
  • 电脑被捆绑软件缠上?3 步根治:紧急断网 + 深度清理 + 长效防护