ubuntu16.04安装opencv2.4.9失败一次后成功

按照网上教程http://blog.csdn.net/w371500241/article/details/53449815安装后,运行sample里的facedetect程序时,出错,

OpenCVError: Unspecified error (The function is notimplemented. Rebuild thelibrary with Windows, GTK+ 2.x or Carbonsupport. If you are on Ubuntuor Debian, install libgtk2.0-dev andpkg-config, then re-run cmake orconfigure script) incvNamedWindow,file/home/aborn/software/OpenCV-3.0.0/modules/highgui/src/

window.cpp,line …



后经过搜索

找到如下解决方案



网上给的解释是:GTK+2.x要先于OpenCV安装(Youshould remove the currentinstallation of opencv from your system;rebuild your opencvlib



解决方法:

1.卸载opencv

直接到opencv解压目录把解压出的opencv包删掉



2.查看没安装的文件,没装的装上

安装命令:

sudoapt-get install build-essential cmake libgtk2.0-devpkg-configlibavcodec-dev libavformat-devlibswscale-dev

安装需要的包:

$sudo apt-get install build-essential

$sudo apt-get install cmake git libgtk2.0-dev pkg-configlibavcodec-dev libavformat-dev libswscale-dev

可选:也安装上

$sudo apt-get install python-dev python-numpy libtbb2 libtbb-devlibjpeg-dev libpng-dev libtiff-devlibjasper-dev libdc1394-22-dev

其中安装上述包中有未识别的名字,把中间加上空格,有可能少空格,两个名字连在一起了。

3.重新安装opencv并进行测试(2.4.9用的是可用)

$unzip opencv-3.0.0.zip

$ cd opencv-3.0.0

$mkdir build

$cd build

$cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local../

$make

$sudo make install

至此OpenCV就可以使用了

4.配置

1)

$sudo gedit /etc/ld.so.conf.d/opencv.conf

打开的文档中添加:/usr/local/lib,保存退出

$sudo ldconfig

2)

$sudo gedit /etc/bash.bashrc

打开的文档中添加:

PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig

exportPKG_CONFIG_PATH

保存退出

5.测试:

进入samplec目录下,查看可运行图片即可

cd/opencv-2.4.9/samples/c

chmod+x build_all.sh

./build_all.sh

./facedetectlena.jpg



失败后先参照的网站http://blog.sina.com.cn/s/blog_96b836170102wadb.html

重新安装opencv参照的网站http://blog.csdn.net/qingyanyichen/article/details/51621982

可选包也一并安装上。


你可能感兴趣的:(嵌入式)