This repository has been archived by the owner. It is now read-only.
Permalink
Cannot retrieve contributors at this time
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?
FreezingAnalysis/Traditional/blobTrackMotionVector.m
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
executable file
63 lines (52 sloc)
1.45 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% | |
% 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(); | |