Monday, August 10, 2009

Installing OpenCV 1.1.1 on OpenSUSE 11.1

Special thanks to Damien Stewart who documented this procedure first.



I recently discovered the open source computer vision API called OpenCV. Originally created by Intel. It is now an open source project. It allows you to create computer vision applications that do things like facial recognition and tracking of moving objects. It's most famous implementation was in "Stanley" a robot who competed in the DARPA challenge to navigate a road without human guidance.



The procedure for installing OpenCV on a VMware Linux appliance was well documented by Damine Steward. His procedure used Ubuntu 8.04 as a basis. This is a reimagining of that procedure using OpenSUSE 11.1.


(1)Install OpenSUSE 11.1 in a VMware appliance created by VMware Workstation 6.5.



(2) After installing OpenSUSE 11.1, no need to install the VMware Tools. OpenSUSE 11.1 installs it for you.



(3) You will need to enable networking. You will need to turn off DHCP6 for your network interfaces. You may need to reboot.(4) Confirm that networking is working by open Firefox and trying to surf to an URL.
Add the Packman and Videolan repositories. Run the "Install Software" application. Insert the OpenSUSE 11.1 DVD into the cdrom drive. In the "Install Software" application:

Packages Listing->Repositories

Edit

Add

Select the "Community Repositories" radio button

Next

In the list that appears, select the Packman and Videolan repositories.



(4) Install the packages: checkinstall, yasm, libfaac-devel, libfaad-devel, libmpelame-devel, libtheora-devel, libxvidcore-devel, install portaudio-devel, twolame, libtwolame-devel , libpng3, libjpeg-devel, libtiff-devel, libjasper-devel



If you get an error message that libtheora-devel cannot be installed, choose to install the suggested alternative.

(5) svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpegcd ffmpeg./configure --enable-gpl --enable-postproc --enable-pthreads \--enable-libfaac --enable-libfaad --enable-libmp3lame \--enable-libtheora --enable-libx264 --enable-libxvid \--enable-shared --enable-nonfree


make

sudo make install



(6) svn checkout http://svn.berlios.de/svnroot/repos/guvcview/trunk/ guvcview
make
sudo make install
guvcview

Your USB camarea should be working with the guvcview tool.


(7) Next, download the examples from the OpenCV book from Oreilly. http://examples.oreilly.com/9780596516130/

Unzip these examples. You will use this to test the build and install of OpenCV.


(8) Download the latest OpenCV from the trunk. As of this writing 8/11/09, the version of OpenCV is v1.1.1.
svn co https://opencvlibrary.svn.sourceforge.net/svnroot/opencvlibrary/trunk/opencv

cd into opencv
mkdir release
cd opencv
mkdir release
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_EXAMPLES=ON ../
make
cd bin

(9) ./cxtest
only 4 test fail will fail

(10) ./cxcoretest
all tests pass
cd ..

(11) sudo make install

(12) In .bashrc add: export LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH}

(13) cd release/bin

(14) ./lkdemo
This is the sample tracking application. You should see it work with your webcam.


(15) Unzip the OpenCV examples in directory of choice

(16) g++ -o test ch2_ex2_1.cpp `pkg-config opencv --cflags --libs`
./test stuff.jpg
You should view a picture.

(17) g++ -o test ch2_ex2_2.cpp `pkg-config opencv --cflags --libs`
./test test.avi
./test tree.avi
Both avi movies should play

And that's it! Have fun.! If you have feedback on this procedure, feel free to contact me.

No comments: