% compute a basis set

% use first example of 3 gestures on Jim


load /mas/disks/vmftp/pub/MAS626/gesture/jim_coords

fname = '/mas/disks/vmftp/pub/MAS626/gesture/jim_point.1.1.160.120.739.30';
frames = 13:69;
Xpoint = loadcroppedimages(fname,[120 160],frames,30,point(frames,:)/2);

fname = '/mas/disks/vmftp/pub/MAS626/gesture/jim_stop.1.1.160.120.682.30';
frames = 8:60;
Xstop = loadcroppedimages(fname,[120 160],frames,30,stop(frames,:)/2);

fname = '/mas/disks/vmftp/pub/MAS626/gesture/jim_wave.1.1.160.120.732.30';
frames = 1:55;
Xwave = loadcroppedimages(fname,[120 160],frames,30,wave(frames,:)/2);

X = [Xpoint Xstop Xwave];

[U, Xmean, D] = klt(X);

% then compute the features for all images


% Christ.  This is the dumbest code ever.


load /mas/disks/vmftp/pub/MAS626/gesture/jim_coords

fname = '/mas/disks/vmftp/pub/MAS626/gesture/jim_point.1.1.160.120.739.30';
frames = 1:739;
Xpoint = loadcroppedimages(fname,[120 160],frames,30,point/2);
C = eigcode(Xpoint,Xmean,U,1:20)';
i = point(:,1) > 10;
label = cumsum([diff(i) == 1; 0]);
X = [label point/2 C];
X = X(find(i == 1),:);
save s1.point X -ascii 


fname = '/mas/disks/vmftp/pub/MAS626/gesture/jim_stop.1.1.160.120.682.30';
frames = 1:682;
Xstop = loadcroppedimages(fname,[120 160],frames,30,stop/2);
C = eigcode(Xstop,Xmean,U,1:20)';
i = stop(:,1) > 10;
label = cumsum([diff(i) == 1; 0]);
X = [label stop/2 C];
X = X(find(i == 1),:);
save s1.stop X -ascii 


fname = '/mas/disks/vmftp/pub/MAS626/gesture/jim_wave.1.1.160.120.732.30';
frames = 1:732;
Xwave = loadcroppedimages(fname,[120 160],frames,30,wave/2);
C = eigcode(Xwave,Xmean,U,1:20)';
i = wave(:,1) > 10;
label = cumsum([diff(i) == 1; 0]);
X = [label wave/2 C];
X = X(find(i == 1),:);
save s1.wave X -ascii 





load /mas/disks/vmftp/pub/MAS626/gesture/andy_coords

fname = '/mas/disks/vmftp/pub/MAS626/gesture/andy_point.1.1.160.120.635.30';
frames = 1:635;
Xpoint = loadcroppedimages(fname,[120 160],frames,30,point/2);
C = eigcode(Xpoint,Xmean,U,1:20)';
i = point(:,1) > 10;
label = cumsum([diff(i) == 1; 0]);
X = [label point/2 C];
X = X(find(i == 1),:);
save s2.point X -ascii 


fname = '/mas/disks/vmftp/pub/MAS626/gesture/andy_stop.1.1.160.120.824.30';
frames = 1:824;
Xstop = loadcroppedimages(fname,[120 160],frames,30,stop/2);
C = eigcode(Xstop,Xmean,U,1:20)';
i = stop(:,1) > 10;
label = cumsum([diff(i) == 1; 0]);
X = [label stop/2 C];
X = X(find(i == 1),:);
save s2.stop X -ascii 


fname = '/mas/disks/vmftp/pub/MAS626/gesture/andy_wave.1.1.160.120.745.30';
frames = 1:745;
Xwave = loadcroppedimages(fname,[120 160],frames,30,wave/2);
C = eigcode(Xwave,Xmean,U,1:20)';
i = wave(:,1) > 10;
label = cumsum([diff(i) == 1; 0]);
X = [label wave/2 C];
X = X(find(i == 1),:);
save s2.wave X -ascii 


