Matlab单目标定工具箱代码实现使用过程

% Auto-generated by cameraCalibrator app on 11-Nov-2021
%-------------------------------------------------------

% Define images to process
imageFileNames = {'C:\Users\YuanQuan\Desktop\1\IMG_0915.JPG',...
    'C:\Users\YuanQuan\Desktop\1\IMG_0916.JPG',...
    'C:\Users\YuanQuan\Desktop\1\IMG_0917.JPG',...
    'C:\Users\YuanQuan\Desktop\1\IMG_0918.JPG',...
    'C:\Users\YuanQuan\Desktop\1\IMG_0919.JPG',...
    'C:\Users\YuanQuan\Desktop\1\IMG_0920.JPG',...
    'C:\Users\YuanQuan\Desktop\1\IMG_0921.JPG',...
    'C:\Users\YuanQuan\Desktop\1\IMG_0922.JPG',...
    'C:\Users\YuanQuan\Desktop\1\IMG_0923.JPG',...
    'C:\Users\YuanQuan\Desktop\1\IMG_0924.JPG',...
    };
% Detect checkerboards in images
[imagePoints, boardSize, imagesUsed] = detectCheckerboardPoints(imageFileNames);
imageFileNames = imageFileNames(imagesUsed);

% Generate world coordinates of the corners of the squares
squareSize = 25;  % in units of 'mm'
worldPoints = generateCheckerboardPoints(boardSize, squareSize);

% Calibrate the camera
[cameraParams, imagesUsed, estimationErrors] = estimateCameraParameters(imagePoints, worldPoints, ...
    'EstimateSkew', true, 'EstimateTangentialDistortion', true, ...
    'NumRadialDistortionCoefficients', 3, 'WorldUnits', 'mm', ...
    'InitialIntrinsicMatrix', [], 'InitialRadialDistortion', []);

% View reprojection errors
h1=figure; showReprojectionErrors(cameraParams, 'BarGraph');

% Visualize pattern locations
h2=figure; showExtrinsics(cameraParams, 'CameraCentric');

% Display parameter estimation errors
displayErrors(estimationErrors, cameraParams);
% For example, you can use the calibration data to remove effects of lens distortion.
originalImage = imread(imageFileNames{1});
undistortedImage = undistortImage(originalImage, cameraParams);

% See additional examples of how to use the calibration data.  At the prompt type:
% showdemo('MeasuringPlanarObjectsExample')
% showdemo('StructureFromMotionExample')
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值