|
Linux version installed is CentOS 6.5, select the OpenCV 2.3.1. Not very new versions. Because the installation OpenCV2.4.9 time, make the process a problem.
One: Install dependencies
Dependencies using yum install on it, you need to install the following package:
yum install cmake gcc gcc-c ++ gtk + -devel gimp-develgimp-devel-tools gimp-help-browser zlib-devel libtiff-devel libjpeg-devellibpng-devel gstreamer-devel libavc1394-devel libraw1394-devel libdc1394-develjasper-devel jasper-utils swig python libtool nasm
Two: generate make files and install
Opencv2.3.1 can download (link http://opencv.org/ this time inexplicable jump to the official website URL) on the official website, if necessary, you can contact me.
Specific steps:
(1) cdopencv2.3.1
(2) cmake -DCMAKE_BUILD_TYPE = RELEASE -D CMAKE_INSTALL_PREFIX = / usr / local -DBUILD_NEW_PYTHON_SUPPORT = NO.
// Here may suggest line44 error into Cmakelist.txt, comment out the line 44
// NOTE NO spaces behind + is essential.
(3) cmake
(4) sudo makeinstall
Three: Configure
New File /etc/ld.so.conf.d/opencv.conf
Add / usr / local / lib in the file
After Saving the configuration
sudoldconfig
// Because in ld.so.conf file contains all the files came /etc/ld.so.conf.d/*.conf
Four: the environment variable configuration
sudo vim / etc / bashrc
PKG_CONFIG_PATH = $ PKG_CONFIG_PATH: / usr / local / lib / pkgconfig
exportPKG_CONFIG_PATH
After saving execution
source / etc / bashrc
Five. Testing the installation
cd OpenCV-2.3.1 / samples / c
chmod + xbuild_all.sh
./build_all.sh
After the implementation of the compiler
./facedetectcascade="/usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_alt.xml"--scale=1.5 lena.jpg
If successfully installed, then, lena face will be a blue circle
Six: eclipe for c / c ++ and opencv small test case
(1) Eclipse for c / c ++ Download https://www.eclipse.org/downloads/ (eclipse then I knew that there are so many versions, so be strong)
After decompression can be opened with ./eclipse. Of course, before you open the machine needs to be installed on the jdk. Root user can execute:
vi / etc / profile followed by:
export JAVA_HOME = / usr / java / jdk1.8.0_20
export PATH = $ JAVA_HOME / bin /: $ PATH
exportCLASSPATH =:. $ JAVA_HOME / lib / dt.jar: $ JAVA_HOME / lib / tools.jar
And then source / etc / profile on it. Java -version can be used to test whether the installation was successful
(1) eclipse opencv configuration and simply the next, and the next is very similar to Windows
Click Project> properties> C / C ++ Build> Settings> GCCC ++ Complier> includes write:
/ Usr / local / include
/ Usr / local / include / opencv
/ Usr / local / include / opencv2
In the GCC C ++ Linker> Libraries>
Libraries: fill in the corresponding .so file. Note that libopencv_imgproc.so just fill opencv_imgproc it.
Library search path: / usr / local / lib
Seven: installed opencv2.4.9 problems
When the process make the following errors occur:
Building CXX object modules / ocl / CMakeFiles / opencv_ocl.dir / src / hog.cpp.o
c ++: Internal error: Killed (program cc1plus)
Please submit a full bug report.
See < http://bugzilla.RedHat.com/bugzilla> forinstructions.
make [2]: *** [modules / ocl / CMakeFiles / opencv_ocl.dir / src / hog.cpp.o] Error 1
make [1]: *** [modules / ocl / CMakeFiles / opencv_ocl.dir / all] Error 2
make: *** [all] Error 2
Here I search the Internet the next, may be caused by insufficient memory, because I was on a virtual machine testing. |
|
|
|