Wednesday, September 10, 2008
Activity 17: Basic Video Processing
Let's move on to something more exciting! Images are good. They tell stories in their own way. But when images are connected together in a stream we have one of the best things mankind has produced: video.

Other than its conventional use in entertainment videos are also valuable scientific tools. Here is an application of video processing: tracking of an object moving in a random motion.

The setup is shown below:

As you can see, there is a ball being suspended by a stream of air coming from a pump. The movement of the ball is random, our goal is to track the ball's movements and plot the phase space of its movement in the y-axis since it shows an interesting motion of reaching an equilibrium point. The camera was calibrated so that the camera units would become metric (cm). A sample of the video is shown below:

The code for tracking combines the tools we learned before. Tools like morphology, image stacking, etc. The code is shown below:

clear a;
chdir('G:\poy\poy backup\physics\186\paper 17\images');

se1=ones(3,3); //Square structuring element

im = imread('olympliit10.JPG');

pref = 'olympliit';
area=[];
counter=1;

a=10;
b=100;

//Conversion constants
c=11.403-5.701+11.339667;
d=34.395-17.197-2.9896667;

for i=a:b;
im=imread(strcat([pref,string(i),'.JPG']));
im=im2gray(im);
im = im2bw(im,210/255);
er1=erode(im, se1);
op1=dilate(er1,se1); //open
di1=dilate(op1,se1);
blob=erode(di1,se1); //close
[x,y]=find(blob==1);

//Tracking of center
centerx(i) = (max(x)+min(x))/2;
//centerx(i) = centerx(i)-centerx(a);
centerx(i) = (((centerx(i))/12)*(-1))+c; //From camera units to cm

centery(i) = (max(y)+min(y))/2;
//centery(i) = (max(y)+min(y))/2 - centery(a);
centery(i) = (((centery(i))/12)*(-1))+d;

//Phase space
dcenterx(i) = centerx(i)-centerx(i-1);
dcentery(i) = centery(i)-centery(i-1);
end

plot(centerx(12:99),centery(12:99)); //Plots the tracking
plot(centery(12:99),dcentery(12:99)); //Plots the phase space
The results are shown below:

As you can see, the motion is random. From the origin, the ball zooms into different locations following no specific path. but the interesting thing to note is the fact that in the height axis, the ball experiences damping motion wherein it reaches an "equilibrium space" or a space wherein it seems to be trapped and the forces acting upon the ball can be deduced to have similar magnitudes yet opposing directions. This phenomenon may be appreciated more by looking at the phase diagram:

From the phase diagram, it can be conclusively shown that damping occurs.

I performed this experiment on my own! Yey! I give myself 10 neutrinos!
posted by poy @ 8:16 PM  
0 Comments:
Post a Comment
<< Home
 
 
About Me

Name: poy
Home: Quezon City, NCR, Philippines
About Me:
See my complete profile
Previous Post
Archives
Template by
Blogger templates