Home > polypedal > ProjectiveReconstruction > getTranslation.m

getTranslation

PURPOSE ^

getTranslation use the position of makers from getMarkerPosition function

SYNOPSIS ^

function [translation]=getTranslation(markers)

DESCRIPTION ^

getTranslation use the position of makers from getMarkerPosition function
  Returns the translation between each successive frames
   translation = calGridImage(getMarkerPosition('video.avi'))
 INPUT:
   markers -- collection of marker position from getMarkerPosition
   function
 OUTPUT:
   translation -- translation vectors between successive frames
 $Revision: 1.1 $
 By Peiran Gao, Berkeley 2008

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [translation]=getTranslation(markers)
0002 %getTranslation use the position of makers from getMarkerPosition function
0003 %  Returns the translation between each successive frames
0004 %   translation = calGridImage(getMarkerPosition('video.avi'))
0005 % INPUT:
0006 %   markers -- collection of marker position from getMarkerPosition
0007 %   function
0008 % OUTPUT:
0009 %   translation -- translation vectors between successive frames
0010 % $Revision: 1.1 $
0011 % By Peiran Gao, Berkeley 2008
0012 
0013 translation=zeros(size(markers,1)-1,1);
0014 for i=1:(size(markers,1)-1)
0015     first_frame=repmat(markers{i},1,size(markers{i+1},1));
0016     second_frame=repmat(transpose(markers{i+1}),size(markers{i},1),1);
0017     diff_frame=second_frame-first_frame;
0018     dis=abs(diff_frame);
0019     count=0;
0020     sum=0;
0021     for j=1:size(dis,1)
0022         if min(squeeze(dis(j,:)))<30
0023             sum=sum+diff_frame(dis==min(squeeze(dis(j,:))));
0024             count = count+1;
0025         end
0026     end
0027     translation(i)=sum/count;
0028     %min_dis=ones(size(dis,1));
0029     %for j=1:size(dis,1)
0030         %min_dis(j)=min(squeeze(dis(j,:)));
0031     %end
0032     %[min_dis,min_index]=sort(min_dis);
0033     %index=min_index(1);
0034     %[min_dis,min_index]=sort(squeeze(dis(index,:)));
0035     %translation(i)=diff_frame(index,min_index(1));
0036 end

Generated on Mon 02-Aug-2010 16:44:38 by m2html © 2003