ubuntu 14.04上安装opencv 2.4.13

1.下载然后解压安装压缩包

下载网站:http://opencv.org/downloads.html
  1. unzip opencv-2.4.13.zip  

2. 进入刚解压的文件夹,建立release文件夹

  1. cd opencv-2.4.13  
  2. mkdir release  

3. 安装一下必须的依赖库

[compiler] sudo apt-get install build-essential
[required] sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
[optional] sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev


4. 进入release文件夹,用cmake编译OpenCV的源码,把lib安装到/usr/local目录下
  1. cd release  

  1. cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
(注意:必须加上 -D BUILD_TIFF=ON,否则编译caffe的时候会有这样的错误
/usr/lib/libopencv_highgui.so.2.4: undefined reference to XXXXXX

5. 安装

  1. make
    sudo make install


经过上面的流程,这样就可以在eclipse里或者qtcreator里用opencv了。 不过要配置号相应的路径和lib文件。
 
python下查看opencv版本信息:
ubuntu 14.04上安装opencv 2.4.13_第1张图片
 
示例代码
对opencv的sample进行编译并运行
cd opencv2-4-13-source/samples/c
./build_all.sh
./facedetect --cascade="/usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_alt.xml" --scale=1.5 lena.jpg 
 
终端显示:
 
结果显示:
 


错误:

如果在cmake时出现

CMake opencv 2.4.13时Error at /usr/share/cmake-2.8/Modules/FindQt4.cmake:1386 (message):   Found unsuitable Qt version "" from NOTFOUND, this code requires Qt 4.x


一、提示“CMAKE_CXX_COMPILER-NOTFOUND ”。

具体形式:

Check for working CXX compiler: CMAKE_CXX_COMPILER-NOTFOUND 

CMake Error: your CXX compiler: "CMAKE_CXX_COMPILER-NOTFOUND" was not found.

Please set CMAKE_CXX_COMPILER to a valid compiler path or name.

解决方法:

sudo apt-get install g++

二、提示:

CMake Error at /usr/share/cmake-2.6/Modules/FindKDE4.cmake:84 (MESSAGE):                 

ERROR: cmake/modules/FindKDE4Internal.cmake not found in                               

/home/mm/.kde/share/apps;/usr/share/kde4/apps

解决方法:

sudo apt-get install kdelibs5-dev


你可能感兴趣的:(deep,learning-paper)