VidObj = VideoReader('the name of your video');
nFrames = VidObj.NumberOfFrames;
for k = 1 : nFrames
video(:,:,k) = mean(read(VidObj,k),3);
start_number = ?
finis_number = ?
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);
template = window - mean(mean(window));