Ich lerne opencv und testet eine Stereokamera. In meinem Code gibt die stereoRectify-Funktion manchmal ROI mit seiner Größe (0,0) zurück. Ich kann dieses Problem nicht herausfinden.Warum cv :: stereoRectify Return ROI mit Größe (0,0)
Mat cameraMatrix[2], distCoeffs[2];
cameraMatrix[0] = initCameraMatrix2D(objectPoints, imagePoints_l,
imageSize, 0);
cameraMatrix[1] = initCameraMatrix2D(objectPoints, imagePoints_r,
imageSize, 0);
Mat R, T, E, F;
double rms = stereoCalibrate(objectPoints, imagePoints_l, imagePoints_r,
cameraMatrix[0], distCoeffs[0],
cameraMatrix[1], distCoeffs[1],
imageSize, R, T, E, F,
CALIB_FIX_ASPECT_RATIO +
CALIB_ZERO_TANGENT_DIST +
CALIB_USE_INTRINSIC_GUESS +
CALIB_SAME_FOCAL_LENGTH +
CALIB_RATIONAL_MODEL +
CALIB_FIX_K3 + CALIB_FIX_K4 + CALIB_FIX_K5,
TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 100, 1e-5));
Mat R1, R2, P1, P2, Q;
Rect validRoi[2];
stereoRectify(cameraMatrix[0], distCoeffs[0],
cameraMatrix[1], distCoeffs[1],
imageSize, R, T, R1, R2, P1, P2, Q,
CALIB_ZERO_DISPARITY, 0.5, imageSize, &validRoi[0], &validRoi[1]);
cout << validRoi[0] << validRoi[1] << endl;
Es Ausgangsklemme:
[0 x 0 from (0, 0)][215 x 184 from (77, 19)]
oder:
[0 x 0 from (0, 0)][0 x 0 from (0, 0)]
I-Ausgang auch die Kameramatrix und Verzeichnung matrix:
[204.3355426705726, 0, 193.3280616575545;
0, 189.8976931576431, 123.307676870377;
0, 0, 1]
[-0.5404320611827982, 0.3292134879059271, 0, 0, 0, 0, 0,
0.1371856537119246, 0, 0, 0, 0, 0, 0]
[204.3355426705726, 0, 183.756931129648;
0, 189.8976931576431, 131.4500619272754;
0, 0, 1]
[-0.524923482702874, 0.3121043629068334, 0, 0, 0, 0, 0,
0.1269780773557047, 0, 0, 0, 0, 0, 0]
Ich habe einige Codes und Ausgaben hinzugefügt. Vielen Dank. – Ayoung