Created
July 4, 2016 14:54
-
-
Save pablospe/1ad5f6139a58a48b6f496c6a6c6b4887 to your computer and use it in GitHub Desktop.
detectCheckerboardPoints
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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