1
我使用的OpenCV stereoRectify
有許多問題,這些都是我的變量:cvGEMM斷言OpenCV中
Mat K_02 = (Mat_<double>(3,3) << 9.597910e+02, 0.000000e+00, 6.960217e+02,
0.000000e+00, 9.569251e+02, 2.241806e+02,
0.000000e+00, 0.000000e+00, 1.000000e+00);
Mat K_03 = (Mat_<double>(3,3) << 9.037596e+02, 0.000000e+00, 6.957519e+02,
0.000000e+00, 9.019653e+02, 2.242509e+02,
0.000000e+00, 0.000000e+00, 1.000000e+00);
Mat D_02 = (Mat_<double>(1,5) << -3.691481e-01, 1.968681e-01, 1.353473e-03, 5.677587e-04, -6.770705e-02);
Mat D_03 = (Mat_<double>(1,5) << -3.639558e-01, 1.788651e-01, 6.029694e-04, -3.922424e-04, -5.382460e-02);
Mat R_02 = (Mat_<double>(3,3) << 9.999758e-01, -5.267463e-03, -4.552439e-03,
5.251945e-03, 9.999804e-01, -3.413835e-03,
4.570332e-03, 3.389843e-03, 9.999838e-01);
transpose(R_02,R_02);
Mat R_03 = (Mat_<double>(3,3) << 9.995599e-01, 1.699522e-02, -2.431313e-02,
-1.704422e-02, 9.998531e-01, -1.809756e-03,
2.427880e-02, 2.223358e-03, 9.997028e-01);
Mat T_02 = (Mat_<double>(1,3) << 5.956621e-02, 2.900141e-04, 2.577209e-03);
Mat T_03 = (Mat_<double>(1,3) << -4.731050e-01, 5.551470e-03, -5.250882e-03);
Mat rotation = cv::Mat::zeros(3, 3, R_03.type());
Mat translation = cv::Mat::zeros(1, 3, T_03.type());
rotation = R_02 * R_03;
translation = T_02 - T_03;
使用KITTI數據集中獲得這些變量,現在我想獲得Q矩陣重建現場,問題是,使用stereoRectify
:
Mat R1,R2,P1,P2,Q;
stereoRectify(K_02, D_02, K_03, D_03, size, rotation, translation, R1, R2, P1, P2, Q);
是給我一個可怕的斷言:
OpenCV Error: Assertion failed ((D.rows == ((flags & CV_GEMM_A_T) == 0 ? A.rows : A.cols)) && (D.cols == ((flags & CV_GEMM_B_T) == 0 ? B.cols : B.rows)) && D.type() == A.type()) in cvGEMM, file /build/buildd/opencv-2.4.9+dfsg/modules/core/src/matmul.cpp, line 3150
我無法調試它,因爲gdb(throught Kdevelop)找不到openCV的源代碼(我已經使用存儲庫安裝了它)。我在網上看到了如何使用這個函數,但它總是使用stereoCalibrate
函數的輸出,所以我不知道哪個是用於定義我的內在矩陣的正確類型。
有人可以給我如何避免斷言提示嗎?
謝謝老兄! – Luca