Advertisement
Guest User

Untitled

a guest
May 18th, 2017
335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 1.17 KB | None | 0 0
  1. % Define images to process
  2. imageFileNames = {'C:\Users\asavelyev\Pictures\checkerIR.tif',...
  3.     'C:\Users\asavelyev\Pictures\checkerIR.tif',...
  4.     };
  5.  
  6. % Detect checkerboards in images
  7. [imagePoints, boardSize, imagesUsed] = detectCheckerboardPoints(imageFileNames);
  8. imageFileNames = imageFileNames(imagesUsed);
  9.  
  10. % Read the first image to obtain image size
  11. originalImage = imread(imageFileNames{1});
  12. [mrows, ncols, ~] = size(originalImage);
  13.  
  14. % AS: change these worldPoints to points of RGB image...
  15. % Generate world coordinates of the corners of the squares
  16. worldPoints = detectCheckerboardPoints('C:\Users\asavelyev\Pictures\checkerRGB.tif');
  17.  
  18. % Calibrate the camera
  19. [cameraParams, imagesUsed, estimationErrors] = estimateCameraParameters(imagePoints, worldPoints, ...
  20.     'EstimateSkew', false, 'EstimateTangentialDistortion', false, ...
  21.     'NumRadialDistortionCoefficients', 2, 'WorldUnits', 'millimeters', ...
  22.     'InitialIntrinsicMatrix', [], 'InitialRadialDistortion', [], ...
  23.     'ImageSize', [mrows, ncols]);
  24.  
  25. % For example, you can use the calibration data to remove effects of lens distortion.
  26. undistortedImage = undistortImage(originalImage, cameraParams);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement