I am working on 3-D Modeling using Videos. As usual the first steps of doing a project is to get the development environment settled up, and doing the feasibility study. In our case we had decided to use OpenCV for video manipulation, because of two reason :
1.) It's faster than any other library present out there for the same purpose.
2.) Its pretty advanced(read as a lot of inbuilt functionality) and optimized.
I am just documenting the method which worked for me, there were other easier one's which didn't worked for me :(.
First of all one needs the ffmpeg (for video support) and GTK 2.0 for OpenCv to work properly. Sadly, one needs to check out ffmpeg from trunk and compile it for his own platform, no binaries in Ubuntu repositories.
1.) Check out ffmpeg from their svn repo:
svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
2.) Then for sure one needs to compile ffmpeg and install it:
sudo make install
This thing takes its own sweet time, So you can go and get some coffee for yourself.
3.) Then you need to get GTK Development libraries:
sudo apt-get install libgtk2.0-dev
4.) Finally one needs to download code for OpenCV 2.0 and Compile and install it :
tar -xvf OpenCV-2.0.0.tar.bz2
./configure --with-ffmpeg --with-gtk --with-quicktime=false
sudo make install
This is again a thing which will give you ample of time to take a break and make some calls to your fiends.
After you are done installing OpenCv, then comes the issue of how to use it. I was using openCV with C++ and tried some sample examples of O'Rielly book.
After a little searching I figured out that to include the OpenCv files while compiling my C++ files I need to use :
g++ `pkg-config --cflags opencv` `pkg-config --libs opencv` filename.cpp -o test
Now, this is neither easy to remember nor easy to type every time I compile some code. So, I found this nice little hack of adding aliases.
There exists a .bashrc file in your home folder. It is basically a config file for your login profile. One can add aliases for terminal commands in this file and then use them :
alias gcv="g++ `pkg-config --cflags opencv` `pkg-config --libs opencv`"
Now whenever, I type gcv in my terminal , it is interpreted as g++ blah blah blah.
I will keep adding the progress of my project to this blog, so stay tuned.