www.gusucode.com > images 案例代码 matlab源码程序 > images/FindCornersInImagesExample.m

    %% Find Corners in Images
% This example shows how to locate corners with the corner function and
% adjust your results by refining the maximum number of desired corners.
%%
% Create a checkerboard image.

% Copyright 2015 The MathWorks, Inc.

I = checkerboard(40,2,2);
%%
% Find the corners in the image.
C = corner(I);
%% 
% Display the corners when the maximum number of desired corners is the
% default setting of 200.
subplot(1,2,1);
imshow(I);
hold on
plot(C(:,1), C(:,2), '*', 'Color', 'c')
title('Maximum Corners = 200')
hold off
%%
% Display the corners when the maximum number of desired corners is 3.
corners_max_specified = corner(I,3);
subplot(1,2,2);
imshow(I);
hold on
plot(corners_max_specified(:,1), corners_max_specified(:,2), ...
   '*', 'Color', 'm')
title('Maximum Corners = 3')
hold off