Skip to content
Snippets Groups Projects
Commit 6b1c87d8 authored by Sebastian Hahta's avatar Sebastian Hahta
Browse files

Revert changes to stereo calibrate

parent b6e8e14c
No related branches found
No related tags found
1 merge request!7Feature/chessboardcornerssb
Pipeline #10832 passed
......@@ -391,16 +391,12 @@ bool Calibrate::_recalibrate(vector<vector<Point2f>> *imagePoints,
double prevTimestamp = 0.0;
const Scalar RED(0, 0, 255), GREEN(0, 255, 0);
#if CV_VERSION_MAJOR >= 4
int chessBoardFlags = CALIB_CB_NORMALIZE_IMAGE;
#else
int chessBoardFlags = CALIB_CB_ADAPTIVE_THRESH | CALIB_CB_NORMALIZE_IMAGE;
if (!settings_.useFisheye) {
// fast check erroneously fails with high distortions like fisheye
chessBoardFlags |= CALIB_CB_FAST_CHECK;
}
#endif
for (;;) {
Mat view[2];
......@@ -436,41 +432,31 @@ bool Calibrate::_recalibrate(vector<vector<Point2f>> *imagePoints,
vector<Point2f> pointBuf[2];
bool found1, found2;
#if CV_VERSION_MAJOR >= 4
found1 = findChessboardCornersSB(view[0], settings_.boardSize,
pointBuf[0], chessBoardFlags);
found2 = !local_->isStereo() || findChessboardCornersSB(view[1],
settings_.boardSize, pointBuf[1], chessBoardFlags);
#else
found1 = findChessboardCorners(view[0], settings_.boardSize,
pointBuf[0], chessBoardFlags);
found2 = !local_->isStereo() || findChessboardCorners(view[1],
settings_.boardSize, pointBuf[1], chessBoardFlags);
#endif
if (found1 && found2 &&
local_->getTimestamp()-prevTimestamp > settings_.delay) {
prevTimestamp = local_->getTimestamp();
#if CV_VERSION_MAJOR >=4
// findChessboardCornersSB() does not require subpixel step.
#else
// improve the found corners' coordinate accuracy for chessboard.
// improve the found corners' coordinate accuracy for chessboard
Mat viewGray;
cvtColor(view[0], viewGray, COLOR_BGR2GRAY);
cornerSubPix(viewGray, pointBuf[0], Size(winSize, winSize),
Size(-1, -1), TermCriteria(
TermCriteria::EPS+TermCriteria::COUNT, 30, 0.0001));
imagePoints[0].push_back(pointBuf[0]);
if (local_->isStereo()) {
cvtColor(view[1], viewGray, COLOR_BGR2GRAY);
cornerSubPix(viewGray, pointBuf[1], Size(winSize, winSize),
Size(-1, -1), TermCriteria(
TermCriteria::EPS+TermCriteria::COUNT, 30, 0.0001));
imagePoints[1].push_back(pointBuf[1]);
}
#endif
imagePoints[0].push_back(pointBuf[0]);
if (local_->isStereo()) { imagePoints[1].push_back(pointBuf[1]); }
// Draw the corners.
// Draw the corners.
drawChessboardCorners(view[0], settings_.boardSize,
Mat(pointBuf[0]), found1);
if (local_->isStereo()) drawChessboardCorners(view[1],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment