/BADVideo

Course project for cs510 Computation Photography

Primary LanguageC++

===============================================================================
©2011 Tyler Hayes - Portland State University
cs510 Computational Photography
Prof. Feng Liu

FILE: README
NOTE: all text below the line '***********' was generated by Visual Studio 2010.
===============================================================================


----------
 OVERVIEW
----------
This project, BADVideo (Brighten And De-noise Video), is a project for my cs510
Computational Photography class at Portland State University.  BADVideo is a
small application that seeks to enhance underexposed, Low Dynamic Range (LDR)
videos by a method based on the following research paper:

"Video Enhancement Using Per-Pixel Virtual Exposures"
	by Eric P. Bennett and Leonard McMillan from The University of North
	Carolina at Chapel Hill


-------
 FILES
-------
The main file for this project is Form1.h.  This code generates the main window
of BADVideo and contains the logic of the algorithm for the program.

All of the .cpp files were generated by Visual Studio.

EnhanceForm.h is the other important source file (in terms of containing code
that I wrote) that provides the Enhance dialog window where the user enters the
appropriate parameter values.

All .png files are necessary for the icons in the main window of BADVideo.

All .avi files are test video clips--or rather, the .avi files with "original"
in the name are test videos, the others with "correctly_exposed" are correctly
exposed versions of the underexposed "original" videos in order to see how close
the enhanced videos came to a 'correct' result.

ProgressDialog.cpp and ProgressDialog.h create a new window to show the progress
of the enhancement process.  However, this refused to work--the window became
unresponsive after not much time, and I couldn't get it to work.  These files
are not used right now.

stdafx.cpp and stdafx.h were created by Visual Studio.


-----------
 ALGORITHM
-----------
At a very high level, here is pseudocode for the algorithm:

for each frame
   for each pixel
      for each channel
         if range of temporal vals > threshold
            apply bilateral filter
         else
            use median of temporal vals
   multiply vals by gain
   apply second pass of bilateral filter


---------------------
 HOW TO USE BADVideo
---------------------
1. Click the icon for "Open." and select an .avi file.
2. Click the icon for "Enhance." and enter values for the parameters.
3. Preview the output if you like by clicking the icon for "Preview."
4. Save the newly enahnced video by clicking the icon for "Save.".
5. Click the icon for "Exit." to exit the program.


----------------
 LANGUAGE/TOOLS 
----------------
BADVideo is written in C++/CLI with the OpenCV library using Visual Studio 2010.
Source code kept under revision control using Git.


-------
 NOTES
-------
- thought about temporal average/median sped up by only dropping off the oldest
  value and adding the newest value, but would require 640*480*3 arrays to be
  held in memory
- temporal ends (close to first frame, close to last frame) can be done in
  different ways (like image border when doing filters: use first/last frame for
  missing frames, extend missing frames to the other direction, or wrap around).
- problems:
	- paper lacking in detailed explainations of formulas
	- normalizing (cvNormalize() always threw an SEHException, added extra
	  computation and memory)
	- can't take advantage of temporal speed-up unless sacrifice memory
	- progress bar wouldn't work even with BackgroundWorker
	- ghosting
	- execution time
	- lack of color in severely underexposed video
- just bilateral filtering the images (and brightening) still had noise, just at
  a higher granularity.  Temporal median alone (and brightening) had distinct
  banding and slight ghosting.  Both temporal mediam and bilateral filter (of
  whole image) produced best results.
  
  
-------------
 FUTURE WORK
-------------
- implement constant time median filter to possibly replace bilateral filter



*******************************************************************************

========================================================================
    APPLICATION : BADVideo Project Overview
========================================================================

AppWizard has created this BADVideo Application for you.  

This file contains a summary of what you will find in each of the files that
make up your BADVideo application.

BADVideo.vcxproj
    This is the main project file for VC++ projects generated using an Application Wizard. 
    It contains information about the version of Visual C++ that generated the file, and 
    information about the platforms, configurations, and project features selected with the
    Application Wizard.

BADVideo.vcxproj.filters
    This is the filters file for VC++ projects generated using an Application Wizard. 
    It contains information about the association between the files in your project 
    and the filters. This association is used in the IDE to show grouping of files with
    similar extensions under a specific node (for e.g. ".cpp" files are associated with the
    "Source Files" filter).

BADVideo.cpp
    This is the main application source file.
    Contains the code to display the form.

Form1.h
    Contains the implementation of your form class and InitializeComponent() function.

AssemblyInfo.cpp
    Contains custom attributes for modifying assembly metadata.

/////////////////////////////////////////////////////////////////////////////
Other standard files:

StdAfx.h, StdAfx.cpp
    These files are used to build a precompiled header (PCH) file
    named BADVideo.pch and a precompiled types file named StdAfx.obj.

/////////////////////////////////////////////////////////////////////////////