校准单目或双目摄像机函数-estimateCameraParameters
可直接用函数计算相机的内参和外参,而不用MATLAB中的APP工具里面的Camera Calibrator标定,很方便快捷,所以记录一下。
imgcount = 9;%ҪͼƬ squareSize = 15; imageFileNames = {1,imgcount}; for i = 1:imgcount imageFileNames{i} = sprintf('Image_%d.bmp', i); end [imagePoints,boardSize,imagesUsed] = detectCheckerboardPoints(imageFileNames); m=permute(imagePoints,[2 1 3]); worldPoints= generateCheckerboardPoints(boardSize,squareSize); I = imread(imageFileNames{1}); imageSize = [size(I,1),size(I,2)]; cameraParams = estimateCameraParameters(imagePoints,worldPoints, ... 'ImageSize',imageSize); k = cameraParams.RadialDistortion; A = (cameraParams.IntrinsicMatrix)' showReprojectionErrors(cameraParams);
参考链接:
校准单个或立体相机 - MATLAB 估计相机参数 - 中国数学工程 (mathworks.cn)
https://gitee.com/liujin123time/zhang-s-calibration/tree/master/