Creating Real-time Video Filters

Assignment 5

Installing the Camera Project

Objective: Understanding of low-level graphics manipulation, 2-Dimensional data structures, dynamic data types

Description: In this assignment, you will be creating real-time video filters.  You will be required to purchase (or borrow from someone) a camera, preferably a USB Intel or Logitech camera.   When the user presses a key, this will trigger one of the filters, which will modify the video captured by the camera.

Background: You will be given most of the code for this project - enough so that you can run the program, and see what is displayed on the screen.   In the code provided, there is a variable named 'dataPtr', which is an array of ARUint8's (discussed below).  dataPtr is really a pointer to the information that was just captured by the camera.  So the general algorithm is to change these values before they are written to the screen.

The ARUint8 data type is really just one byte, and a color is comprised of 4 of them: the blue component, the green component, the red component, and then an unused 'alpha' or transparency component.  We call this BGRA.   Component values range from 0-255.   

An example of how to make the blue filter is to set the red and green components to 0, and leave the blue component alone.  We will discuss how to implement the other filters in class.

For the sinusoidal distortion filters, you will essentially have a lookup array that is pre-calculated.  The array determines how many pixels the current pixel needs to be shifted to the left or the right.  For example, the outer pixels need to be shifted hardly at all, but the inner pixels need to be shifted a lot.  Let's say that we have a magnification of 10, then:

Slot0123...middleofscreen...316317318319
Amount of Shift0-1-1-2-9-99...2110

Once you have this information, you can create a distorted frame by copying values from the current video frame plus the offset! 

You will also need to set up Visual Studio to change the include, lib, and source directories;  without doing this, the code will not compile/run correctly.  There will be a small lab coming soon to help you out.

Requirements: You will be required to write the following filters:

Extra Credit:  For 0xe16 points, do the following:

Example:

Program Turnin: You will demo this in class.