%% Read in Video clip clear all; vidpointer=VideoReader('CIMG6829.AVI'); VidFrames=read(vidpointer); %% VidRed=VidFrames(185:290,160:417,1,:); %% Show some frames % for counter=(1000:1500); im=VidRed(:,:,counter); figure(1) clf(1) imshow(im); shg end %% Create variables for spot location StartFrame=1000; EndFrame=5490; vidlength=EndFrame-StartFrame+1; % DataCounter=zeros(1,vidlength); % pos=zeros(3,vidlength); % maxima=zeros(1,vidlength); %% Gaussian filter DataCounter=1; for counter=StartFrame:EndFrame; %counter is incremented each time a new frame is examined. Therefore it becomes the time variable. h=fspecial('gaussian',5,5); Gauss=filter2(h,VidRed(:,:,counter),'same'); Max=max(Gauss(:)); maxima(counter)=Max; if Max > 100; [pos(2,DataCounter) pos(1,DataCounter) val]=find(Gauss == Max); %pos(1,:) is x (column index) and pos(2,:) is y (row index). pos(3,DataCounter)=(counter-StartFrame)/30; %time in seconds after StartFrame DataCounter=DataCounter+1; %increment DataCounter when a legitimate point is found. %otherwise end 'if' without incrementing DataCounter. end end