打算直接使用matlab來標定,畢竟opencv自帶的標定不太準確,數學工具還是要利用起來的。
1、單目標定參考
已完成單目標定。具體的內外畸變引數部落格寫的很詳細了。
程式執行示例:
#include "opencv2/opencv.hpp"
#include
using namespace cv;
using namespace std;
int main()
mat frame;
mat framecalibration;
inputvideo >> frame;
mat cameramatrix = mat::eye(3, 3, cv_64f);
cameramatrix.at(0, 0) = 8.020452698431196e+02;
cameramatrix.at(0, 1) = 0;
cameramatrix.at(0, 2) = 3.477773258387357e+02;
cameramatrix.at(1, 1) = 7.986372500898794e+02;
cameramatrix.at(1, 2) = 2.607218924683198e+02;
mat distcoeffs = mat::zeros(5, 1, cv_64f);
distcoeffs.at(0, 0) = -0.174672717467200;
distcoeffs.at(1, 0) = 0.214495208306129;
distcoeffs.at(2, 0) = 0;
distcoeffs.at(3, 0) = 0;
distcoeffs.at(4, 0) = 0;
mat view, rview, map1, map2;
size imagesize;
imagesize = frame.size();
initundistortrectifymap(cameramatrix, distcoeffs, mat(),
getoptimalnewcameramatrix(cameramatrix, distcoeffs, imagesize, 1, imagesize, 0),
imagesize, cv_16sc2, map1, map2);
while (1) //show the image captured in the window and repeat
return 0;
}
可以看到標定過後的圖比原來的好多了。
2、雙目標定參考
要使用兩個攝像頭一起開啟來照相,注意兩個攝像頭之間的距離,然後使用matlab標定完成之後,得到了我們所需要的引數
stereo calibration parameters after loading the individual calibration files:
intrinsic parameters of left camera:
focal length: fc_left = [ 780.17175 777.71912 ] � [ 18.51103 17.77195 ]
principal point: cc_left = [ 341.09426 259.67745 ] � [ 18.38629 13.32784 ]
skew: alpha_c_left = [ 0.00000 ] � [ 0.00000 ] => angle of pixel axes = 90.00000 � 0.00000 degrees
distortion: kc_left = [ -0.12758 -0.14219 0.00102 -0.00229 0.00000 ] � [ 0.06322 0.40645 0.00392 0.00556 0.00000 ]
intrinsic parameters of right camera:
focal length: fc_right = [ 804.25246 798.53096 ] � [ 26.86921 25.78932 ]
principal point: cc_right = [ 313.31520 266.26038 ] � [ 21.46775 18.09631 ]
skew: alpha_c_right = [ 0.00000 ] � [ 0.00000 ] => angle of pixel axes = 90.00000 � 0.00000 degrees
distortion: kc_right = [ -0.06840 -1.01339 0.00618 -0.00825 0.00000 ] � [ 0.10903 0.96165 0.00489 0.00631 0.00000 ]
extrinsic parameters (position of right camera wrt left camera):
rotation vector: om = [ 0.00866 0.02203 -0.03950 ]
translation vector: t = [ -337.30574 5.34897 65.73400 ]
雙目測距測深度 科普 雙目測距原理
參考資料 1 深度相機原理揭秘 雙目立體視覺 2 雙目測距原理 3 相機標定原理及實現 1 雙目測距基本原理 如圖所示,p點是待測物體,camera r和camera l代表相機的光心位置,兩綠點為點p在兩個相機感光器上的成像點,f為相機焦距,b為兩相機中心距,z為所求深度資訊,兩綠點間距為d。d ...
opencv雙目測距實現
開篇之前,首先要感謝maxwellsdemon和wobject,沒有和你們的討論,也就沒有此篇的成文。說到雙攝像頭測距,首先要複習一下測距原理,把learning opencv翻到416和418頁,可以看到下面兩幅圖 圖1.雙攝像頭模型俯檢視 圖2,雙攝像頭模型立體檢視 圖1解釋了雙攝像頭測距的原理...
雙目測距的實現
說到雙攝像頭測距,首先要複習一下測距原理,把learning opencv翻到416和418頁,可以看到下面兩幅圖 圖1.雙攝像頭模型俯檢視 圖2,雙攝像頭模型立體檢視 圖1解釋了雙攝像頭測距的原理,書中z的公式如下 在opencv中,f的量綱是畫素點,tx的量綱由定標棋盤格的實際尺寸和使用者輸入值...