双目匹配

matchFeatures

Lecture 06Point Feature Detection and MatchingPart 2 

【OpenCV】立体匹配算法 StereoBM/StereoSGBM/StereoVar

 为了模拟人眼对立体场景的捕捉和对不同景物远近的识别能力,立体匹配算法要求采用两个摄像头代替人眼,通过获取两幅非常接近的图片以获取景深(视差:Disparity),从而计算出不同景物与摄像头的距离,得到景深图。

 具体计算方法为:

  当采取两个同一水平线上的摄像头进行拍摄的时候,同一物体将在两个摄像机内被拍摄到,在两个摄像机内部,这个物体相对于摄像机中心点位置有不同的坐标,如上图2所示。Xleft是该物体在左摄像机内相对位置,Xright是该物体在右摄像机内相对位置。两个摄像机相距S,焦距为f,物体P距离摄像机z,z也就是景深。当我们将两幅图像重叠在一起的时候,左摄像机上P的投影和右摄像机上P的投影位置有一个距离|Xleft|+|Xright|,这个距离称为Disparity,根据相似三角形图3可以得到z=sf/d. 也就是只要计算得到了d的值,就可以计算得到深度图。而在计算d的值的过程中需要对两幅图像进行匹配,寻找到物体P在两幅图像中的相对位置。在对图像进行匹配的过程中,需要用到cost computation,即通过寻找同一水平线上两幅图像上的点的最小误差来确定这两个点是否是同一个物体所成的像。由于一个点所能提供的信息太少,因此往往需要扩大对比的范围。

 

双目立体视觉匹配算法之视差图disparity计算——SAD算法、SGBM算法 

 

真实场景的双目立体匹配(Stereo Matching)获取深度图详解

之前有两篇博客简要讲过OpenCV3.4中的两种立体匹配算法效果比较:http://www.cnblogs.com/riddick/p/8318997.html 。以及利用视差图合成新视点: http://www.cnblogs.com/riddick/p/7355353.html。里面用到的匹配图像对是OpenCV自带校正好的图像对。而目前大多数立体匹配算法使用的都是标准测试平台提供的标准图像对,比如著名的有如下两个:
  MiddleBury: http://vision.middlebury.edu/stereo/

  KITTI:http://www.cvlibs.net/datasets/kitti/eval_scene_flow.php?benchmark=stereo

但是对于想自己尝试拍摄双目图片进行立体匹配获取深度图,进行三维重建等操作的童鞋来讲,要做的工作是比使用校正好的标准测试图像对要多的。因此博主觉得有必要从用双目相机拍摄图像开始,捋一捋这整个流程。

在opencv中的实现为semi-global block matching(SGBM)讲解 

SGBM的思路:
通过选取每个像素点的disparity,组成一个视差图(disparity map),设置一个和视差图相关的全局能量函数,使这个能量函数最小化,以达到求解每个像素最优disparity (视差)的目的 。
能量函数的形式如下
在这里插入图片描述
D指disparity map。 E(D)是该disparity map 对应的能量函数。
p,q 代表图像中的某个像素。
Np指像素p的相临像素点。
C(p,Dp)指当前像素点disparity为Dp时,该像素点的cost(损失)。
P1是一个惩罚系数,它适用于像素p相邻像素中disparity值与disparity值相差1的那些像素。
P2是一个惩罚系数,它适用于像素p相邻像素中disparity值与p的disparity值相差大于1的那些像素。
I[.]函数返回1如果函数中的参数为真,否则返回0。 

Stereo Vision Tutorial - Part I            写得相当清楚 

Stereo Vision: Algorithms and Applications       相当详细 

Disparity Map 

COMPARISON OF OPEN SOURCE STEREO VISION ALGORITHMS  这一篇最好,简单明了,思路清晰,尤其是前期介绍部分

The whole method is based on the idea of pixelwise matching of Mutual Information and approximating a global, two dimensional smoothness constraints by combining many single dimensional constraints. In a nutshell, the main algorithm has the following processing steps: 1) Pixelwise cost calculation 2) Implementation of the smoothness constraint 3) disparity computation with sub-pixel accuracy and occlusion detection.

OpenCV uses a modified version of the original Hirschmuller algorithm. Contrary to the original algorithm that considers 8 directions, this one considers only 5 (single pass). Also this variation matches blocks, not individual pixels thus the Semi Global Block Matching naming. The parameters of this modified version can be tuned so the algorithm will behave like the original one.

Also, mutual information cost function is not implemented. Instead a simpler Birchfield-Tomasi sub-pixel metric is used. Finally, some pre and post processing steps from the Konolige Block Matching implementation are included, for example pre and post filtering. It is evident from the few identical parameters between the two algorithms.

Smoothness constraint in Computer Vision

The smoothness constraint (over space) refers to an assumption that pixel values will change slowly as you move in any direction, and they'll likely be close in value to their neighbors.

In the shape-from-shading context, this could mean that the smoothness is over the recovered 3d position. Adjacent pixels should project to locations close in 3d space.

 

平滑约束

结合运动平滑约束与灰度特征的卫星视频点目标跟踪

 

初识立体匹配算法       提到两篇综述,很有意义

The most commonly adopted assumption is that the scene is locally smooth except for object boundaries, and thus neighboring pixels should have very similar disparities. This constraint is referred to as a smoothness constraint in the stereo vision literature.

Depth Discontinuities by Pixel-to-Pixel Stereo         BT代价原论文

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值