1. YouTube is littered with fake videos of
purportedly amazing basketball shots. In this assignment, you will write some
code to analyze the trajectory of ballistic or projectile motion in a video to
determine if it is real or not. Ballistic motion occurs when the only
significant force on an object is gravity (e.g., a basketball free-throw).
2. I have extracted for you 25 evenly
spaced frames.zip from this video as well as the coordinates.csv of the ball on each of these frames. The
frames are stored as standard PNG images and the coordinates are stored as a
CSV file in which each row corresponds to the x- and y-coordinates. Download
this data.
3. Load the CSV file into a 25 x 2 numpy matrix.
4. Load and display each of the 25 frames into a
figure with 5 x 5 subplots. Overlay onto each figure, the corresponding
coordinate to make sure that your loaded coordinates correspond to the position
of the ball. Your code should generate a figure that looks something
like framesCoordinates.png.
5. Fit a parabola y = ax^2 + bx + c to the coordinates using least-squares estimation (do not
use any libraries or pre-packaged code, you must build the linear system and
solve directly for the least-squares estimate of the parameters a,b,c).
6. To help you visually assess how well the parabola
fits the underlying data, plot the least-squares curve overlaid atop the 25
selected points. Because our sampling of the coordinates is pretty sparse,
you'll want to plot this curve with a denser sampling of x- and y- coordinates.
Remember that the origin in most plots is in the bottom left corner, whereas it
is in the upper left corner for images. As such, make sure to reverse the
vertical axis in your plot so that the origin is in top left corner. Your code
should generate a figure that looks something like parabolaFit.png
7. It is always good to verify your solutions by
going back to the original data, in our case, the video frames. Write some code
to display each video frame. Overlay on each frame the user-selected position
of the ball and the full parabolic trajectory to make sure that the ball in
each frame follows the expected ballistic trajectory. Your code should generate
an animation that looks something like parabolaFrames.mov
Get Free Quote!
428 Experts Online