%
% [MN02] M. Middendorf and H.-H. Nagel: "Empirically convergent adaptive % estimation of grayvalue structure tensors", Proc. of DAGM, LNCS 2449,
% pp. 66-74, 2002.%
%% [SLS01] A.F. Sole, A. Lopez and G. Sapiro: "Crease enhancement diffusion",
% Computer Vision and Image Understanding, 84(2):241-248, 2001. %
%%% Credit
% (ISR-2/LANL)%
%% See also% Ressembles:
% ,% ,
% ,% ,
% .% Requires:
% .
%% Function implementationfunction [F, S, T] = tensanifilt(I,varargin)
%%
% parsing parameterserror(nargchk(1, 32, nargin, 'struct'));
error(nargoutchk(1, 3, nargout, 'struct'));
% mandatory parameterif ~isnumeric(I)
error('tensanifilt:inputerror','a matrix is required in input'); end
% optional parameters
p = createParser('TENSANIFILT'); % create an instance of the inputParser class.p.addOptional('method', 'mid', @(x)ischar(x) && ...
any(strcmpi(x,{'gst','gstort','wei','weickert','kim','kimmel','sol','sole',... 'mid','middendorf','tsc','tschumperle'})));
p.addOptional('rho', 1, @(x)isscalar(x) && isfloat(x) && x>=0);p.addOptional('sigma', 1, @(x)isscalar(x) && isfloat(x) && x>=0);
% p.addParamValue('scales',0.5:0.1:4, @(x)nb_dims(x)==1 && length(x)>=2); % additional optional parameters
p.addParamValue('der', 'fast', @(x)islogical(x) || (ischar(x) && ... any(strcmpi(x,{'matlab','vista','fast','conv','fleck', ...
'tap5','tap7','sob','opt','ana'}))));p.addParamValue('int', 'fast', @(x)islogical(x) || (ischar(x) && ...
any(strcmpi(x,{'matlab','conv','fast','ani'}))));p.addParamValue('samp', 1, @(x)isscalar(x) && round(x)==x && x>=1 && x<=5);
% parameters for method [Weick97] and [KMS00]p.addParamValue('a', 0.5, @(x)isscalar(x) && x>0 && x<1);
p.addParamValue('c', 1, @(x)isscalar(x) && x>0);% parameters for method [SLS]
p.addParamValue('alpha', 1, @(x)isscalar(x) && x>=0);p.addParamValue('beta', 1, @(x)isscalar(x) && x>=0);
p.addParamValue('eps', 0.5, @(x)isscalar(x) && x>0 && x<1);% parameter for method [Tschumperle]
p.addParamValue('p1', 1, @(x)isscalar(x) && x>=0);p.addParamValue('p2', 2, @(x)isscalar(x) && x>=0);
% parse and validate all input arguments
p.parse(varargin{:}); p = getvarParser(p);
%%
% main computation
[F, S, T] = tensanifilt_base(I, p.method, p.rho, p.sigma, p.der, p.int, ... p.samp, p.a, p.c, p.alpha, p.beta, p.eps, p.p1, p.p2);
%%
% display
if p.disp % Display the tensor fields. The color is proportional to the size of the
% tensor. U = perform_tensor_mapping(T,+1);
U(:,:,1) = perform_histogram_equalization(U(:,:,1), 'linear'); T1 = perform_tensor_mapping(U,-1);
options.sub = 5; plot_tensor_field(T1, I, options); figure, imagesc(rescale(F)), axis image off, title('anisotropic filtering');
if size(F,3)==1, colormap gray; end end
end % end of tensanifilt
##### SOURCE END #####
-->