Code to take part of a movie, identify the moving parts, and simulate a multiple exposure image. Useful for teaching kinematics and having students calculate the motion of things from a static image.
- opencv (for the image manipulation)
- ffmpeg (for now, to pull individual frames out of the movie. maybe there's something more general we can use?)
Install opencv and the python module on your system.
This can be...challenging.
Test your system
Read in and display two images using the opencv python library.
"Add" two images.
Mock-up a multiple-exposure image!
To try this out, download the running.mp4 (THIS WILL SOON BE A REAL LINK) example that I ripped from YouTube.
Run the following shell script which uses ffmpeg to pull out some images from the movie.
Then run this shell script which calls a python script,
This should produce something that looks like a multiple exposure image, though a bit pixelated.
Production grade version!
Everything should be able to be run with the following Jupyter-notebook script