mirror of
https://github.com/zebrajr/opencv.git
synced 2025-12-06 00:19:46 +01:00
Merge pull request #27571 from asmorkalov:as/calib_tutorial_fix
Use calibration board imperfectness correction only for the cases where it's applicable
This commit is contained in:
commit
2ab4bd3405
|
|
@ -178,8 +178,19 @@ static bool runCalibration( vector<vector<Point2f> > imagePoints,
|
|||
|
||||
vector<vector<Point3f> > objectPoints(1);
|
||||
calcChessboardCorners(boardSize, squareSize, objectPoints[0], patternType);
|
||||
int offset = patternType != CHARUCOBOARD ? boardSize.width - 1: boardSize.width - 2;
|
||||
objectPoints[0][offset].x = objectPoints[0][0].x + grid_width;
|
||||
// Board imperfectness correction introduced in PR #12772
|
||||
// The correction does not make sense for asymmetric and assymetric circles grids
|
||||
if (patternType == CHESSBOARD)
|
||||
{
|
||||
int offset = boardSize.width - 1;
|
||||
objectPoints[0][offset].x = objectPoints[0][0].x + grid_width;
|
||||
}
|
||||
else if (patternType == CHARUCOBOARD)
|
||||
{
|
||||
int offset = boardSize.width - 2;
|
||||
objectPoints[0][offset].x = objectPoints[0][0].x + grid_width;
|
||||
}
|
||||
|
||||
newObjPoints = objectPoints[0];
|
||||
|
||||
objectPoints.resize(imagePoints.size(),objectPoints[0]);
|
||||
|
|
|
|||
|
|
@ -640,10 +640,15 @@ static bool runCalibration( Settings& s, Size& imageSize, Mat& cameraMatrix, Mat
|
|||
|
||||
vector<vector<Point3f> > objectPoints(1);
|
||||
calcBoardCornerPositions(s.boardSize, s.squareSize, objectPoints[0], s.calibrationPattern);
|
||||
if (s.calibrationPattern == Settings::Pattern::CHARUCOBOARD) {
|
||||
|
||||
// Board imperfectness correction introduced in PR #12772
|
||||
// The correction does not make sense for asymmetric and assymetric circles grids
|
||||
if (s.calibrationPattern == Settings::Pattern::CHARUCOBOARD)
|
||||
{
|
||||
objectPoints[0][s.boardSize.width - 2].x = objectPoints[0][0].x + grid_width;
|
||||
}
|
||||
else {
|
||||
else if (s.calibrationPattern != Settings::Pattern::CHESSBOARD)
|
||||
{
|
||||
objectPoints[0][s.boardSize.width - 1].x = objectPoints[0][0].x + grid_width;
|
||||
}
|
||||
newObjPoints = objectPoints[0];
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user