Tuesday, September 29, 2009

Eclipse - OpenCV Project Setup

After you install OpenCV you will most likely want to use a programming IDE to write your code. In this case I am assuming you have chosen the Eclipse C++ IDE. To install this go here to download and untar the program where you will want it to reside on your machine.  Then run the program (no install necessary... it's written in java).

If you have installed the OpenCV library on your machine to /usr/local then you can follow this setup. Otherwise you will have to change how you link to OpenCV appropriately.  This section also relates to the setup of gtkmm and fftw.  If you do not want to use them, remove their sections.

1) Right click on your project and go to Properties
2) Go to the C/C++ Build section and then Settings
3) Under GCC C++ Compiler,  click on Directories
4) Add the following paths under Include Paths

/usr/local/include/opencv
/usr/lib/gtkmm-2.4
/usr/include/gtkmm-2.4


5) Under GCC C++ Compiler,  click on Optimization
6) Add the following under Other optimization flags

-ggdb `pkg-config opencv --cflags --libs` `pkg-config gtkmm-2.4 --cflags --libs`


7) Under GCC C++ Linker,  click on Libraries
8) Add the following under Libraries

cv
gtkmm-2.4
highgui
fftw3
9) Add the following under Library search path


/usr/local/lib
/usr/lib

Thursday, September 24, 2009

Neural Networks - Perceptron Character Recognition

A couple of years ago I took a really fun and challenging class called Introduction to Neural Networks.  We discussed the theory and applications of neural networks, including single- and multi-layer feedforward and recurrent networks, supervised and unsupervised learning, etc.

If you are unfamiliar with Neural Networks, they are methods that attempt to mimic the human brain (hence neural) by utilizing the basic fundamental building block of a neuron.  Neural Networks provide the ability to learn and make decisions based on various ideas related to increasing or decreasing the connections between neurons.

For a great introduction please see Jon Carrier's Neurocomputing Presentation

In this class I did a presentation on the ability of single perceptrons to perform character recognition.

Here is a link to my professors blog that describes our classes presentations: eceblogger

Here is a link to my presentation: Google Doc Link... Well I was going to post it, but I do not have it on hand just yet.  Will post once I get to it.

Some Interesting Bash Functions

In Linux there is a type of scripting that can be done in the Bash shell.  This is a very powerful feature of Linux, as Bash offers many advanced features.  This blog will show some of the features I have learned.  I will not attempt to cover a tutorial but rather varying functions that I have found useful.

IFS
   One of the interesting things that I have learned is the usage of IFS.  According to wikipedia it stands for Internal Field Separator.  What it does is allow you to define what Bash defines as a separator.  Bash defaults to space as the separator, therefore functions that utilize IFS will separate items based on spaces.

  While scripting you might want to change this.  Maybe a comma or a new line will be what is wanted.  Here is an example that sets the value to a new line and then back to the default.


#set IFS to be a new line
IFS="
"
#set IFS to be a space
IFS=" " 

Checking Arguments
  When you are implementing a bash script you can pass in arguments to the program.  Each argument is listed as $(value) where value ranges from 0 on up.  $0 is your program, $1 is the first passed in argument, etc.

Now what we want to do is check how many the user input.  Maybe we only want 2 values to be input, so we should check that.  Here is an example that checks for 2 inputs.


if [ $# -ne 2 ]; then
  echo "You did not input 2 arguments, try again!"
  exit
fi

Iterate Through all Files in CWD
  Sometimes it is necessary to iterate through all files in a certain directory.  There are a few ways to do this, but if you are dealing with files that may have spaces in them, the best way is the following.


for file in `ls -A $src`; do 
  sourceFile="$src/$file"
  # Now do what you want it to do with each source file
done


* Note: In the above example you will note $src, this is the full length path where you are searching files.  This can be a hard coded variable or possibly an argument to your function.

* Note: Whenever you reference sourceFile make sure to use quotes

Checking for Certain Things
  When you are coding you might want to check what something is.  Here are a few ways to check.

Checking that a directory exists

if [ ! -d "$dir" ]; then
  #do something since the directory does not exist
fi

Checking for a regular file

if [ -f "$file" ]; then
  #do something since it is a normal file
fi

Checking if file1 is newer than file2

if [ "$file1" -nt "$file2" ]; then
  # file1 is newer, so do something here
fi

Tuesday, September 15, 2009

Audio Watermarking

While working towards my Master's thesis I took an Advanced Topics class titled Speech Processing. In this class we covered the basics of processing speech data (not specifically speech recognition, but all encompassing). Topics such as the anatomy of speech production, speech synthesis, voice estimation and specific applications through student presentations. My presentation was on Audio Watermarking.

I found a recent paper on the subject and attempted to recreate what the authors had implemented. I implemented their algorithm in Matlab. Unfortunately it did not work as well as theirs, but I was lucky enough to be chosen as the best presentation by the class.

To view my presentation go here: Google Doc Link

For images of my presentation as well as other students please visit my professors eceblogger site.

Just for fun, here is an image of the matlab gui I created for this project.