Line 300... |
Line 300... |
300 |
|
300 |
|
301 |
bool success0 = detectCheckerBoardCorners(checkerCount, calibrationSet.frame0, calibrationSet.frame0Result, calibrationSet.qc0);
|
301 |
bool success0 = detectCheckerBoardCorners(checkerCount, calibrationSet.frame0, calibrationSet.frame0Result, calibrationSet.qc0);
|
302 |
if(!success0){
|
302 |
if(!success0){
|
303 |
// calibrationSet.qc0.clear();
|
303 |
// calibrationSet.qc0.clear();
|
304 |
emit logMessage(QString("Could not detect checkerboard on set %1 camera0").arg(calibrationSet.id));
|
304 |
emit logMessage(QString("Could not detect checkerboard on set %1 camera0").arg(calibrationSet.id));
|
- |
|
305 |
std::cerr << "Could not detect checkerboard on set " << calibrationSet.id << " camera0" << std::endl;
|
305 |
}
|
306 |
}
|
306 |
|
307 |
|
307 |
bool success1 = detectCheckerBoardCorners(checkerCount, calibrationSet.frame1, calibrationSet.frame1Result, calibrationSet.qc1);
|
308 |
bool success1 = detectCheckerBoardCorners(checkerCount, calibrationSet.frame1, calibrationSet.frame1Result, calibrationSet.qc1);
|
308 |
if(!success1){
|
309 |
if(!success1){
|
309 |
// calibrationSet.qc1.clear();
|
310 |
// calibrationSet.qc1.clear();
|
310 |
emit logMessage(QString("Could not detect checkerboard on set %1 camera1").arg(calibrationSet.id));
|
311 |
emit logMessage(QString("Could not detect checkerboard on set %1 camera1").arg(calibrationSet.id));
|
- |
|
312 |
std::cerr << "Could not detect checkerboard on set " << calibrationSet.id << " camera1" << std::endl;
|
311 |
}
|
313 |
}
|
312 |
|
314 |
|
313 |
emit newCheckerboardResult(calibrationSet.id, calibrationSet);
|
315 |
emit newCheckerboardResult(calibrationSet.id, calibrationSet);
|
314 |
|
316 |
|
315 |
}
|
317 |
}
|
Line 352... |
Line 354... |
352 |
cal.frameWidth = calibrationData[0].frame0.cols;
|
354 |
cal.frameWidth = calibrationData[0].frame0.cols;
|
353 |
cal.frameHeight = calibrationData[0].frame0.rows;
|
355 |
cal.frameHeight = calibrationData[0].frame0.rows;
|
354 |
cv::Size frameSize(cal.frameWidth, cal.frameHeight);
|
356 |
cv::Size frameSize(cal.frameWidth, cal.frameHeight);
|
355 |
|
357 |
|
356 |
// determine only k1, k2 for lens distortion
|
358 |
// determine only k1, k2 for lens distortion
|
357 |
int flags = cv::CALIB_FIX_ASPECT_RATIO + cv::CALIB_FIX_K3 + cv::CALIB_ZERO_TANGENT_DIST + cv::CALIB_FIX_PRINCIPAL_POINT;
|
359 |
int flags = cv::CALIB_FIX_ASPECT_RATIO + cv::CALIB_FIX_K2 + cv::CALIB_FIX_K3 + cv::CALIB_ZERO_TANGENT_DIST + cv::CALIB_FIX_PRINCIPAL_POINT;
|
358 |
|
360 |
|
359 |
std::vector<cv::Mat> cam_rvecs0, cam_tvecs0;
|
361 |
std::vector<cv::Mat> cam_rvecs0, cam_tvecs0;
|
360 |
|
362 |
|
361 |
cal.cam0_error = cv::calibrateCamera(Q0, qc0, frameSize, cal.K0, cal.k0, cam_rvecs0, cam_tvecs0, cal.cam0_intrinsic_std, cal.cam0_extrinsic_std, cal.cam0_errors_per_view, flags,
|
363 |
cal.cam0_error = cv::calibrateCamera(Q0, qc0, frameSize, cal.K0, cal.k0, cam_rvecs0, cam_tvecs0, cal.cam0_intrinsic_std, cal.cam0_extrinsic_std, cal.cam0_errors_per_view, flags,
|
362 |
cv::TermCriteria(cv::TermCriteria::COUNT+cv::TermCriteria::EPS, 100, DBL_EPSILON));
|
364 |
cv::TermCriteria(cv::TermCriteria::COUNT+cv::TermCriteria::EPS, 100, DBL_EPSILON));
|