detectCheckerboardPoints function is not able to detect the corner points of the board
26 views (last 30 days)
I am using MATLAB R2020b to calibrate a camera for an experiment. I have 2 images my checkerboard at a required angle. i cannot perform the calibration, because detectCheckerboardPoints function is not able to detect the corner points of the board. I used the same board in a different angle, in former setup of the experiment and the function worked fine.
this is the code i use:
f = 'calib2 34stage_hor_4l_roll-29pitch_-260 rail_gain20_64Hz_end_board_2603_mm.tiff';
[imagePoints,boardSize,imagesUsed] = detectCheckerboardPoints(f);
I = imread(f);
M = prod(boardSize-1);
for i = 1:length(imagePoints(:,1))
t = text(imagePoints(i,1),imagePoints(i,2),num2str(i),'FontSize',8);
t.Color = [1 0 0];
title ('checkerboard light on calibration points')
This is the error message:
Index in position 2 exceeds array bounds.
Error in transformation2 (line 12)
I am attaching the image for refference (I am using tiff format, but it cannot be uploae here so JPG is attache). I would appreciate guidance on how to solve this matter
Shraddha Jain on 3 Mar 2021
I understand that you are facing issues while using the detectCheckerboardPoints function. I was able to reproduce the same with the image that you have attached above. You are witnessing this error because the detectCheckerboardPoints function was not able to detect any corners in the given image (since imagePoints array is empty). Note that lighting and image contrast affect the performance of this function. A possible workaround is to modify the MinCornerMetric parameter while using the detectCheckerboardPoints as,
[imagePoints,boardSize,imagesUsed] = detectCheckerboardPoints(f,'MinCornerMetric',0.29);
I checked that with the value of MinCornerMetric set to 0.29, total 40 checker board points were detected.
The key to detecting more number of corner points is to reduce the noise or distortion in the input image to the detectCheckerboardPoints function. I recommend applying some pre-processing to the input image such as imbinarize so that the brightness and contrast of the image improves for corner points detection.
Hope this helps!