Skip to content

Instantly share code, notes, and snippets.

@pablospe
Created July 4, 2016 14:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pablospe/1ad5f6139a58a48b6f496c6a6c6b4887 to your computer and use it in GitHub Desktop.
Save pablospe/1ad5f6139a58a48b6f496c6a6c6b4887 to your computer and use it in GitHub Desktop.
detectCheckerboardPoints
close all
clearvars
% detectCheckerboardPoints function was introduced in R2014a
if exist('detectCheckerboardPoints', 'file')
% One image
figure(1)
I = imread( fullfile(matlabroot, 'toolbox', 'vision',...
'visiondata','calibration','webcam','image1.tif') );
imagesc(I);
colormap(gray);
[imagePoints, boardSize] = detectCheckerboardPoints(I);
boardSize
hold on; plot(imagePoints(:,1), imagePoints(:,2),'g+')
% Multiple images
figure(2)
for i = 1:5
imageFileName = sprintf('image%d.tif', i);
imageFileNames{i} = fullfile(matlabroot, 'toolbox', 'vision',...
'visiondata','calibration','webcam',imageFileName);
end
[imagePoints, boardSize, imagesUsed] = detectCheckerboardPoints(imageFileNames);
imageFileNames = imageFileNames(imagesUsed);
for i = 1:numel(imageFileNames)
I = imread(imageFileNames{i});
subplot(2, 2, i);
imshow(I); hold on; plot(imagePoints(:,1,i), imagePoints(:,2,i), 'g+');
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment