我正在使用 Ubuntu 14.04,OpenCV 3.0.0,这是安装后尝试使用我的 opencv 库的命令和错误列表
linaro@linaro-nano:~/opencv/samples/cpp$ ./cpp-example-facedetect lena.jpg
This program demonstrates the cascade recognizer. Now you can use Haar or LBP features.
This classifier can recognize many kinds of rigid objects, once the appropriate classifier is trained.
It's most known use is for faces.
Usage:
./facedetect [--cascade=<cascade_path> this is the primary trained classifier such as frontal face]
[--nested-cascade[=nested_cascade_path this an optional secondary classifier such as eyes]]
[--scale=<image scale greater or equal to 1, try 1.3 for example>]
[--try-flip]
[filename|camera_index]
see facedetect.cmd for one call:
./facedetect --cascade="../../data/haarcascades/haarcascade_frontalface_alt.xml" --nested-cascade="../../data/haarcascades/haarcascade_eye.xml" --scale=1.3
During execution:
Hit any key to quit.
Using OpenCV version 3.0.0-dev
Processing 1 lena.jpg
Capture from AVI didn't work
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 /home/linaro/nourelhak/opencv/modules/highgui/src/window.cpp, line 522
terminate called after throwing an instance of 'cv::Exception'
what(): /home/linaro/opencv/modules/highgui/src/window.cpp:522: error: (-2) 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 function cvNamedWindow
Aborted
linaro@linaro-nano:~opencv/samples/cpp$ sudo apt-get install cmake git libgtk2.0-dev pkg-config
Reading package lists... Done
Building dependency tree
Reading state information... Done
cmake is already the newest version.
git is already the newest version.
pkg-config is already the newest version.
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libgtk2.0-dev : Depends: libpango1.0-dev (>= 1.20) but it is not going to be installed
Depends: libcairo2-dev (>= 1.6.4-6.1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
linaro@linaro-nano:~/opencv/samples/cpp$ sudo apt-get install libgtk2.0-dev libpango1-dev libcairo2-dev libfontconfig1-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libpango1-dev
linaro@linaro-nano:~/opencv/samples/cpp$ apt-cache policy libfontconfig1
libfontconfig1:
Installed: 2.11.0-0ubuntu4
Candidate: 2.11.0-0ubuntu4
Version table:
*** 2.11.0-0ubuntu4 0
500 http://ports.ubuntu.com/ubuntu-ports/ trusty/main armhf Packages
100 /var/lib/dpkg/status
linaro@linaro-nano:~/opencv/samples/cpp$ apt-cache madison libfontconfig1
libfontconfig1 | 2.11.0-0ubuntu4 | http://ports.ubuntu.com/ubuntu-ports/ trusty/main armhf Packages
fontconfig | 2.11.0-0ubuntu4 | http://ports.ubuntu.com/ubuntu-ports/ trusty/main Sources
linaro@linaro-nano:~/nourelhak/opencv/samples/cpp$ sudo apt-get install libpango1.0-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libpango1.0-dev : Depends: libfreetype6-dev but it is not going to be installed
Depends: libxft-dev but it is not going to be installed
Depends: libfontconfig1-dev (>= 2.10.91) but it is not going to be installed
Depends: libcairo2-dev (>= 1.12.10) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
linaro@linaro-nano:~/nourelhak/opencv/samples/cpp$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
linaro@linaro-nano:~/nourelhak/opencv/samples/cpp$ sudo apt-get install libgtk2.0-dev libpango1-dev libcairo2-dev libfontconfig1-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libpango1-dev
linaro@linaro-nano:~/nourelhak/opencv/samples/cpp$ sudo apt-get install libgtk2.0-dev libpango1.0-dev libcairo2-dev libfontconfig1-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libcairo2-dev : Depends: libfreetype6-dev (>= 2.1.10) but it is not going to be installed
libfontconfig1-dev : Depends: libfreetype6-dev (>= 2.1.7) but it is not going to be installed
libpango1.0-dev : Depends: libfreetype6-dev but it is not going to be installed
Depends: libxft-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
linaro@linaro-nano:~/nourelhak/opencv/samples/cpp$
我从一开始就无法安装 libgtk2.0-dev,但我想我可以使用 aptitude 而不是 apt-get 来强制安装它
答案1
从您的输出中我看到的错误是:
E:无法找到软件包 libpango1-dev
没有名为的包libpango1-dev
,而是libpango1.0-dev
要安装libpango1.0-dev
,请使用:
sudo apt-get install libpango1.0-dev`
答案2
运行命令
sudo apt-get -f install
sudo apt-get install libgtk2.0-dev libpango1.0-dev libcairo2-dev libfontconfig1-dev
它将安装损坏的依赖项并尝试此操作关联
编辑:尝试这个命令
sudo aptitude install libpango1.0-0=1.29.3+git20110916-0ubuntu1 plymouth-x11=0.8.2-2ubuntu28 libpango1.0-dev=1.29.3+git20110916-0ubuntu1 gir1.2-pango-1.0=1.29.3+git20110916-0ubuntu1
希望它能起作用