Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 59ddc528 authored by DIB Elian's avatar DIB Elian
Browse files

WIP

parent 1bbfb9a4
No related tags found
Loading
......@@ -6,16 +6,20 @@ offset = 1e-2;
Labels = ones(size(X));
p = inputParser();
p.addOptional('Labels', Labels, @isnumeric);
p.parse(varargin{1});
Labels = p.Results.Labels;
if nargin>4
p.addOptional('Labels', Labels, @isnumeric);
p.parse(varargin{1});
Labels = p.Results.Labels;
end
labs = 1:max(double(Labels(:)));
p.addOptional('labs', labs, @isnumeric);
p.parse(varargin{:});
labs = p.Results.labs;
if nargin>5
p.addOptional('labs', labs, @isnumeric);
p.parse(varargin{1:2});
labs = p.Results.labs;
end
sz = size(Xq);
......@@ -35,7 +39,7 @@ for order_it = order
dx = dX(order_it);
dy = dY(order_it);
[t,I] = utils.triangulation(X+dx,Y+dy,Labels,labs);
[t,I] = utils.triangulation(X+dx,Y+dy,varargin{:});
for lab = 1:numLabs
if isempty(t{lab}); continue; end
......
......@@ -4,18 +4,28 @@ function varargout = triangulation(X,Y,varargin)
sz = size(X);
Labels = ones(sz);
Z = ones(sz);
thresh = inf;
p = inputParser();
p.addOptional('Labels', Labels, @isnumeric);
p.parse(varargin{1});
Labels = p.Results.Labels;
if nargin>3
p.addOptional('Labels', Labels, @isnumeric);
p.parse(varargin{1});
Labels = p.Results.Labels;
end
labs = 1:max(double(Labels(:)));
p.addOptional('labs', labs, @isnumeric);
p.parse(varargin{:});
labs = p.Results.labs;
if nargin>4
p.addOptional('labs' , labs , @isnumeric);
p.addOptional('Z' , Z , @isnumeric);
p.addOptional('thresh', thresh, @isnumeric);
p.parse(varargin{:});
labs = p.Results.labs;
Z = p.Results.Z;
thresh = p.Results.thresh;
end
labs = labs(1:min(numel(labs),nargout));
......@@ -24,7 +34,13 @@ TX = reshape( (X_(:)+[0,1,0,1,0,1])' ,3,[])';
TY = reshape( (Y_(:)+[0,0,1,1,1,0])' ,3,[])';
T = sub2ind(sz,TX,TY);
L = Labels(T);
Z = Z(T(:,[1,2,3,1]));
Z = max(abs(diff(Z,1,2)),[],2);
Z = Z<thresh;
L = mode(L,2);
varargout = cell(1,2);
......@@ -34,8 +50,8 @@ varargout(:) = deal({cell(1,nargout)});
wptsnotref = warning('query','MATLAB:triangulation:PtsNotInTriWarnId');
warning('off','MATLAB:triangulation:PtsNotInTriWarnId');
for it = 1:nargout
I = L==labs(it);
for it = 1:numel(labs)
I = L==labs(it) & Z;
if any(I(:))
varargout{1}{it} = triangulation(T(I,:),X(:),Y(:));
varargout{2}{it} = find(I);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment