A video is a dynamic version of an image. In this activity, we performed image processing techniques to measure physical quantities of a physical phenomenon that happens in a video.
We we're able to perform image processing because of the concept behind a video. A video is a result of successive images being flashed in a specific frame rate. For humans, a frame rate of 30 will give a perception of real-time dynamics.
We studied the behavior of a pendulum swinging underwater and compared it to the same pendulum swinging in air. These dynamics were captured using a camera at a frame rate of 30 fps or $3.33x10^{-2}$ seconds interval for each frame.
Because a video is simply a set of images, we performed parsing of the videos taken using a command-line free software (ffmpeg) into its image components.
The command used in ffmpeg to parse the video is shown below.
ffmpeg -i <video_file.avi> image%d.png
With the resulting set of images, we performed sequence of image processing to calculate the variables describing the motion of the pendulum.
1) We segment the images using parametric segmentation with the region of interest represented by the orange marker.
Segmented Harmonic Oscillation |
Segmented Damped Oscillation |
2) Because the segmentation detected some objects in the background, we performed masking to mask off the unwanted regions which were included in the segmentation.
3) We identified the image coordinate of the vertex of the pendulum and the location of the center of mass of the segmented ROI's so that we could compute using Eq. 1, for the angle of oscillation for each frame.
$\theta = \frac{x^, - x}{l}$ Eq. 1
where $x^, - x$ corresponds to the displacement of the pendulum from the x-axis for each frame and $l$ is the length of the string from the vertex to the ROI.
The computed values of $\theta$ was plotted against time (t) and the sinusoidal curve of the harmonic motion was achieved for the pendulum swinging in air Fig. 1 and the attenuating sinusoidal curve is observed for the oscillation of the pendulum underwater as shown in Fig. 2.
Figure 1: Oscillation curve for the swinging pendulum in air. |
Figure 2: Oscillation curve for the swinging pendulum underwater. |
From these results, we would like to compute for the value of the damping coefficient but for us to pursue with the computation we first verified if indeed we can gather correct physical parameters from our current results by trying to obtain a value of a physical constant which is the acceleration due to gravity.
With the equation for the period of the harmonic oscillation of a pendulum Eq. 2, we can derive the value of $g$.
$T = 2\pi \sqrt{\frac{L}{g}}$
where $T$ is the period of oscillation, $L$ is the length of the pendulum's string and $g$ is the acceleration due to gravity. In our case the value for the period of oscillation is $T = 1.333 s$ and the length of the string is $L = 0.395 m$, thus we can compute for the value of $g$. The computation gives $g = 8.776\frac{m}{s^2}$ having an error of 10.54% from the accepted value of $9.81 \frac{m}{s^2}$. We can now say that indeed we can compute physical variables, thus we will continue to compute the damping coefficient in our system of underwater oscillation.
To be continued...
To be continued...