Difference between revisions of "Installation af OpenCV"

From Teknologisk videncenter
Jump to: navigation, search
 
(2 intermediate revisions by the same user not shown)
Line 4: Line 4:
  
  
OpenCV installation guide - Ubuntu 14.04
+
'''Updated guide for Ubuntu 14.04:'''
 +
 
 +
http://www.sysads.co.uk/2014/05/install-opencv-2-4-9-ubuntu-14-04-13-10/
 +
 
 +
 
 +
'''The following doesn't work as it was never fully finished.'''
 +
A complete version can be made though. As it should be nearly all commands needed.
 +
Use above link for reference.
 +
 
 +
<code><pre>
 +
#!/bin/sh
 +
apt-get update
 +
apt-get -qq remove -y ffmpeg x264 libx264-dev
 +
apt-get install -y build-essential libgtk2.0-dev libjpeg62-dev libtiff4-dev libjasper-dev libopenexr-dev cmake python-dev python-numpy libtbb-dev libeigen2-dev yasm libfaac-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev
 +
add-apt-repository -y ppa:mc3man/trusty-media
 +
apt-get update
 +
apt-get install ffmpeg gstreamer0.10-ffmpeg
 +
#
 +
echo "Creating a directory for installation"
 +
mkdir ~/installdir/dl/opencv
 +
echo "Downloading ffmpeg files"
 +
dl_ffmpeg="/home/hpcadmin/installdir/"
 +
if [ -f "/home/hpcadmin/installdir/dl/opencv/ffmpeg-0.10.15.tar.gz" ];
 +
then
 +
echo
 +
else
 +
wget ffmpeg.org/releases/ffmpeg-0.10.15.tar.gz ~/installdir/dl/opencv/
 +
echo "Unpacking files...."
 +
tar -xvzf ~/installdir/dl/opencv/ffmpeg-0.10.15.tar.gz
 +
ffmpeg-0.10.15
 +
echo "Configuring unpacked files..."
 +
./configure --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libxvid --enable-x11grab --enable-swscale --enable-shared
 +
make
 +
echo "Installing files and dependancies"
 +
make install
 +
fi
  
  
'''Updated guide for Ubuntu 14.04:'''
 
  
http://www.sysads.co.uk/2014/05/install-opencv-2-4-9-ubuntu-14-04-13-10/
+
wget -c http://garr.dl.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.10/opencv-2.4.10.zip
 +
unzip opencv-2.4.10.zip
 +
cd opencv-2.4.10/
 +
cmake -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=OFF -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON ..
 +
echo "Still Working..."
 +
make
 +
echo "Installing openCV to your system, Please wait..."
 +
make install
 +
echo "Installation done, configuring system"
 +
touch /etc/ld.so.conf.d/opencv.conf
 +
sh -c 'echo "/usr/local/lib" >> /etc/ld.so.conf.d/opencv.conf'
 +
echo "Reloading configuration files created."
 +
ldconfig
 +
sh -c 'echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig" >>/etc/bash.bashrc'
 +
sh -c 'echo "export PKG_CONFIG_PATH" >>/etc/bash.bashrc'
 +
cp /usr/local/lib/python2.7/site-packages/cv.so /usr/local/lib/python2.7/dist-packages/cv.so
 +
echo "Installation Done."
 +
</pre></code>
  
  

Latest revision as of 11:40, 4 November 2014

OpenCV installation på Ubuntu 14.04

Husk at du skal have installleret CUDA inden du starter på denne guide


Updated guide for Ubuntu 14.04:

http://www.sysads.co.uk/2014/05/install-opencv-2-4-9-ubuntu-14-04-13-10/


The following doesn't work as it was never fully finished. A complete version can be made though. As it should be nearly all commands needed. Use above link for reference.

#!/bin/sh
apt-get update
apt-get -qq remove -y ffmpeg x264 libx264-dev
apt-get install -y build-essential libgtk2.0-dev libjpeg62-dev libtiff4-dev libjasper-dev libopenexr-dev cmake python-dev python-numpy libtbb-dev libeigen2-dev yasm libfaac-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev
add-apt-repository -y ppa:mc3man/trusty-media
apt-get update
apt-get install ffmpeg gstreamer0.10-ffmpeg
#
echo "Creating a directory for installation"
mkdir ~/installdir/dl/opencv
echo "Downloading ffmpeg files"
dl_ffmpeg="/home/hpcadmin/installdir/"
if [ -f "/home/hpcadmin/installdir/dl/opencv/ffmpeg-0.10.15.tar.gz" ];
then
	echo
else
	wget ffmpeg.org/releases/ffmpeg-0.10.15.tar.gz ~/installdir/dl/opencv/
	echo "Unpacking files...."
	tar -xvzf ~/installdir/dl/opencv/ffmpeg-0.10.15.tar.gz
	ffmpeg-0.10.15
	echo "Configuring unpacked files..."
	./configure --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libxvid --enable-x11grab --enable-swscale --enable-shared
	make
	echo "Installing files and dependancies"
	make install
fi



wget -c http://garr.dl.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.10/opencv-2.4.10.zip
unzip opencv-2.4.10.zip
cd opencv-2.4.10/
cmake -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=OFF -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON ..
echo "Still Working..."
make
echo "Installing openCV to your system, Please wait..."
make install
echo "Installation done, configuring system"
touch /etc/ld.so.conf.d/opencv.conf 
sh -c 'echo "/usr/local/lib" >> /etc/ld.so.conf.d/opencv.conf'
echo "Reloading configuration files created."
ldconfig
sh -c 'echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig" >>/etc/bash.bashrc'
sh -c 'echo "export PKG_CONFIG_PATH" >>/etc/bash.bashrc'
cp /usr/local/lib/python2.7/site-packages/cv.so /usr/local/lib/python2.7/dist-packages/cv.so
echo "Installation Done."


OLD commands for Ubuntu 12.04:

Kommandoer

sudo apt-get install build-essential cmake pkg-config
Install Image I/O libraries


sudo apt-get install libjpeg62-dev libtiff4-dev libjasper-dev
Install the GTK dev library


sudo apt-get install  libgtk2.0-dev
Install Video I/O libraries


sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
Optional - install video streaming libraries


sudo apt-get install libdc1394-22-dev libxine-dev libgstreamer0.10-dev
    libgstreamer-plugins-base0.10-dev 
Optional - install the Python development environment and the Python Numerical library


sudo apt-get install python-dev python-numpy
Optional - install the parallel code processing library (the Intel tbb library)


sudo apt-get install libtbb-dev
Optional - install the Qt dev library


sudo apt-get install libqt4-dev
Now download OpenCV 2.4.2 to wherever you want to compile the source.


mkdir xxx
cd xxx 
wget <a href="http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.2/OpenCV-2.4.2.tar.bz2">http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.2/Op...</a>
tar -xvf OpenCV-2.4.2.tar.bz2


Opret en mappe med navnet build og konfigurere OpenCV med kommandoen cmake, du må ikke glemme at lave cmake kommandoen

cd OpenCV-2.4.2
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 ..
Now compile it


make
And finally install OpenCV 2.4.2


sudo make install