[OpenCV] How to install opencv by compiling source code

Introduction

Install OpenCV and its dependence !

STEPs

1, compiler

sudo apt-get install build-essential checkinstall cmake
sudo apt-get install gnome-core-devel

2,Install gstreamer

sudo apt-get install libgstreamer0.10-0 libgstreamer0.10-dev gstreamer0.10-tools gstreamer0.10-plugins-base libgstreamer-plugins-base0.10-dev gstreamer0.10-plugins-good gstreamer0.10-plugins-ugly gstreamer0.10-plugins-bad

3,Remove any installed versions of ffmpeg and x264

sudo apt-get remove ffmpeg x264 libx264-dev

4, Install dependencies for ffmpeg and x264

sudo apt-get install git libfaac-dev libjack-jackd2-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libtheora-dev libva-dev libvdpau-dev libvorbis-dev libx11-dev libxfixes-dev libxvidcore-dev texi2html yasm zlib1g-dev libjpeg8 libjpeg8-dev 

5, Install libx264

For 32-bit

./configure --enable-static --enable-shared 

For 64-bit

./configure --enable-static --enable-shared --enable-pic

6 , Install FFMpeg

For 32-bit

./configure --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab

For 64-bit

./configure --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab --enable-shared --enable-pic

7 , Install v4l

Download the library of v4l from http://www.linuxtv.org/downloads/v4l-utils/ .

./configure

8 , semi-graph cmake

sudo apt-get install cmake-curses-gui

9, OpenCV

mkdir build
cd build
ccmake ..

你可能感兴趣的:(Install,source,Compiling)