Fo your output filed to display in the HTML template, you will have to save/ convert them to H.264 (*.mp4).
If you are having troubles with H.264, try downloading this DLL and placing it in the folder with the binary (I believe you need version 2.6).
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.
VideoWriter::fourcc('H','2','6','4')// For H.264
Background Material
https://en.wikipedia.org/wiki/Circle_Hough_Transform
https://www.mathworks.com/help/images/detect-and-measure-circular-objects-in-an-image.html
https://docs.opencv.org/4.11.0/d4/d70/tutorial_hough_circle.html
This homework is based on the game Ludo. You can play it here: https://www.coolmathgames.com/0-ludo.
Part 1a
Write a Matlab program to find all Ludo pieces (small colored disks) in the provided static images and draw black circles around them. Save each result in a separate image file.
|
|
|
|
|
|
Note: change the file name to link your code
Part 1b
Do the same, but now use OpenCV.
|
|
|
|
|
|
Note: change the file name to link your code
Part 2a
Write a Matlab program to detect the numbers on the faces of the rolled dice. Then overlay the image with text/number above each dice, e.g., 5 and 3.
|
|
|
|
|
|
Note: change the file name to link your code
Part 2b
Repeat the task from a), but now use OpenCV.
|
|
|
|
|
|
Note: change the file name to link your code
Part 3a
Write a program that detects all green pieces in the original video and changes their color from green to brown before writing the result to the output video file. For this and all subsequent problems use either Matlab or OpenCV.
First input video.
|
|
Second input video.
|
|
Note: change the file name to link your code
Part 3b
Write a program that detects when the number “2” or “3” shows up on any piece in the video and then inverts the color of the number (white to black or vice-versa) before writing the result to the output video file.
First input video.
|
|
Second input video.
|
|
Note: change the file name to link your code
Part 4a
This is similar to part 1 but now you have to do it for each frame in a video. In addition, you must color the circles for the detected red, green, blue, and yellow pieces in four different colors. This is a helper step for the next sub-problem where you have to count them.
First input video.
|
|
Second input video.
|
|
Third input video.
|
|
Note: change the file name to link your code
Part 4b
Write a program that uses shape and color detection to count how many pieces are still left at the home base for each player. Overlay the output video with four numbers, one over each home base, that shows how many pieces are still left in that base.
First input video.
|
|
Second input video.
|
|
Third input video.
|
|
Note: change the file name to link your code
Part 5a
Write a program that detects all movement in the input video and outputs the motion history as a new video. That is, the output video must contain only the pixels that moved in the last t frames and their color must reflect how recent was their movement (bright white most recent; dark gray most distant).
First input video.
|
|
Second input video.
|
|
Third input video.
|
|
Note: change the file name to link your code
Part 5b
Write a program that tracks which pieces moved after the dice were rolled and overlays the output video with their trajectories. That is, plot a curve that tracks the center of each piece as it moves on the screen.
First input video.
|
|
Second input video.
|
|
Third input video.
|
|
Note: change the file name to link your code
Extra Credit 1
Use your favorite screen capture program to record two video clips (not longer than 30 seconds each) of you playing your favorite video game. Then write a program that uses color and movement detection on these videos to find and track something in these videos. The specific task is up to you but you must specify it in text format as part of your submission. Save the results as two separate video files. The output videos must have some modification from the input videos.
First input video.
|
|
Second input video.
|
|
Note: change the file name to link your code