% Created by Yuandong Tian, Oct. 5, 2009
% Email: yuandong@andrew.cmu.edu
% water tracking with two different partition on the image. 
% warning: This is not a function so one show specify the variables
% "frames" and "tsel" (in which interval it trackes), before it is invoked.

%% load warps..
load warp.mat;

%% parameters
sigma = 2;
tau = 2;
firstNC = 10;

%% Water tracking, one show specify the variables "frames" and "tsel" (in which interval it trackes)
% tsel = 1:61;
% partition the image into blocks
[m, n, nFrame] = size(frames);
blockx1 = 1:b.w:n; 
blocky1 = 1:b.h:m;

deltapsReals1 = estMeansByReg(frames, blockx1, blocky1, tsel, b, sigma, tau./variances, firstNC);

blockx2 = floor(b.w/2):b.w:n; 
blocky2 = floor(b.h/2):b.h:m;

deltapsReals2 = estMeansByReg(frames, blockx2, blocky2, tsel, b, sigma, tau./variances, firstNC);

% sample save 
% save exp_computed_large.mat deltapsReals1 deltapsReals2 blockx1 blocky1 blockx2 blocky2 tsel;