Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % Define images to process
- imageFileNames = {'C:\Users\asavelyev\Pictures\checkerIR.tif',...
- 'C:\Users\asavelyev\Pictures\checkerIR.tif',...
- };
- % Detect checkerboards in images
- [imagePoints, boardSize, imagesUsed] = detectCheckerboardPoints(imageFileNames);
- imageFileNames = imageFileNames(imagesUsed);
- % Read the first image to obtain image size
- originalImage = imread(imageFileNames{1});
- [mrows, ncols, ~] = size(originalImage);
- % AS: change these worldPoints to points of RGB image...
- % Generate world coordinates of the corners of the squares
- worldPoints = detectCheckerboardPoints('C:\Users\asavelyev\Pictures\checkerRGB.tif');
- % Calibrate the camera
- [cameraParams, imagesUsed, estimationErrors] = estimateCameraParameters(imagePoints, worldPoints, ...
- 'EstimateSkew', false, 'EstimateTangentialDistortion', false, ...
- 'NumRadialDistortionCoefficients', 2, 'WorldUnits', 'millimeters', ...
- 'InitialIntrinsicMatrix', [], 'InitialRadialDistortion', [], ...
- 'ImageSize', [mrows, ncols]);
- % For example, you can use the calibration data to remove effects of lens distortion.
- undistortedImage = undistortImage(originalImage, cameraParams);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement