I'm recently using the Matlab Single Camera Calibration App algorithm to calibrate the camera intrinsics and extrinsics. On finding corners of the chessboard, many times detectCheckerboardPoints function of Matlab out performs (accuracy) the opencv api cv::findChessboardCorners, yet on some pictures, Matlab behaves strange.
E.g., in the following image, corners between board squares are clear to see, while matlab finds redundant ones on strange places:
original image: //there should be 5*8=40 inner corner points

corner points found on the undistorted image: //6*9=54 found

The matlab code snippet is simple as below:
img=imread(fn);
[imUndist, newOrig]=undistortImage(img, cameraParams);
[pxs, bdsize]=detectCheckerboardPoints(imUndist); %or detect on 'img' directly
imMarked=insertMarker(imUndist, pxs);
imshow(imMarked);
- corners detected with
opencv(code below) on this image is much precise:
//opencv code:
Mat img = imread(fpath);
int ww = 8, hh = 15;
cv::Size bsz(ww, hh);
vector<Point2f> ptvec;
bool found = cv::findChessboardCorners(img, bsz, ptvec, CALIB_CB_ADAPTIVE_THRESH + CALIB_CB_NORMALIZE_IMAGE);
cv::drawChessboardCorners(img, bsz, ptvec, found);
imshow("img", img);
waitKey();

