1. Install the OpenCV dependencies by typing following commands.
sudo apt-get install build-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg62-dev libtiff4-dev cmake libswscale-dev libjasper-dev
To cover all the dependencies install -
sudo apt-get install build-essential sudo apt-get install cmake sudo apt-get install pkg-config sudo apt-get install libpng12-0 libpng12-dev libpng++-dev libpng3 sudo apt-get install libpnglite-dev libpngwriter0-dev libpngwriter0c2 sudo apt-get install zlib1g-dbg zlib1g zlib1g-dev sudo apt-get install libjasper-dev libjasper-runtime libjasper1 sudo apt-get install pngtools libtiff4-dev libtiff4 libtiffxx0c2 libtiff-tools sudo apt-get install libjpeg8 libjpeg8-dev libjpeg8-dbg libjpeg-progs sudo apt-get install ffmpeg libavcodec-dev libavcodec52 libavformat52 libavformat-dev sudo apt-get install libgstreamer0.10-0-dbg libgstreamer0.10-0 libgstreamer0.10-dev sudo apt-get install libxine1-ffmpeg libxine-dev libxine1-bin sudo apt-get install libunicap2 libunicap2-dev sudo apt-get install libdc1394-22-dev libdc1394-22 libdc1394-utils sudo apt-get install swig sudo apt-get install libv4l-0 libv4l-dev sudo apt-get install python-numpy
Further optional dependencies could be checked and installed from the configure option during building. For more info go to OpenCV site.
2. Download the OpenCV 2.3 source from here or type following command -
wget http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.3.1/OpenCV-2.3.1a.tar.bz2/
3. Extract the OpenCV tar file (preferably in your home directory)
tar -xvf OpenCV-2.3.1a.tar.bz2
4. Now create the build directory for opencv
$ cd OpenCV-2.3.1
$ mkdir opencv.build
$ cd opencv.build
5. Configure, make and install the code -
$ cmake ..
$ make
$ sudo make install
6. Open the .bashrc file from your home folder
$ gedit .bashrc
and add the following at the end of the file -
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/
export PKG_CONFIG_PATH=/home/
alias gcv="g++ `pkg-config --cflags opencv` `pkg-config --libs opencv`"
7. Now test building the samples -
$ cd /home/
$ chmod a+x build_all.sh
$ ./build_all.sh
If the samples are successfully compiled, then your opencv is ready to use.
8. Since we added an alias in the bashrc file named "gcv", you can compile any opencv code just by using this alias as -
$ gcv hellocv.cpp
댓글 없음:
댓글 쓰기