Remove any installed versions of ffmpeg and x264.
sudo apt-get remove remove ffmpeg x264 libx264-dev
Install all the dependencies.
sudo apt-get install libopencv-devDownload the latest version ox x264 from x264 snapshots
sudo apt-get install build-essential checkinstall cmake pkg-config yasm
sudo apt-get install libtiff4-dev libjpeg-dev libjasper-dev
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev
sudo apt-get install python-dev python-numpy
sudo apt-get install libtbb-dev
sudo apt-get install libqt4-dev libgtk2.0-dev
tar -xvf x264-snapshot-version.tar.bz2If you are using 32 bit Linux
cd x264-snapshot-version/
./configure –enable-staticIf you’re using 64 bit Linux
./configure –enable-shared –enable-picInstall it
makeDownload the latest version of ffmpeg from ffmpeg Download.
sudo make install
tar -xvf ffmpeg-version.tar.bz2If you’re using 32 bit Linux
cd ffmpeg-version/
./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-x11grabIf you’re using 64 bit Linux or ARM
./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-sharedInstall it
makeDownload the latest image of v4l from v4l-utils
sudo make install
tar -xvf v4l-version.tar.bz2Download OpenCV 2.4.0
cd v4l-version
make
sudo make install
Download OpenCV 2.4.1
Download OpenCV 2.4.2
After downloading OpenCV 2.4.* package, untar it and make.
tar -xvf OpenCV-version.tar.bz2Verify that the output of cmake includes the following text:
cd OpenCV-version/
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE ..
- found gstreamer-base-0.10
- GTK+ 2.x: YES
- FFMPEG: YES
- GStreamer: YES
- V4L/V4L2: Using libv4l
makeOpenCV 2.4.* is now installed. Just make sure that all the libraries are linked properly.
sudo make install
Go to samples directory in OpenCV package.
Change directory to C or C++.
You’ll find a script there named build_all.sh.
Execute the script. It will make all the files. select any output file and run it. If it works then you are good to go.
sudo echo “/usr/local/lib” >> /etc/ld.so.confYour OpenCV 2.4.* is installed and libraries are properly linked.
sudo ldconfig
Using OpenCV with QtCreator:
- Install QtCreator: sudo apt-get install qtcreator
- To use OpenCV in QtCreator simply add to the .pro file of your project these lines:
INCLUDEPATH += /usr/local/include/opencv
LIBS += -L/usr/local/lib \
-lopencv_core \
-lopencv_imgproc \
-lopencv_highgui \
-lopencv_ml \
-lopencv_video \
-lopencv_features2d \
-lopencv_calib3d \
-lopencv_objdetect \
-lopencv_contrib \
-lopencv_legacy \
-lopencv_flann
Original Post @ link