Assignment 4: Draw bounding boxes
DATE DUE: March 14, 2016
Points possible: 10 points
CS-161: Software Project
Instructor: Rob Bruce

OVERVIEW

For this assignment, you will use OpenCV to draw bounding box data on a copy of each still image frame associated with a given video ID. You will then put these still images together into a movie using FFMPEG.

SPECIFICATIONS

1. Your program should accept command line input through argc and argv. Your program will thus use argv to pass in a non-negative integer (video ID) which represents the unique identifer of an input video.

2. Your program will then query Postgres for the following metadata associated with the input video ID:

  • Number of frames
  • Width (pixels) of each frame (in pixels)
  • Height (pixels) of each frame (in pixels)
  • Frame rate (frames per second) of original input video

3. For each frame associated with the video ID in the image repository do the following:

  • Query Postgres with the video ID and current frame to retrieve face bounding box data
  • If face bounding box data exists, draw an outline of a blue rectangle (unfilled) on the image with the coordinates for the face bounding box: starting position upper left corner (x, y) and (width, height).
  • Query Postgres with the video ID and current frame to retrieve left eye bounding box data
  • If left eye bounding box data exists, draw an outline of a green rectangle (unfilled) on the image with the coordinates for the left eye bounding box: starting position upper left corner (x, y) and (width, height).
  • Query Postgres with the video ID and current frame to retrieve right eye bounding box data
  • If right eye bounding box data exists, draw an outline of a red rectangle (unfilled) on the image with the coordinates for the right eye bounding box: starting position upper left corner (x, y) and (width, height).
  • Query Postgres with the video ID and current frame to retrieve nose bounding box data
  • If nose bounding box data exists, draw the outline of a yellow rectangle (unfilled) on the image with the coordinates for the nose bounding box: starting position upper left corner (x, y) and (width, height).
  • Query Postgres with the video ID and current frame to retrieve mouth bounding box data
  • If mouth bounding box data exists, draw an unfilled magenta rectangle (unfilled) on the image with the coordinates for the mouth bounding box: starting position upper left corner (x, y) and (width, height).
  • Save the resulting image to a temporary directory

4. Use FFMPEG to create a silent movie titled "bounding_box_movie_VIDEO_ID.mp4" in MPEG4 format using the sequential images in your temporary directory. VIDEO_ID is an unsigned integer and represents the video ID number of the original input video.

SUBMITTING YOUR PROGRAM

1. Please submit your program as a text file to the Canvas dropbox. I only need the source code. I will build the program myself.

2. Please name your program using the following naming convention:

Lastname_Firstname_assignment_4.c (for C programs)

Lastname_Firstname_assignment_4.cpp (for C++ programs)

Lastname_Firstname_assignment_4.java (for Java programs)

Lastname_Firstname_assignment_4.pl (for Perl programs)

Lastname_Firstname_assignment_4.py (for Python programs)

Lastname_Firstname_assignment_4.sh (for BASH programs)

Lastname_Firstname_assignment_4.csh (for csh programs)

For example, my name is Rob Bruce. If I write my program in the C programming language, my assignment 4 should be named: Bruce_Rob_assignment_4.c

3. Please include your name as a comment at the beginning of your program like this:

/* Rob Bruce */

or this:

// Rob Bruce

4. I usually do not need a makefile to build your programs, regardless of language; however, in the unlikely event that I cannot build your project, I will send an email inquiry as appropriate.

5. I expect your program to build without syntax errors.

6. I expect your program to execute without run-time errors.

GRADING

Points will be deducted for any program that does not meet the specification as outlined above.

LATE ASSIGNMENTS

Assignments submitted after the due date will be worth, at most, 5 points. Additional points will be deducted for programs not meeting the specification as outlined above.