1 | initial version |
When I did many kinds of attempts under opencv, but still can't resolve it, I tried to get other solution. After I use matlab, I found it done.
I compare the imagepoints from opencv and matlab, they are different, I think they should maybe used different algorithms for checkerboard detection, and different algorithm to optimization(maybe Levenberg-Marquardt non-linear least squares algorithm and gradient descent algorithm).
Attached matlab sample code by Matlab software:
% Define images to process
imageFileNames1 = {'F:\CaptureFiles\left1.bmp',...
};
imageFileNames2 = {'F:\CaptureFiles\right1.bmp',...
};
% Detect checkerboards in images
[imagePoints, boardSize, imagesUsed] = detectCheckerboardPoints(imageFileNames1, imageFileNames2);
% Generate world coordinates of the checkerboard keypoints
squareSize = 50; % in units of 'mm'
worldPoints = generateCheckerboardPoints(boardSize, squareSize);
% Calibrate the camera
[stereoParams, pairsUsed, estimationErrors] = estimateCameraParameters(imagePoints, worldPoints, ...
'EstimateSkew', false, 'EstimateTangentialDistortion', false, ...
'NumRadialDistortionCoefficients', 2, 'WorldUnits', 'mm', ...
'InitialIntrinsicMatrix', [], 'InitialRadialDistortion', []);