2015-11-08 63 views
1

要做到立體聲校準我們需要做的3個步驟(輸入PARAMS - >輸出PARAMS):爲什麼我們需要輸入(camera_matrix 1&2)和(R和T)參數到stereoRectify()?

  1. calibrateCamera():obj_corners,img_corners - > camera_matrix,distortion_coeffs

  2. stereoCalibrate():obj_corners,img_corners1/2,camera_matrix1/2,distortion_coeffs1/2 - > R,T,E,F

  3. stereoRectify():camera_matrix1/2,distortion_coeffs1/2,R,T - > R1/2,P1/2,Q

我錯過了一些參數。

現在我們可以使用Q代替reprojectImageTo3D(),P1或P2代替triangulatePoints()

但是爲什麼我們需要同時輸入(camera_matrix 1 & 2)和(R & T)params到stereoRectify()

衆所周知camera_matrix已經包含[R & T:

struct CV_EXPORTS CameraParams 
{ 
    CameraParams(); 
    CameraParams(const CameraParams& other); 
    const CameraParams& operator =(const CameraParams& other); 
    Mat K() const; 

    double focal; // Focal length 
    double aspect; // Aspect ratio 
    double ppx; // Principal point X 
    double ppy; // Principal point Y 
    Mat R; // Rotation 
    Mat t; // Translation 
}; 

什麼是[R & t內從我們calibrateCamera()和R是包含在我們從stereoCalibrate()得到CameraParams &噸得到的區別?

+2

您似乎在混合相機矩陣(僅限內部參數)和拼接命名空間的CameraParams結構,其中包含其他內容(包括外部因素)。 –

+0

@Joan Charmant I.e.相機矩陣 - 3x3矩陣(只有內部參數'K'),但是'stitch :: detail :: CameraParams' - 3x4矩陣(內部和外部參數'K * [R | t]'),不是嗎? ?這是否意味着,'stitch :: detail :: CameraParams'是一個P(投影矩陣)? – Alex

回答

2

這裏的問題是不一致的術語。什麼OpenCV呼叫攝像頭矩陣是一個3x3矩陣K包含intrinsics。什麼哈雷和Zisserman電話相機矩陣是一個3x4相機投影矩陣P = K * [R|t],其中包括內在和extrinsics。

+0

謝謝。但是'stitch :: detail :: CameraParams'是投影矩陣'P = K * [R | t]'?因爲它包含'R'&'T'和'K':http://docs.opencv.org/2.4/modules/stitching/doc/camera.html其中'K'是:https://github.com/ Itseez/opencv/blob/ddf82d0b154873510802ef75c53e628cd7b2cb13/modules/stitching/src/camera.cpp#L64 – Alex

+0

'stitch :: detail :: CameraParams'是一個C++類,不是矩陣。 'stereoRectify()'函數不需要'CameraParams'對象。它需要包含矩陣的'cv :: Mat'對象。 – Dima

+0

是的,我的意思是'stitch :: detail :: CameraParams'包含所有與'P'相同的數據,我們可以從'stitch :: detail :: CameraParams'獲得'P'。 – Alex

相關問題