How to Install OpenCV into Hackberry-Linux:
After you have got Linux running on Hackberry if you wanna install OpenCV then follow the steps below :
You will have OpenCV installed with Qt and Python.
To test opencv with Qt :
After you have got Linux running on Hackberry if you wanna install OpenCV then follow the steps below :
- Open the Terminal an type: " sudo apt-get update ", and " sudo apt-get upgrade ".
- Then type :" sudo apt-get install build-essential libgtk2.0-dev libjpeg-dev libtiff4-dev libjasper-dev libopenexr-dev cmake python-dev python-numpy python-tk libeigen2-dev yasm libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev libqt4-dev libqt4-opengl-dev sphinx-common texlive-latex-extra libv4l-dev libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev "
- The above command install all the dependency files as well as "Python". If you don't want "Python" , you can remove "python-dev python-numpy python-tk " from the above command.
- After the above dependencies have gotten installed type the command : " wget http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.4/OpenCV-2.4.4-beta.tar.bz2 " to get the OpenCV-2.4.4 version. Or you can simply go to the OpenCV homepage and download the Linux version of OpenCV.
- Next type : " tar -xvf OpenCV-2.4.4.tar.bz2 " to un-tar the Opencv files .
- Type: " cd OpenCV-2.4.4 "
- Create a new folder named "build" inside "OpenCV-2.4.4" Directory or type the command : " mkdir build "
- Now type " cd build".
- To build the OpenCV files with Cmake type the command : " cmake -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 .. "
- The above command configures the files for installing Python examples as well as c-examples, you can remove the unwanted files by removing the corresponding command parameter.
- Now type " make " . {Warning: This command builds the OpenCV files for the Linux-os , It will take more than 3-hours continuous, so be patient until it completes to 100%(ignore any warnings). If in case you attempt to restart the system then you need to rerun the make command once again if it is not 100% complete.}
- After the "make" command completes to 100% , type : " sudo make install ". {Warning: This command installs the OpenCV build files for the Linux-os , It will also take more than 3-hours continuous, so be patient until it completes to 100%(ignore any warnings). If in case you attempt to restart the system then you need to rerun the make command once again if it is not 100% complete.}
- After the " sudo make install" commands completes to 100% type " sudo your-text-editor /etc/ld.so.conf.d/opencv.conf " ( your-text-editor can be replaced by any kind of the text editor app found in your os, for eg if you are having a LXDE-Linux then the text editor will be leafpad, so the command would be : sudo leafpad /etc/ld.so.conf.d/opencv.conf).
- The above command opens a file named 'opencv.conf', add the following lines to the file and save it: /usr/local/lib .
- Now run : " sudo ldconfig " to configure the installed library.
- Then type the command : " sudo your-text-editor /etc/bash.bashrc " . This command opens a file named ' bash.bashrc '.
- Add the following lines to the end of the ' bash.bashrc ' file and save it: PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
You will have OpenCV installed with Qt and Python.
To test opencv with Qt :
- Type the command in the terminal as : " cd ~/OpenCV-2.4.4/samples/c ".
- Then type : " chmod +x build_all.sh ", and " ./build_all.sh ".
- Now run an example by typing : " ./facedetect --cascade="/usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_alt.xml" --scale=1.5 lena.jpg "
Hah... the photo of Lenna .. niece touch
ReplyDelete