Installing OpenCV 2.4.9 in BeagleBoneBlack and BeagleBoard-XM (ubuntu 14.04)

Newer Version of Ubuntu 14.04 is out for BeagleBoneBlack and same is the case with OpenCV ie. 2.4.9 .

In this post, we are going to set up OpenCV in BeagleBoneBlack step by step.I am using Ubuntu 14.04 Desktop edition on PC side as well as on BBB Side.

Download OpenCV 2.4.9 and other mentioned packages from links given below on PC. We will transfer them to BBB and use them in installing process.
[highlight]

OpenCV 2.4.9 (Linux version)

[/highlight]
This is an installation script for compiling openCV from source code in BeagleBone Environment as well as in BeagleBoard-XM Environment. It requires this script to be present in source code of opencv downloaded from https://github.com/Itseez/opencv. Also Manually download and move the extracted folder of ffmpeg(https://www.ffmpeg.org/download.html), x264(ftp://ftp.videolan.org/pub/videolan/x264/snapshots/) and v4l(http://www.linuxtv.org/downloads/v4l-utils/) in opencv source code folder. If required rename the folder as mentioned in script.

echo "Installing OpenCV"
echo "Removing any pre-installed ffmpeg and x264"
sudo apt-get -qq remove ffmpeg x264 libx264-dev
echo "Installing Dependenices"
sudo apt-get install -y libopencv-dev 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 qt5-default 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 libsdl1.2-dev libvpx-dev libgstreamer0.10-0 gstreamer0.10-tools gstreamer0.10-plugins-base libgstreamer-plugins-base0.10-dev gstreamer0.10-plugins-good gstreamer0.10-plugins-ugly gstreamer0.10-plugins-bad libgtk2.0-0 libgtk2.0-dev libjpeg8 libjpeg8-dev build-essential checkinstall cmake
echo "installing v4l"
cd v4l
chmod +x *
sudo ./configure && make && sudo make install
echo "installing x264"
cd ../x264
chmod +x *
./configure --enable-shared –-enable-pic && make && sudo make install
echo "Installing ffmpeg"
cd ../ffmpeg
chmod +x *
./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 && make && sudo make install
echo "Installing OpenCV" $version
cd ..
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=OFF -D WITH_OPENGL=ON -D BUILD_DOCS=ON -D WITH_GSTREAMER=ON -D WITH_JPEG=ON -D WITH_PNG=ON -D WITH_FFMPEG=ON -D WITH_OPENGL=ON ..
make
sudo make install
sudo sh -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'
sudo ldconfig
echo "OpenCV ready to be used"
view raw opencv_bbb.sh hosted with ❤ by GitHub

Github repository :- https://github.com/MrityunjaiKumar/opencv-bb