代码:
const int boardWidth = 11; //横向角点的数目
const int boardHeight = 8; //纵向角点的数目
const int boardCorner = boardWidth * boardHeight; //总角点的数目
const int frameNumber = 19; //共有多少帧的数据
const int squareSize = 25; //标定板黑白格子的大小 单位:mm
const Size boardSize = Size(boardWidth, boardHeight); //总的角点
bool isFind = findChessboardCorners(src, boardSize, corner, CALIB_CB_ADAPTIVE_THRESH +
CALIB_CB_NORMALIZE_IMAGE);
//所有角点都被找到
if (isFind)
{
//精确角点位置,亚像素角点检测
cornerSubPix(src, corner, Size(5, 5), Size(-1, -1), TermCriteria(CV_TERMCRIT_EPS | CV_TERMCRIT_ITER, 20, 0.1));
//绘制角点
drawChessboardCorners(showMat, boardSize, corner, isFind);
corners.push_back(corner);
}
结果: