Main Content

Structure from Motion Overview

运动(SFM)的结构是从一组2-D图像估算场景的3-D结构的过程。SFM用于许多应用中,例如3-D扫描,增强现实以及视觉同时定位和映射(VSLAM)。

SFM可以通过许多不同的方式计算。解决问题的方式取决于不同的因素,例如所使用的摄像机的数量和类型以及是否有序。如果图像是用单个校准相机拍摄的,则只能恢复3-D结构和相机运动up to scaleup to scalemeans that you can rescale the structure and the magnitude of the camera motion and still maintain observations. For example, if you put a camera close to an object, you can see the same image as when you enlarge the object and move the camera far away. If you want to compute the actual scale of the structure and motion in world units, you need additional information, such as:

  • 这size of an object in the scene

  • 来自另一个传感器的信息,例如里程表。

Structure from Motion from Two Views

For the simple case of structure from two stationary cameras or one moving camera, one view must be considered camera 1 and the other one camera 2. In this scenario, the algorithm assumes that camera 1 is at the origin and its optical axis lies along thez-轴。

  1. SFM需要图像之间的点对应关系。通过匹配功能或图像1到图像2的跟踪点来查找相应的点。特征跟踪技术,例如Kanade-Lucas-Tomasi(KLT)算法,当相机靠近时,可以很好地工作。随着摄像机的移动进一步移动,KLT算法会分解,并且可以使用功能匹配。

    Distance Between Cameras (Baseline) 查找点对应的方法 例子
    宽的 使用的匹配功能matchFeatures Find Image Rotation and Scale Using Automated Feature Matching
    狭窄 Track features usingvision.PointTracker 使用KLT算法进行面部检测和跟踪

  2. To find the pose of the second camera relative to the first camera, you must compute the fundamental matrix. Use the corresponding points found in the previous step for the computation. The fundamental matrix describes the epipolar geometry of the two cameras. It relates a point in one camera to an epipolar line in the other camera. Use the估算fundaMentalMatrix功能以估计基本矩阵。

  3. 输入基本矩阵relativeCameraPose功能。relativeCameraPose返回第一台相机坐标系中第二摄像头的方向和位置。该位置只能按比例计算,因此两个摄像头之间的距离设置为1。换句话说,摄像机之间的距离定义为1单位。

  4. 使用使用triangulate。Because the pose is up to scale, when you compute the structure, it has the right shape but not the actual size.

    triangulatefunction takes two camera matrices, which you can compute using摄影师

  5. 利用pcshoworPCPLAYER显示重建。利用PlotCamera可视化相机姿势。

要恢复重建的规模,您需要其他信息。恢复量表的一种方法是检测场景中已知大小的对象。这从两种视图的运动发出的结构example shows how to recover scale by detecting a sphere of a known size in the point cloud of the scene.

从多个视图发动的结构

对于大多数应用程序,例如机器人技术和自动驾驶,SFM都使用了两个以上的视图。

这approach used for SfM from two views can be extended for multiple views. The set of multiple views used for SfM can be ordered or unordered. The approach taken here assumes an ordered sequence of views. SfM from multiple views requires point correspondences across multiple images, called轨道。A typical approach is to compute the tracks from pairwise point correspondences. You can useImageViewSetto manage the pairwise correspondences and find the tracks. Each track corresponds to a 3-D point in the scene. To compute 3-D points from the tracks, use三角形象征。3-D点可以存储在世界点集目的。这世界点集object also stores the correspondence between the 3-D points and the 2-D image points across camera views.

从两个视图中使用SFM中的方法,您可以找到相对于相机2的相机2的姿势。要将此方法扩展到多视图盒,请找到相机3相对于相机2的姿势,依此类推。相对姿势必须转换为公共坐标系。通常,所有相机姿势都是相对于相机1计算的,因此所有姿势都在同一坐标系中。您可以使用ImageViewSetto manage camera poses. TheImageViewSetobject stores the views and connections between the views.

每个相机从一个视图到下一个视图的构成估计都包含错误。误差来自图像中的不精确点定位,以及嘈杂的匹配和不精确的校准。随着视图数量的增加,这些错误会累积漂移。减少漂移的一种方法是完善相机姿势和3D点位置。非线性优化算法称为bundle adjustment,由捆绑功能,可用于细化。您可以使用相机姿势修复相机并仅使用3-D点位置来使用BundleadJustmentMotion。您还可以使用相机姿势修复相机并仅使用3-D位置来使用捆绑Structure

减少漂移的另一种方法是使用姿势图优化ImageViewSet目的。一旦检测到循环封闭,请添加重新连接到ImageViewSetobject and use the优化果皮function to refine the camera poses constrained by relative poses.

从两种视图的运动发出的结构example shows how to reconstruct a 3-D scene from a sequence of 2-D views. The example uses the相机校准器app to calibrate the camera that takes the views. It uses aImageViewSetobject to store and manage the data associated with each view.

单眼视觉同时定位和映射example shows you how to process image data from a monocular camera to build a map of an indoor environment and estimate the motion of the camera.

也可以看看

应用

功能

对象

Related Topics