There is a sample program on importing, modifying, and exporting video files under templates/examples.
Additionally, the files provided as inputs are in Audio Video Interleave (*.avi) format, which is the simplest
format to use with OpenCV. However, to get them to display on the HTML submission, you will have to save them as
/ convert them to either H.264 (*.mp4) or Theora (*.ogg).
If you are having troubles with H.264, try downloading this DLL and placing it in the folder with the binary.
Alternatively, you can install FFMPEG and use it to convert your .avi files to .mp4 using the command below.
ffmpeg -i input.avi -c:a aac -b:a 128k -c:v libx264 -crf 23 output.mp4
Do not waste time on this.
If you are unable to get these formats working within a few minutes, you are free to pick a different format or to let OpenCV pick its default - .avi is common.
CV_FOURCC('H','2','6','4'); // For H.264 CV_FOURCC('T','H','E','O'); // For Theora
Part 1a
Write a program that finds the blue outlines of the maze in the video, and changes their color to either brown (RGB 115:78:60) or green (RGB 0:255:0).
|
|
|
|
// Insert your code here
Part 1b
Write a program that finds Pac-Man (yellow) and changes his color to green (RGB 0:255:0).
|
|
|
|
// Insert your code here
Part 2a
Write a program that counts the remaining Power-Pellets (large blinking circles) and print this number as an overlay over the video in the upper-right corner.
|
|
|
|
// Insert your code here
Part 2b
Write a program that counts the number of lives that Pac-Man has left, represented by the icons in the lower-left corner. Print this count as a number in the same location; do not remove the original icons.
|
|
|
|
// Insert your code here
Part 3a
Write a program that locates Pac-Man in each frame, and overlay his trajectory (path followed) in yellow (his original color).
|
|
|
|
// Insert your code here
Part 3b
Repeat 3a, but this time locate and track all 4 of the ghosts. Color their paths with their original colors (Red, Pink, Light-Blue, and Orange). For this part, you may assume that all 4 ghosts are visible at all times, and will not change color.
|
|
|
|
// Insert your code here
Part 4
Write a program that keeps track of the score displayed in the upper-left corner,
and print it as an overlaid number in the upper-right corner. Use a different font to display
the score.
There are crops of all 10 digits (0-9) available in the "digits" folder under input/part4.
|
|
|
|
// Insert your code here
Extra Credit
Part 5a
Write a program that detects when Pac-Man eats one of the Power-Pellets (large blinking circles). Draw a square around that location to indicate that your program detected the event. The square should disappear after 1 second (30 frames).
|
|
|
|
// Insert your code here
Part 5b
Repeat 5a, but instead detect when Pac-Man successfully eats one of the ghosts
(that is, the ghost is Dark-Blue or White and you get a
bonus for eating it, instead of losing a life or losing the game).
Draw a square around that location to indicate that your program detected the event.
The square should disappear after 1 second (30 frames).
|
|
|
|
// Insert your code here