C++ 无法加载lbpcascade_profile.xml

C++ 无法加载lbpcascade_profile.xml,c++,opencv,C++,Opencv,我正在尝试加载lbpcascade_profileface.xml CascadeClassifier cad; cad.load("C:/opencv/data/lbpcascades/lbpcascade_profileface.xml"); 出现以下错误: OpenCV Error: Parsing error (C:/opencv/data/lbpcascades/lbpcascade_profileface.x ml(1): Comments are not allowed here

我正在尝试加载lbpcascade_profileface.xml

CascadeClassifier cad;
cad.load("C:/opencv/data/lbpcascades/lbpcascade_profileface.xml");
出现以下错误:

OpenCV Error: Parsing error (C:/opencv/data/lbpcascades/lbpcascade_profileface.x
ml(1): Comments are not allowed here) in unknown function, file ..\..\..\src\ope
ncv\modules\core\src\persistence.cpp, line 1818

怎么办

好的,找到了解决方法。我不得不删除xml文件顶部的注释。现在它起作用了。但我不知道他们为什么添加了无法解析的注释。

我遇到了同样的问题,似乎注释放错了位置。如果要保留注释,只需将此行移到注释上方:

<?xml version="1.0"?>