Hi, I have done something like this before. I'll try to help you.
VidObj = VideoReader('the name of your video');
nFrames = VidObj.NumberOfFrames;
for k = 1 : nFrames
video(:,:,k) = mean(read(VidObj,k),3);
end
start_number = ? %set the first frame
finis_number = ? %set the last frame
v2=video(:,:,start_number:finis_number); %the frames of interest (the part of the video that you want to study)
frame_1st= double(v2(:,:,1)); look at the first frame of interest as an image
figure; hold off;
imagesc(frame_1st); colormap gray; axis image
[xp,yp] = ginput(1); & use ginput to shoot at a location of the first frame that has a unique feature, this location will be for cross-correlation of the next frames
hold on; plot(xp,yp,'ro');
xp = round(xp);
yp = round(yp);
window=(v2(yp-6:yp+6,xp-6:xp+6,1)); %create a window around the point that you chose with ginput and form a new small image. This small image is a part of first image
template = window - mean(mean(window));
I'm sure you can start with this. Next you should create another template for the next frame and all other frames. Use a for loop to make it easier since I assume the number of frames will be high.