stereoRectifyUncalibrated

stereoRectifyUncalibrated

本文介绍了通过基线和单相机校准从2张图像进行3D重建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的学期项目是校准大基线(〜2m)的立体声相机.因此,我的方法是在没有像棋盘那样精确定义的校准模式下运行,因为它必须很大并且很难处理.

my semester project is to Calibrate Stereo Cameras with a big baseline (~2m).so my approach is to run without exact defined calibration pattern like the chessboard cause it had to be huge and would be hard to handle.

我的问题与此类似:从2张图像中进行3d重建,而没有有关相机的信息

到目前为止的程序:

  • 拐角检测左图像goodFeaturesToTrack
  • 精致的角cornerSubPix
  • 在右侧图像calcOpticalFlowPyrLK
  • 中查找角位置
  • 计算基本矩阵F findFundamentalMat
  • 计算H1,H2整流单应矩阵stereoRectifyUncalibrated
  • 整理图像warpPerspective
  • 计算视差图sgbm
  • Corner detection left image goodFeaturesToTrack
  • refined corners cornerSubPix
  • Find corner locations in right image calcOpticalFlowPyrLK
  • calculate fundamental matrix F findFundamentalMat
  • calculate H1, H2 rectification homography matrix stereoRectifyUncalibrated
  • Rectify images warpPerspective
  • Calculate Disparity map sgbm

到目前为止,它的效果很好,但是如果改变角点的数量,校正后的图像在角度上跳跃".

so far so good it works passably but rectified images are "jumping" in perspective if i change the number of corners..

不知道这是否是形式不正确或错误,或者是由于没有已知的相机参数或没有镜头畸变补偿而无法计算(也可能在Tsukuba照片上发生).欢迎提出建议:)

don't know if this if form imprecision or mistakes i mad or if it cant be calculated due to no known camera parameters or no lens distortion compensation (but also happens on Tsukuba pics..)suggestions are welcome :)

但不是我的主要问题,现在我想重建3D点.

but not my main problem, now i want to reconstruct the 3D points.

但是reprojectImageTo3D需要我到目前为止还没有的Q矩阵.所以我的问题是如何计算呢?我有基线,两个摄像机之间的距离.我的感觉是,如果我将视差图转换为3d点云,唯一缺少的就是比例尺了吗?因此,如果我将基线设置为3D,那么对吗?那怎么办?我还计划用棋盘分别补偿每个摄像机的镜头畸变(每次较小且一次接近一台摄像机,因此我不必在两者的重叠区域中相距10-15m处有大图案的情况). .)因此,如果有帮助,我也可以使用相机参数.

but reprojectImageTo3D needs the Q matrix which i don't have so far. so my question is how to calculate it? i have the baseline, distance between the two cameras. My feeling says if i convert des disparity map in to a 3d point cloud the only thing im missing is the scale right? so if i set in the baseline i got the 3d reconstruction right? then how to?im also planing to compensate lens distortion as the first step for each camera separately with a chessboard (small and close to one camera at a time so i haven't to be 10-15m away with a big pattern in the overlapping area of both..) so if this is helping i could also use the camera parameters..

除了 http://docs.opencv.org 之外,是否还有其他文档?如果我在Qt中按F2键,则我可以看到并了解Q矩阵的计算方式以及如何计算Q矩阵,或者我可以打开源代码(对我来说可能很难理解^^),我只能看到具有传递参数类型的函数.抱歉,我对这一切真的很陌生)

is there a documentation besides the http://docs.opencv.org? that i can see and understand what and how the Q matrix is calculated or can i open the source code (probably hard to understand for me ^^) if i press F2 in Qt i only see the function with the transfer parameter types.. (sorry im really new to all of this )

  • 左:输入带有找到的角
  • h1,h2上方:校正图像(此角点数^^看起来不错)
  • SGBM:视差图

推荐答案

所以我在这里发现了Q矩阵的约束:使用OpenCV生成3d点(假设正面并行配置)

so i found out what the Q matrix constrains here:Using OpenCV to generate 3d points (assuming frontal parallel configuration)

所有这些参数均由单摄像机校准给出:c_x,c_y,f

all these parameters are given by the single camera calibration:c_x , c_y , f

和基线是我测量的:T_x

and the baseline is what i have measured:T_x

所以这暂时有效,我对这些单位还不太清楚,我已经使用它们形成了以px为单位的单相机校准,并以米为单位设置了基线,将视差图除以16,但没有接缝.合适的比例尺..

so this works for now, only the units are not that clear to me, i have used them form single camera calib which are in px and set the baseline in meters, divided the disparity map by 16, but it seams not the right scale..

顺便说一句,上面的视差图是错误的^^,现在看起来更好了.您必须执行反剪切转换,导致stereoRectifyUncalibrated剪切图像(未记录?).本文在Charles Loop Zhang Zhengyou Zhang的"7 Shearing Transform"中进行了描述: http://research.microsoft.com/zh-cn/um/people/Zhang/Papers/TR99-21.pdf

by the way the disparity map above was wrong ^^ and now it looks better. you have to do a anti Shearing Transform cause the stereoRectifyUncalibrated is Shearing your image (not documented?).described in this paper at "7 Shearing Transform" by Charles Loop Zhengyou Zhang:http://research.microsoft.com/en-us/um/people/Zhang/Papers/TR99-21.pdf

结果: http://i.stack.imgur.com/UkuJi.jpg

这篇关于通过基线和单相机校准从2张图像进行3D重建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-26 00:32