Matlab detectCheckerboardPoints imperfection (vs. opencv), how to improve it's accuracy?
Show older comments
PS: I've posted the same question here: http://stackoverflow.com/questions/41064292/matlab-detectcheckerboardpoints-imperfection
NOTE: For some reason, I have to use the image I posted below. How can I succeed this job in Matlab?
---------------
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:
1. original image: //there should be 5*8=40 inner corner points

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

3. points found on the original image: //6*10=60...

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);
4. 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();

Answers (0)
Categories
Find more on Computer Vision Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!