非常重要:
1.先安装 libgtk2.0-dev 和
pkg-config,,否则后期编译运行程序会出现类似如下的问题:
OpenCV Error: Unspecified error (The function is not implemented.
Rebuild the library with Windows, GTK+ 2.x or Carbon support. If
you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config,
then re-run cmake or configure script) in cvNamedWindow, file
/usr/local/opencv/OpenCV-2.0.0/src/highgui/window.cpp, line
100
terminate called after throwing an instance of 'cv::Exception'
我深受其害……
2.cd 命令进入相应的下载目录。依次运行下列命令
1
2
3.终端运行
1
2
3
4
依次运行
1
2
此时编译成功。
5
现在需要配置必要的库。运行 sudo
gedit
/etc/ld.so.conf.d/opencv.conf
添加这句命令到文件中,/usr/
local
/lib
,文件或许是空的,不影响。
6
运行此命令 sudo
ldconfig
7
现在运行这条命令 sudo
gedit
/etc/bash
.bashrc,添加下面两行到文件的末尾并保存。
1
2