Halo!

This will be a short blog post as an introduction in video processing. It’s basically image processing but only with a lot of images showing a continuous physical phenomena.

In this activity, I will try to calculate the acceleration due to gravity through what I’ve learned so far in AP186. The video turned to .gif is shown below:

download.gif

The .gif follow the fps of the camera used. The camera is a Nikon D3300. I treated the video as a succession of images in order to do image processing thecniques. The first thing I did was to segment the tennis ball using the parametric color segmentation in activity 7. which shows this .gif:

download2

After successfully segmenting the image, the centroid can be calculated after using open and close morphological operations. The code below shows the methodology I’ve done.


y = [];
for n=84:103

I = double(imread('C:\Users\apnfo\Documents\AP186\act11\jeb'+string(n) + '.jpg'))
se = CreateStructureElement('vertical_line', 10);
I1 = ErodeImage(I, se);
se = CreateStructureElement('horizontal_line', 10);
I2 = ErodeImage(I1, se);
IsCalculated = CreateFeatureStruct(%f);
IsCalculated.Centroid = %t;
Ic = AnalyzeBlobs(I2, IsCalculated);


y=[y Ic(1).Centroid(2)]
disp(Ic(1).Centroid(2))
end

I only considered the height  pixel values for the calculation of the acceleration due to gravity. Of course the pixel to cm ratio can easily be calculated because the top edge of the frame is our reference point and we marked the 50cm distance. I can now convert the pixel values to distance from the top. The plot of the distance per fram is show below:

plotlpot.JPG

I then calculated the instantaneous acceleration between two position values and averaged out the acceleration. I calculated 900.256 cm/s^2 or 9.00256 m/s^2 with an error of about 8%!!

I think this can still be improved upon by taking multiple experiments.

The video was shot by me, Roland, and Josh. Thanks guys.