C++ OpenCV Facedetect样本不工作

C++ OpenCV Facedetect样本不工作,c++,opencv,face-detection,C++,Opencv,Face Detection,我试图使用OpenCV运行Facedetect示例,我编译了build_all.sh文件中的代码 然后我用 sudo ./facedetect --cascade="../../data/haarcascades/haarcascade_frontalface_alt.xml" --nested-cascade="../../data/haarcascades/haarcascade_eye.xml" --scale=1.3 lena.jpg 显示了一些说明 This program demo

我试图使用OpenCV运行Facedetect示例,我编译了build_all.sh文件中的代码

然后我用

sudo ./facedetect --cascade="../../data/haarcascades/haarcascade_frontalface_alt.xml" --nested-cascade="../../data/haarcascades/haarcascade_eye.xml" --scale=1.3 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 2.4.8

Processing 1 --cascade=../../data/haarcascades/haarcascade_frontalface_alt.xml
  from which we have cascadeName= ../../data/haarcascades/haarcascade_frontalface_alt.xml
Processing 2 --nested-cascade=../../data/haarcascades/haarcascade_eye.xml
Processing 3 --scale=1.3
 from which we read scale = 1.3
Processing 4 lena.jpg
已经安装了libgtk2.0-dev和pkg-config包。你们有什么建议吗

已解决:

正如Berak所建议的,我从其主目录重新编译了opencv,其中包含:

cmake -D CMAKE_BUILD_TYPE=RELEASE ..
make
sudo make install

缺少的软件包必须在编译opencv库时安装,而不是在编译程序时安装。换句话说,您可能必须重新编译opencv才能使其工作。避免愚蠢的包管理器,获取src代码并重新编译。
cmake -D CMAKE_BUILD_TYPE=RELEASE ..
make
sudo make install