# 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.
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

####

    CV_FOURCC('H','2','6','4'); // For H.264

## Part 1a

Write a program that reads an input video and outputs a grayscale version of the same video. Do this for both movies shown below. Modify the HTML file to link to your output videos such that they show up in the web page below the original videos.

Your browser does not support HTML5 video. | Your browser does not support HTML5 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 1b

Write a program that reads an input video and outputs a modified version of the same video in which the color of all red bricks is changed to orange (use the same RBG for orange as in the second video). Do this for both movies shown below. Modify the HTML file to link to your output videos such that they show up in the web page below the original videos.

Your browser does not support HTML5 video. | Your browser does not support HTML5 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 1c

Write a program that reads an input video, changes the color of the ball to red, and also continuously draws the trajectory of the ball for the most recent 2 seconds of video (i.e., from t - 2 sec to t). Do this for both movies shown below. Modify the HTML file to link to your output videos such that they show up in the web page.

Your browser does not support HTML5 video. | Your browser does not support HTML5 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 1d

Write a program that reads the input video and outputs a modified version of the same video in which the number of bricks left in each column is displayed as a number above each column. There are 13 columns, so your program needs to overlay the video with 13 numbers and update them as the bricks disappear. Do this for both videos. Modify the HTML file to link to your output videos such that they show up in the web page.

Your browser does not support HTML5 video. | Your browser does not support HTML5 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 2a

Write a program that reads an input video, recognizes the eight digits on the seven-segment displays, and overlays the result video with these same digits but in a different font. Place each recognized digit above its corresponding seven-segment display and update it as the display changes. You can create your own structuring elements for the digits (e.g., by cropping digits from the 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 2b

Write a program that reads the input video and detects which red and green LEDs are on. There are 18 red and 8 green LEDs. Overlay the output video with a 0 or 1 digit below each LED such that 0 signifies off and 1 signifies on. Update these digits as the sate of the corresponding LED changes. You can assume that the four LEDs after the first six LEDs (from left to right) are always off.

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 2c

Write a program that combines what you did in parts 2a and 2b. In addition, your program must also output a text file that contains one line for each change of the state of the rightmost green LED (from On to Off or vice versa). The format of the text file should be as follows: 6-bit binary number (the first 6 red LEDs), TAB, an 8-bit binary number (the last 8 red LEDs), TAB, a 2-bit binary number (green LEDs 3 and 4 from left to right), TAB, 2-bit binary number (the last two green LEDs), TAB, the digits from the first 4 seven-segment displays, TAB, the digits from the second 4 seven-segment displays, new line.

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

Source

Note: change the file name to link your code

Put the contents of your output file here

## Extra Credit 1

Repeat the task from part 2c for the video shown below in which the camera moves over time. Hint: you may need to stabilize the image before processing.

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

Source

Note: change the file name to link your code