# HCI/CprE/ComS 575: Homework #3

Your Name
< Your Email>

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 1.8).
Alternatively, you can install FFMPEG and use it to convert your .avi files to .mp4 using the command below.

FFMPEG Command

####

    ffmpeg -i input.m4v -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.
FOURCC codes

####

    VideoWriter::fourcc('H','2','6','4')// For H.264

## Part 1a

Write a Matlab program to find all backgammon pieces in the provided static images and draw circles around them. Save each result in a separate image file.

Source

Note: change the file name to link your code

## Part 1b

Do the same, but now use OpenCV.

Source

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.

Source

Note: change the file name to link your code

## Part 2b

Repeat the task from a), but now use OpenCV.

Source

Note: change the file name to link your code

## Part 3a

Write a program that detects all red pieces in the original video and changes their color from red to blue before writing the result to the output video file.

First input video.

Your browser does not support HTML5 video.
Your browser does not support HTML5 video.

Second input video.

Your browser does not support HTML5 video.
Your browser does not support HTML5 video.

Source

Note: change the file name to link your code

## Part 3b

Write a program that detects when the text “Roll Dice” shows up in the video and then changes the color of the letters from white to red before writing the result to the output video file.

First input video.

Your browser does not support HTML5 video.
Your browser does not support HTML5 video.

Second input video.

Your browser does not support HTML5 video.
Your browser does not support HTML5 video.

Source

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 and the white pieces in two different colors. This is a helper step for the next sub-problem where you have to count them.

First input video.

Your browser does not support HTML5 video.
Your browser does not support HTML5 video.

Second input video.

Your browser does not support HTML5 video.
Your browser does not support HTML5 video.

Third input video.

Your browser does not support HTML5 video.
Your browser does not support HTML5 video.

Source

Note: change the file name to link your code

## Part 4b

Find and mark all red and white pieces. Also, for each of the 24 triangles count how many pieces are placed at that location and overlay the output videos with the corresponding count and color. For example, 5r, 0, 0, 2w, 0, etc. The code must also handle the special case when pieces are placed in the middle of the board. The numbers must be updated for each frame.

First input video.

Your browser does not support HTML5 video.
Your browser does not support HTML5 video.

Second input video.

Your browser does not support HTML5 video.
Your browser does not support HTML5 video.

Third input video.

Your browser does not support HTML5 video.
Your browser does not support HTML5 video.

Source

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.

Your browser does not support HTML5 video.
Your browser does not support HTML5 video.

Second input video.

Your browser does not support HTML5 video.
Your browser does not support HTML5 video.

Third input video.

Your browser does not support HTML5 video.
Your browser does not support HTML5 video.

Source

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 line that tracks the center of each piece as it moves on the screen.

First input video.

Your browser does not support HTML5 video.
Your browser does not support HTML5 video.

Second input video.

Your browser does not support HTML5 video.
Your browser does not support HTML5 video.

Third input video.

Your browser does not support HTML5 video.
Your browser does not support HTML5 video.

Source

Note: change the file name to link your code

## Extra Credit 1

Use your favorite screen capture program to record two short video clips of you playing the online checkers game on this web site ( https://www.247checkers.com/ ). Then write a program that changes the color of all red pieces from red to blue, but only when they are moving. Save the results as two separate video files.

First input video.

Your browser does not support HTML5 video.
Your browser does not support HTML5 video.

Second input video.

Your browser does not support HTML5 video.
Your browser does not support HTML5 video.

Source

Note: change the file name to link your code