OpenCV-2.3버전 설치하는 방법에 대해서 설명한다. OpenCV-2.4버전에서도 이 방법은 유효하다.
Installing OpenCV 2.3 in Ubuntu.I had a lot of problems initially to install and port the OpenCV library to Python. But after reading a lot of blogs I finally found a solution which I have posted below.
1)사전에 필요한 라이브러리 설치한다.
1)Install all pre requisites
>>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 libjpeg62 libjpeg62-dev libjpeg-progs libjpeg62-dbg
>>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
>>sudo apt-get install build-essential libgtk2.0-dev libjpeg62-dev libtiff4-dev libjasper-dev libopenexr-dev cmake python-dev python-numpy libtbb-dev libeigen2-dev yasm libfaac-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev
2) 파이센 헤더를 설치한다
2)Install the python development headers
>>sudo apt-get install python-dev
3) OpenCV소스코드를 다운로드 한다.
3)Download the source code:
http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.3/
4)압축을 푼다.
4)Go to the directory where OpenCV is downloaded via the terminal only and then un zip the package:
(note:- It is recommended that you move the downloaded OpenCV package to the home/ directory
>>tar -xvf OpenCV-2.3.1a.tar.bz2
>>cd OpenCV-2.3.1/
5) 압출을 풀어서 만들어 진 OpenCV 폴더 안에 build 디렉토리를 만든다
5)Now make a new directory called build and go in to it
>>mkdir build
>>cd build
6)Cmake한다.
6)Run Cmake
>>cmake -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=OFF -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON ..
7) Make한다.
7)Now make
>>make
8) make install 한다.
8) Make it permanent
>>sudo make install
9)공유라이브러리 사용을 위한 OpenCV설정
9)Configuring OpenCV for using shared libraries:
>>sudo gedit /etc/ld.so.conf.d/opencv.conf
Add the following line at the end of the file (it may be an empty file, that is ok) and then save it:
/usr/local/lib
Close the file and run the following command to configure the library:
>>sudo ldconfig
OR RUN : export LD_LIBRARY_PATH=/usr/local/lib
10).bashrc file을 열고 아래를 덧붙인다.
10)Open your .bashrc file and add the following:
>>gedit .bashrc
or sudo gedit /etc/bash.bashrc
add the following at the end of the file -
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
Save and close the file
11)재부팅한다.
11)Reboot the system
http://ubuntuone.com/0qwnXh8VoufDMHGiu5kLIK (Link to download this text file)