Help writing a tracking code for 1 hour of data at a time

1 view (last 30 days)
Hello,
I am very new to Matlab and am writing a code to analyse some data I have filmed. The code is to track two (relatively large) particles within an area for an hour at a time. I have created a code that states the region of interest, and finds the centre of mass for a single frame of film:
obj=VideoReader('shortvideoM.mov') originalImage= read(obj,1); colormap('gray'),imagesc(originalImage); greyImage=rgb2gray(originalImage); colormap('gray'),imagesc(greyImage); invertImage=255-greyImage; colormap('gray'),imagesc(invertImage); m= invertImage(128.5:302.5,35.5:603.5); colormap('gray'),imagesc(m); blackImage=bpass(m,1,5,5); figure;colormap('gray'),image(blackImage); max= max(max(blackImage)); display(max); pk = pkfnd(blackImage,35,5); cnt = cntrd(blackImage,pk,5); whos cnt figure; hist(mod(cnt(:,1),1),20);
I know that I need to loop the data and then get an array into which to put the coordinates and time, I was just wondering what the general commands are best for this.
Thanks if anyone can help me out, I'm not sure how difficult it is (well very for me).
-Kate

Answers (1)

Babak
Babak on 2 Aug 2012
you may want to use these commands:
save data.mat
and later say
load data.mat
you can put them in a for loop for example

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!