Monday, September 29, 2008

Activity 17 - Video Processing

In this activity, video processing was done. First, the video is ripped to create images representing frames in the video. The images obtained were then processed.
The video used in this activity is a rolling object on an inclined plane. The objective of this activity is to obtain the acceleration seen from the video and compare it to theoretical values given some parameters.


(I cannot upload the video because of large file size)..

The images obtained from the video were converted to binary images. The centroid of the rolling cylinder for all the images were obtained and plot the distance from the origin versus the frame. The plot is given below:




Conversion of values from pixel to millimeter and frame to time were performed through known values in the video (for example, the size of the rolling cylinder and the frame rate). Curve fitting was then performed to the plot to obtain a polynomial equation of distance that depends on the constant acceleration and velocity which is given by:
d = 331.69 t^2 + 21.002 t^2
from the equation, the acceleration is given by 331.69x2 = 663.38 mm/sec^2 (which is the acceleration along the x - axis since the video was viewed from the top).
Theoretical calculation of the acceleration given by the equations below revealed that for that same parameter, the acceleration is 592.71 mm/sec^2. Large difference from theoretical and experimental values maybe due to the centroid finding of the object.

For this activity, I would give myself a grade of 8. I would like to acknowledge the help of Abraham Latimer Camba for the theoretical computation of the acceleration.

Appendix:

//15 frames per second
I = [];
se = [1 1;1 1];
for i =1:15
I = imread("vid" + string(i) + ".jpeg");
I1 = im2bw(I,0.7);
I2 = erode(dilate(I1,se),se);
I3 = erode(I2,se);
imwrite(I3,"videos" + string(i)+".jpeg");
[x1,y1] = find(I3==1);
x(i)=mean(x1);
y(i)=mean(y1);
end
distancey = y - min(y);
distancex = x - min(x);
distance = sqrt(distancex^2 + distancey^2);
for i = 1:15
velocity(1) = distancey(1);
velocity(i+1) = distance(i+1) - distancey(i);
end
for i = 1:15
acceleration(1) = 0;
acceleration(i+1) = velocity(i+1) - velocity(i);
end
scf(0);plot(distance);
scf(1);plot(velocity);
scf(2);plot(acceleration);

No comments: