본문 바로가기

Opencv

[opencv] how to install opencv on ubuntu

반응형

** 우분투에서 opencv 설치하기 **


Background: ubuntu16.04LTS + python 2.7


step1) install required libraries 

(See http://www.pyimagesearch.com/2016/10/24/ubuntu-16-04-how-to-install-opencv/)


step2) download opencv source from terminal


$ cd ~

$ wget -0 opencv.zip https://github.com/Itseez/opencv/archive/3.2.0.zip

$ unzip opencv.zip


step3) Do cmake. (In my case, the option "D WITH_FFMPEG=OFF" is essential for successful installation)


$mkdir build

$cd build

$cmake -D CMAKE_BUILD_TYPE=RELEASE \

-D CMAKE_INSTALL_PREFIX=/usr/local \

-D INSTALL_PYTHON_EXAMPLES=ON \

-D INSTALL_C_EXAMPLES=OFF \

-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.2.0/modules \

-D ENABLE_PRECOMPILED_HEADERS=OFF \

-D BUILD_EXAMPLES=ON \

-D WITH_FFMPEG=OFF ..


step4) Do make. (This may take a very long time. Be patient!!)


$make -j4

$sudo make install

$sudo ldconfig


step5) check your opencv version.


$pkg-config --modversion opencv