A video is just a series of image frames shown in succession. Thus, processing a video is just processing all the image frames one by one. In this activity, we use image processing of the image frames to get the acceleration of a tennis ball rolling over a slide.
We used a tennis ball and a 7ft (2.13 m) long wooden seat for the setup. The seat is angled at 4.86 degrees (measured using ImageJ) to serve as a ramp for the ball to slide. In taking the video of the tennis ball sliding, there are some things that must be met to ease the processing. One is that the color of the ball (or object) must be different to its background. With this, color segmentation can be used easily to track the ball’s motion. Also, the camera must be fixed and parallel to plane of motion to establish an origin that is similar to all frames. Below shows the captured video.
I used parametric color segmentation (check previous blog)to track the ball. This is sufficient since the ball is single colored. However, unequal light coming from other sources make the segmentation of the ball incomplete. This can be observed more by zooming in to the tennis ball. Below shows that the tennis ball has both light and dark parts. The region of interest used is shown on the right and may not represent the whole tennis ball. Using the ROI was quite successful in making a blob on the position of the ball.
We remove some artifacts like small lone pixels by using the opening operation of a disk of radius 3 pixels. After removing the artifacts, we try to fill the blob of the ball with a closing operation of a disk of radius 4. Below shows the result after segmentation.
Notice that the shape of the ball was not preserved. However, this does not keep us from knowing the position of the ball at anytime. To get the horizontal center of the ball, we sum over all column positions of the pixels and divide it by the number of pixels. That is,
center = sum(column position of pixels)/ (total number of pixels)
Below shows the central position of the ball at anytime in the video.
Kinematics of a sliding tennis ball
We wish to find the acceleration of the tennis ball as it goes down the slide given the data of its position in column pixels. Each frame of the video has a size of 834 x 114. Knowing that the wooden ramp is 2.13 m, we can assume that the horizontal component of the ramp corresponds to the whole length of the image frame. That is,
2.13*cos(4.86 degrees) = 834 pixels
2.12 meters = 834 pixels
conversion factor = 0.002545 meters/pixel
After getting the position, divide it again by cos(4.86 degrees) to get its position as it slide across the ramp. For the time data, we can get its physical units (seconds) by knowing the total length of the video and its frame rate. The video is 5secs in length and has a frame rate of 25 frames/sec. From this, we can get its conversion factor as
conversion factor = 0.04 seconds/frame
Note that the first frame is already 0.04 seconds. Below shows the plot for the position versus time graph of the tennis ball along the plane of the ramp.
As we can see, we get a smooth parabolic curve indicating a motion with a negative acceleration. From this, we can compute its derivative, hence its velocity. Below shows the plot for velocity versus time. The blue graph corresponds to the data while the red line is its best fit line. The best fit line has a slope of -0.235 m/s^2 and is the actual acceleration of the ball. The green line is the plot for the velocity versus time of an ideal point mass (without friction and rotational motion) sliding along the ramp. This ideal point mass would have an acceleration of -0.831 m/s^2.
This is essentially the beauty of image and video processing! Getting valuable information just tracking objects in videos.