Skip to content Skip to sidebar Skip to footer

Cara Install OpenCV di Linux Ubuntu

INSTALL OPENCV PADA UBUNTU 14.04

OpenCV ( Open Source Computer Vision Library) adalah  sebuah open source computer vision and machine learning software library . Ini adalah perangkat lunak gratis dan menyediakan API didalam bahasa pemrograman C , C ++ , Java dan Python . 

Logo OpenCV

ubuntu 14.04 LTS Trusty Tahr


Install OpenCV

1. Membuat Direktori

mkdir opencv

cd /opencv/

2. Hapus dan install kembali ffmpeg and x264

sudo apt-get -qq remove ffmpeg x264 libx264-dev

3. Install Depedensis

sudo apt-get -qq install libopencv-dev build-essential checkinstall cmake pkg-config yasm libjpeg-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev python-dev python-numpy libtbb-dev libqt4-dev libgtk2.0-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils

4. Install ffmpeg

sudo add-apt-repository ppa:mc3man/trusty-media

sudo apt-get update

sudo apt-get install ffmpeg gstreamer0.10-ffmpeg

5. Download dan ekstrak OpenCV

wget -O OpenCV-2.4.9.zip http://liquidtelecom.dl.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.9/opencv-2.4.9.zip

unzip OpenCV-2.4.9.zip

cd opencv-2.4.9

6. Mulai proses Build

mkdir build

cd build

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..

make -j2

sudo make install

sudo sh -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'

sudo ldconfig

7. Restart Ubuntu

8. Contoh 
- Ganti direktori dengan lokasi berikut:

cd /usr/local/share/OpenCV/samples/c

-  Jalankan perintah ini

sudo chmod +x build_all.sh

sudo ./build_all.sh

./facedetect "/usr/share/opencv/haarcascades/haarcascade_frontalface_alt.xml" lena.jpg

Atau

./facedetect --cascade="/usr/share/opencv/haarcascades/haarcascade_frontalface_alt.xml" lena.jpg


Selesai

Post a Comment for "Cara Install OpenCV di Linux Ubuntu"