CS 478 - Computational photography (Winter 2012)

"Hello Image Processing" Assignment

Due February 8, 2012 at 2:00 p.m.

Introduction: This assignment is an exercise intended to introduce you to image processing on the Tegra platform. You will perform a variety of processing tasks using OpenCV, ImageStack, and OpenGLSL. Each paradigm is well-suited to different kinds of tasks, so think carefully about which one(s) you would like to use in your final project.

Tasks:

  1. Face focus: Use OpenCV to find faces for autofocus.
  2. Flash/no-flash fusion: Use ImageStack to combine the nice colors of a no-flash image with the sharp edges of a flash image.
  3. Zebra viewfinder: Use OpenGLSL to implement a zebra viewfinder mode.

Deliverables:

  1. A zipped archive of your code. A (cleaned) tarball of fcam directory will suffice.
  2. An electronic copy of your write-up. Plaintext e-mail is OK.
  3. Sign up for a 10-minute grading session for you to demonstrate the functionality of the camera application with your new image processing features.
Send the above materials to cs478.win12.staff@gmail.com in an email with subject "[CS478] Assignment #2 - John Doe", where you replace John Doe with your full name.


Getting Started

Getting all these image processing libraries to compile and run in FCamera is not an easy task. Luckily, we've done it for you. Before we get to the assignment proper, follow these steps to get up and running with our new code base:
  1. Download the new codebase and set up a new project in Eclipse.

    Unzip it somewhere convenient and create a project from existing source in your Eclipse workspace by following the same instructions given in Steps 4 and 5 of the "Getting Started" section in Assignment 1. Windows users only: If you are using windows and cygwin, you will need to add an additional environment variable definition NDK_USE_CYGPATH=1 before calling ndk-build as well. You can do this the same way we added NDK_MODULE_PATH before.

  2. Test to make sure it compiles and runs.

    The first time you compile it might take a few minutes because you'll be compiling the new libraries. The application when run should behave like a basic camera sans autofocus. Under the hood its got a couple extra libraries loaded in and a revamped viewfinder pipeline, but they aren't doing anything interesting yet.

  3. Migrate your autofocus code from Assignment 1.

    The code skeleton changes necessary to support the image processing libraries require small changes to many files. We figure it will be easier for you to just copy your code from the first assignment to the new code base instead. Once you are done, test to make sure everything still works, since the first task will augment your autofocus functionality.

    Be careful when doing the migration. It is easy to lose track of which FCamInterface.java etc. you are editing at any given point. Once you've completed the migration, it might be helpful to close the old project or remove it entirely from your Eclipse workspace.


Face focus

The autofocus routines you created in the first assignment can be improved by using a little bit of computer vision and scene understanding. In this section, you will add a face-based autofocus mode to FCamera using OpenCV.

OpenCV is the tool of choice for computer vision tasks such as feature detection, tracking, etc. It has been optimized for the Tegra hardware and has a huge community of users, so it is relatively fast and well supported for common tasks. However, recently published research, unless implemented in OpenCV and released by paper authors, may be difficult to incorporate into projects purely using OpenCV.

Subtasks:

Flash/no-flash fusion

Taking photographs in dark environments is challenging. Using a flash will allow you to get a well-exposed photograph with crisp edges, but the scene's ambient light colors are lost. Simply boosting the gain of a photograph will yield more accurate colors, but the image will be quite noisy. In this section, you will use ImageStack to combine the edge information from a flash photograph with the color information from a noisy photograph to create a noise-free(-ish) photo with good colors.

ImageStack is the tool of choice for image processing after capture. It was developed here at Stanford, so there is plenty of local expertise available to you. Many of the techniques we'll discuss in this course are already implemented in ImageStack, so you won't need to spend half your time implementing someone else's research. Internally, it uses floating point images, so it works great for many image domains (e.g. depth data, HDR, etc.,) but can be too memory hungry and slow for real-time applications.

Subtasks: