Reason for Checkerboard Corner Detection to Fail

35 views (last 30 days)
I am using MATLAB R2014b to calibrate a stereo setup. I have 150 images of my checkerboard at various angles and distances. While using the Camera Calibrator app, I noticed that only 21 images were used for calibration, while the others were rejected. This is because detectCheckerboardPoints function is not able to detect the corner points in the remaining 129 images. Though the board is symmetric, the points have been detected properly in those 21 images (instead of 5X5, 5X4 points were detected, which isn't a problem for me)
This is the code used:
I1 = imread('T100009_141.jpg');
imshow(I1);
[imagePoints, boardSize] = detectCheckerboardPoints(I1);
figure;
imshow(I1, 'InitialMagnification', 50);
hold on;
plot(imagePoints(:, 1, 1, 1),imagePoints(:, 2, 1, 1), '*-g');
title('Successful Checkerboard Detection')
To improve the reconstruction algorithm, I want more images to be used in Calibration. Why aren't the corners detected in all these images, though they don't appear to have a lot of tilt?
This is the error message:
Index exceeds matrix dimensions.
Error in CheckerCornerDetection (line 7)
plot(imagePoints(:, 1, 1, 1), imagePoints(:, 2, 1, 1), '*-g');
I have attached a couple of images for your reference. Corner Points were detected in: PointsDetected(a).jpg and PointsDetected(b).jpg while the same function failed to detect checkerboard corner points in PointsNotDetected.jpg and PointsNotDetected(b).jpg.
Please help me figure out why it's not detected, though the image seems alright. What could the possible reasons be?

Accepted Answer

Dima Lisin
Dima Lisin on 19 Nov 2014
Hi Sanya,
I have noticed something strange about your images. There are white gaps between the corners of black squares that are supposed to be touching. I think this is what is confusing the detectCheckerboardPoints function. It is designed to detect "cross corners", where you have two white squares and two black squares touching at a point.
Try calling detectCheckerboardPoints on individual images, and see what you get. I am guessing that it will detect checkerboards of different sizes, because of those gaps. When you call the function on a set of images, and it detects different size boards, it will determine which board size is most common, and only accept the images where it detects a board of that size. That is why so many of your images are rejected.
How did you make the checkerboard? I would recommend printing the checkerboard board from the pdf that comes with the documentation on a good printer.
  7 Comments
Meghana Dinesh
Meghana Dinesh on 27 Nov 2014
In practice, using a combination of IR and visible light, for best results, this is how the checkerboard pattern is seen by camera. Is there any way I can preprocess these checkerboard images and make sure the corners are detected, neglecting the non cross corners? Can you suggest any processing technique?
Dima Lisin
Dima Lisin on 27 Nov 2014
detectCheckerboardPoints is meant to only detect the cross corners... As far as pre-processing, increasing the contrast may help. Generally, you want to be careful not to introduce artifacts, that may affect detection accuracy.

Sign in to comment.

More Answers (1)

Brian
Brian on 22 Jan 2015
Edited: Brian on 22 Jan 2015
I have had this problem too. I have noticed that the "corner gap" problem is actually exaggerated with IR light illumination. From the few data sheets I've looked at, IR light often raises the minimum spatial frequency that can be captured by a CCD array (check the modulation transfer function / optical transfer function), though I'm not sure if this is a related issue. It might be how your camera adjusts for brightness and saturation as well. Even without IR illumination, I would say the detectCheckerboardPoints function works ~15% of the time in my hands (2 different cameras, a logitec C150 webcam and a Canon EOS DSLR), which sounds a lot like your 21/129. I think it might be a weakness of the detectCheckerboardPoints function to depend on the (generally finicky) handful of pixels that make up the intersection points while ignoring the other info available from the checkerboard, but this is necessary when the optical distortion of the image is unknown. However... it would be nice if there were a more robust checkerboard detection function for undistorted (calibrated camera) images!
  5 Comments
Meghana Dinesh
Meghana Dinesh on 27 Jan 2015
Alright. The size of squares printed on my checkerboard will be fixed. I can use a larger value of sigma in this case.
Thanks.
Kukhokuhle Tsengwa
Kukhokuhle Tsengwa on 16 Mar 2022
Jesus! This was the problem I was having. Fixed it by setting the 'HighDistortion' parameter to true in the detectCheckerboardPoints() function.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!