%
%% Contact% (ISR-2/LANL)
%%% See also
% Ressembles:% ,
% ,% ,
% ,% ,
% ,% .
% Requires: % .
%% Function implementation
function [Smap, varargout] = susancorner(I,varargin)
%% % parsing and checking parameters
error(nargchk(1, 18, nargin, 'struct'));error(nargoutchk(1, 2, nargout, 'struct'));
if ~isnumeric(I)
error('susancorner:inputerror','matrix required in input'); end
p = createParser('SUSANCORNER');
% mandatory parameter% optional parameters
p.addOptional('mode', 'e', @(x)ischar(x) && ... any(strcmpi(x,{'e','ei','c','ci','s'})));
p.addParamValue('thres', 20, @(x)isscalar(x) && x>=0);p.addParamValue('md', 'flat', @(x)(ischar(x) && strcmp(x,flat)) || ...
(isscalar(x) && x>0));p.addParamValue('n', false, @(x)isscalar(x) && (x==true||x==false));
p.addParamValue('q', true, @(x)isscalar(x) && (x==true||x==false));
% parse and validate all input argumentsp.parse(varargin{:});
p = getvarParser(p);
%% % main computation
C = size(I,3);
if strcmpi(p.mode,'c') && nargout==2
[Smap, varargout{1}] = susancorner_base(I, p.mode, p.thres, p.md, p.n, p.q);else
Smap = susancorner_base(I, p.mode, p.thres, p.md, p.n, p.q);end
%%
% display
if p.disp figure,
if any(strcmpi(p.mode,{'e','¨ei','s'})), imagesc(Smap);
else tmp = false(size(I));
for c=1:C, tmp(Smap{c}(:,1) + X*(Smap{c}(:,2)-1) + X*Y*(c-1)) = true;
end imagesc(tmp);
end axis image off;
if C==1, colormap gray; end; title('corners detected with SUSAN');
end
end % end of susancorner
##### SOURCE END #####-->