Activity 11: Basic Video Processing

đź•‘14:08, 15 Oct 2019

Experimental phase

For this activity [1], I paired up with Rene Principe and we decided to perform a simple experiment to obtain the acceleration due to gravity. We used a Nikon D3400 with a SIGMA 24-70mm lens. We set it to ISO 200, f/2.8, recording at 1080p60 at 50mm to minimize any vignetting or lens distortion. We placed the camera on a tripod at a fixed distance away from a uniformly-lit wall and dropped a bright pink ball from rest such that its centroid was roughly aligned with the upper edge of the frame, and was allowed to freely fall. The bottom edge of the frame was aligned with the corner of the wall. The room was closed and there was no airconditioning, so we can assume that there are no significant forces pushing it away from its plane of fall. Using a caliper, the ball was determined to have a diameter of 6.5 cm.

Computational phase

Preprocessing

The raw video files were first trimmed in Adobe Premiere Pro such that the clip starts at the moment the ball is dropped and ends either when the ball stops bouncing or goes out of the frame. The video was then rotated into portrait mode such that the ground direction is downwards. Finally, it was exported as MP4. The original, unsegmented video is shown below:

Segmentation and morphological cleaning

Using Python, I first read an arbitrary frame such that the entire ball can be seen in the frame. Using my code for a previous activity on non-parametric segmentation, I selected the ROI such that it encompassed a rectangular portion of the ball, taking care not to include the background. After obtaining the ROI and its histogram, non-parametric segmentation can automatically detect the ball for all succeeding frames. Next, I applied Otsu’s method to binarize the frames, followed by an elliptical closing operator of size 11 11. I then used the regionprops function from the skimage library to obtain the segmented ball’s properties per frame, in particular the centroid and diameter properties. The result of these operations is shown in Fig. 1.

frame 1
(a) frame 1
frame 10
(b) frame 10
frame 19
(c) frame 19
frame 23
(d) frame 23
frame 29
(e) frame 29

Figure 1: Representative frames as a result of successful segmentation and morphological cleaning. Notice in the middle frames that the ball appears to be squashed. This is due to the motion blur along the vertical, and in this case, the color of the ball starts to “blend” with the background. During this phenomenon, we measure the diameter horizontally, since there is no motion blur along this dimension.

Calibration

The diameter of the ball was averaged for the first 30 frames (just before it bounces for the first time), and using the actual diameter obtained earlier, its pixel-to-length calibration is as follows:

Thus, the position of the ball in real units at any time can be obtained, and its velocity and acceleration can be computed using central difference algorithm. Its motion curves are shown in Fig. 2.

motion calibration

Figure 2: Position, velocity & acceleration curves of the free-falling ball.

Obtaining

Calculating the acceleration due to gravity can be done in two ways. First, we can isolate the position curve up to the point when it first bounces (first 30 frames), and fit this curve to an equation of the form

via nonlinear least-squares fitting. Using this method, we obtain a value of , which deviates by 1.31% from the theoretical. For reference, the theoretical value is m/s2.

Another way this can be done is by taking again the first 30 frames and averaging their acceleration values which we obtained earlier. This method yields , which deviates by 2.04% from the theoretical.

References

  1. M. N. Soriano, A11 - Basic video processing (2019).

Keywords

image processing
video processing
computer vision
gravitational acceleration
kinematic motion