【1】以前的笔记,具体内容需要者自取吧。
单目 opencv标定根据的是 https://blog.csdn.net/t247555529/article/details/47836233
单目opencv标定根据的是 https://blog.csdn.net/qq_35971623/article/details/78297911?locationNum=1&fps=1
MATLAB 单目和双目根据的是 https://blog.csdn.net/kaspar1992/article/details/54344965
搜索关键词 视差图 深度图 孔洞 空洞
空洞填充 https://wenku.baidu.com/view/c2c40c85fe4733687f21aaa3.html 【两次滤波】
https://www.cnblogs.com/riddick/p/8486223.html 【给了一部分代码在底部】
https://www.cnblogs.com/riddick/p/8486223.html 代码放到N盘了哈
自带标定例子能达到下面的效果,所以。。 标定是否达标,就以这个为标准吧
理论上的研究https://wenku.baidu.com/view/e47de0dbc9d376eeaeaad1f34693daef5ef7133f.html
进行摄像头定标时,棋盘方格的实际大小 square_size (默认为 1.0f )的设置对定标参数是否有影响?
“@scyscyao :当然有。在标定时,需要指定一个棋盘方格的长度,这个长度(一般以毫米为单位,如果需要更精确可以设为0.1毫米量级)与实际长度相同,标 定得出的结果才能用于实际距离测量。一般如果尺寸设定准确的话,通过立体标定得出的Translation向量的第一个分量Tx的绝对值就是左右摄像头的中心距。一般可以用这个来验证立体标定的准确度。比如我设定的棋盘格大小为270 (27mm),最终得出的Tx大小就是602.8 (60.28mm),相当精确。”
基于双目视觉的三维重建与测量技术研究
0.26 这个有转动棋盘
、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、
没有转动情况下情况良好
、、、、、、、、、、、、、、、、、、、、
matlab标定:主要参考下面的程序
https://blog.csdn.net/kaspar1992/article/details/54344965
Aspect ratio optimized (est_aspect_ratio = 1) -> both components of fc are estimated (DEFAULT).
Principal point optimized (center_optim=1) - (DEFAULT). To reject principal point, set center_optim=0
Skew not optimized (est_alpha=0) - (DEFAULT)
Distortion not fully estimated (defined by the variable est_dist):
Sixth order distortion not estimated (est_dist(5)=0) - (DEFAULT) .
Initialization of the principal point at the center of the image.
Initialization of the intrinsic parameters using the vanishing points of planar patterns.
Initialization of the intrinsic parameters - Number of images: 20
Calibration parameters after initialization:
Focal Length: fc = [ 939.72654 939.72654 ]
Principal point: cc = [ 319.50000 239.50000 ]
Skew: alpha_c = [ 0.00000 ] => angle of pixel = 90.00000 degrees
Distortion: kc = [ 0.00000 0.00000 0.00000 0.00000 0.00000 ]
Main calibration optimization procedure - Number of images: 20
Gradient descent iterations: 1...2...3...4...5...6...7...8...9...10...11...12...13...14...15...16...17...18...19...20...21...22...done
Estimation of uncertainties...done
Calibration results after optimization (with uncertainties):
Focal Length: fc = [ 922.20417 923.89379 ] +/- [ 6.35782 6.37689 ]
Principal point: cc = [ 351.73299 262.49287 ] +/- [ 9.04650 10.18899 ]
Skew: alpha_c = [ 0.00000 ] +/- [ 0.00000 ] => angle of pixel axes = 90.00000 +/- 0.00000 degrees
Distortion: kc = [ -0.09798 -0.48136 0.00704 -0.00121 0.00000 ] +/- [ 0.04372 0.58554 0.00223 0.00245 0.00000 ]
Pixel error: err = [ 0.39989 0.32289 ]
Note: The numerical errors are approximately three times the standard deviations (for reference).
Note: The numerical errors are approximately three times the standard deviations (for reference).
Number(s) of image(s) to show ([] = all images) =
Pixel error: err = [0.39989 0.32289] (all active images)
在面板中单击“Show Extrinsic”。外参(棋盘格相对于相机的相对位置)就以3D的形式显示出来了:
Calibration results after optimization (with uncertainties):
Focal Length: fc = [ 905.01767 906.38908 ] +/- [ 4.20204 4.22668 ]
Principal point: cc = [ 354.96976 266.82158 ] +/- [ 5.97391 6.71897 ]
Skew: alpha_c = [ 0.00000 ] +/- [ 0.00000 ] => angle of pixel axes = 90.00000 +/- 0.00000 degrees
Distortion: kc = [ -0.15451 -0.38352 0.00664 -0.00141 0.00000 ] +/- [ 0.02869 0.37223 0.00122 0.00135 0.00000 ]
Pixel error: err = [ 0.19065 0.29646 ]
Note: The numerical errors are approximately three times the standard deviations (for reference).
可以注意到只需要6次迭代就收敛了,并且没有进行初始化过程(因为优化是在前面标定的结果之上进行的)。上图
中的两个值0.12668和0.12604分别是X和Y方向像素上投影的标准差。注意到标定参数的不确定性也进行了估算。
数值大概是标准差的3倍。
单击save ===》Saving calibration results under Calib_Results.mat
去掉了三四这两张图片之后
Calibration results after optimization (with uncertainties):
Focal Length: fc = [ 895.24447 895.42671 ] +/- [ 3.75406 3.79119 ]
Principal point: cc = [ 374.63834 242.42668 ] +/- [ 5.15280 5.72511 ]
Skew: alpha_c = [ 0.00000 ] +/- [ 0.00000 ] => angle of pixel axes = 90.00000 +/- 0.00000 degrees
Distortion: kc = [ -0.17715 -0.14770 0.00253 -0.00016 0.00000 ] +/- [ 0.02622 0.35614 0.00107 0.00101 0.00000 ]
Pixel error: err = [ 0.17803 0.20835 ]
Note: The numerical errors are approximately three times the standard deviations (for reference).
Recommendation: Some distortion coefficients are found equal to zero (within their uncertainties).
To reject them from the optimization set est_dist=[1;0;1;1;0] and run Calibration
、、、、、、、、、、、、、、、、
双目
Main calibration optimization procedure - Number of images: 20 Gradient descent iterations: 1...2...3...4...5...6...7...8...9...10...11...12...13...14...15...16...17...18...19...20...21...22...23...done Estimation of uncertainties...done Calibration results after optimization (with uncertainties): Focal Length: fc = [ 903.36808 905.08398 ] +/- [ 4.35576 4.33065 ] Principal point: cc = [ 271.70839 203.90351 ] +/- [ 6.14347 6.96843 ] Skew: alpha_c = [ 0.00000 ] +/- [ 0.00000 ] => angle of pixel axes = 90.00000 +/- 0.00000 degrees Distortion: kc = [ -0.17976 -0.14665 0.00659 0.00245 0.00000 ] +/- [ 0.02416 0.17471 0.00119 0.00174 0.00000 ] Pixel error: err = [ 0.20973 0.29976 ] Note: The numerical errors are approximately three times the standard deviations (for reference).
right
Calibration results after optimization (with uncertainties):
Focal Length: fc = [ 890.07388 890.97664 ] +/- [ 4.05473 4.05219 ]
Principal point: cc = [ 282.68313 188.02242 ] +/- [ 4.78063 5.94285 ]
Skew: alpha_c = [ 0.00000 ] +/- [ 0.00000 ] => angle of pixel axes = 90.00000 +/- 0.00000 degrees
Distortion: kc = [ -0.18932 -0.06016 0.00477 0.00296 0.00000 ] +/- [ 0.01927 0.16585 0.00101 0.00130 0.00000 ]
Pixel error: err = [ 0.17969 0.18956 ]
Note: The numerical errors are approximately three times the standard deviations (for reference).
Recommendation: Some distortion coefficients are found equal to zero (within their uncertainties).
To reject them from the optimization set est_dist=[1;0;1;1;0] and run Calibration
http://blog.sina.com.cn/s/blog_5328beed0100lqtg.html
Main stereo calibration optimization procedure - Number of pairs of images: 17
Gradient descent iterations: 1...Disabling view 2 - Reason: the left and right images are found inconsistent (try help calib_stereo for more information)
Disabling view 6 - Reason: the left and right images are found inconsistent (try help calib_stereo for more informatio