Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
876db5d0ce
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
executable file 63 lines (52 sloc) 1.45 KB
%
% Computes the absolute value normals of the movements.
%
% FLAGS
%
% 'compareWith' establishes a comparison with a frame coming
% 'compareWith'- after the one being analyzed.
%
% 'maximumDistance' : boolean
% Assigns to each time frame the maximum distance
% of drive away attained in the frame interval
% of compareWith frames after the one considered.
%
%
% SYNTAX
%
% nv = blobTrackMotionVector(centers,'compareWith',30);
function [nv,o] = blobTrackMotionVector(centers,varargin)
nv = [];
o = mbparse.output();
p = inputParser();
p.addParamValue('compareWith',1);
p.addParamValue('median',false);
p.addParamValue('maximumDistance',false);
p.parse(varargin{:});
q = p.Results();
N = size(centers,1);
for i=1:N-q.compareWith
c1 = centers(i,:);
c2 = centers(i+q.compareWith,:);
nv(i) = norm(c1-c2);
if q.maximumDistance
bagOfDistances = [];
for k=i:i+q.compareWith
kc1 = centers(i,:);
kc2 = centers(k,:);
thisNorm = norm(kc1-kc2);
bagOfDistances(end+1) = thisNorm;
end
nv(i) = max(bagOfDistances(:));
end
if q.median
bagOfNorms = [];
for k=i:i+q.compareWith
kc1 = centers(k,:);
kc2 = centers(k,:);
thisNorm = 7;
end
nv(i) = median(bagOfNorms(:));
end
end
o = mbparse.output();