找不到 OpenCV haarcascade_frontalface_alt.xml

Kev*_*291 3 c++ xml opencv

好像有很多人遇到过这个问题。我似乎无法让我的程序在当前工作目录中以及所有其他项目目录中找到 haarcascade_frontalface_alt.xml、haarcascade_frontalface_alt.xml IS。我已经尝试过“haarcascade_frontalface_alt.xml”和“C:\haarcascade_frontalface_alt.xml”都没有运气。我确保它在属性中被“解锁”,但仍然没有。有谁知道如何让 opencv 在 windows 7 x64 中查看 haarcascade_frontalface_alt.xml?非常感谢。

Adr*_*ock 6

如果您在加载特定级联时遇到问题,我会前往 OpenCV GitHub 并从存储库中获取您想要的。然后,您可以将 .xml 文件放在您想要的任何位置,然后指定相对或绝对路径(您的选择)。

OpenCV 级联 .xml 文件


The*_*ook 4

对我来说,“haarcascade_frontalface_alt.xml”位于以下目录中:C:\opencv2.4.9\sources\data\haarcascades

我使用以下命令加载它:

CascadeClassifier cascade1; cascade1.load("C:/opencv2.4.9/sources/data/haarcascades/haarcascade_frontalface_alt.xml");

当我给出 win7 x64 中文件位置的确切路径时,它似乎对我有用。

您可以检查的另一件事是您的库是否正确链接(即:对于调试/发布模式,无论您使用哪个)