It is recommended that you do not install more than 3.0 versions, but 2.4.10 does not support GPU, true TM pit Dad, should be able to use the 2.4.12 version. I was cuda8.0+opencv2.4.13.
1. Download the opencv2.4.12 version first
Http://opencv.org/downloads.html
2. Install dependent packages
SudoApt-getInstallLibopencv-devBuild-essentialCheckinstallCMakePkg-configYasmLibtiff4-devLibjpeg-devLibjasper-devLibavcodec-devLibavformat-devLibswscale-devLibdc1394-22-devLibxine-devLibgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev Python-dev python-numpy libtbb-dev libqt4-dev libgtk2.0-dev Span class= "Hljs-selector-tag" >libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev Libxvidcore-dev x264 v4l-utils
3. Build OpenCV
CD OpencvmkdirReleasecdReleasecmake-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-d enable_fast_math= 1-d cuda_fast_math=1-d with_cublas=1:
4. Check the CMake output to ensure that Cuda and Cublas options are turned on
-- Use Cuda: YES (ver 6.5)-- Use OpenCL: YES---- NVIDIA CUDA-- Use CUFFT: YES-- Use CUBLAS: YES-- USE NVCUVID: NO-- NVIDIA GPU arch: 11 12 13 20 21 30 35-- NVIDIA PTX archs: 30-- Use fast math: YES
5, if any, start to install OpenCV
make -j8 //建议多线程编译.单线程超慢sudo make install
6. Configure Environment variables
echo ‘/usr/local/lib‘ | sudo tee -a /etc/ld.so.conf.d/opencv.confsudo ldconfigprintf ‘# OpenCV\nPKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig\nexport PKG_CONFIG_PATH\n‘ >> ~/.bashrcsource ~/.bashrc
If you want to delete OpenCV, you can do it directly under this directory
make uninstall
View OpenCV version
--modversion opencv
For problem solving: The Spyder does not support OPENCV module code hints
1. Locate the module_completion.py
file, 2.25 and before the version is located on the Python目录/Lib/site-packages/spyderlib/utils/
path, 2.25 after the version is located Python目录/Lib/site-packages/spyderlib/utils/introspection/
. Add CV and Cv2 to the module_completion.py
mods variable on line No. 274 of the file to save the file:
2. After the modification, delete the files in the same directory module_completion.pyc
, so that the modified module_completion.py
file will take effect.
3. Go to the user directory Users/用户名/.spyder2/db
and delete the files in the directory submodules
.
4. Restart Spyder,enjoy it.
Ubuntu under OPENCV (Turn)