无法加载在OpenCV中haarcascadeshaarcascade.xml加载、OpenCV、xml、haarcascadeshaarcascade

2023-09-04 06:14:29 作者:wifi是我爱人%

我试着在Android中使用OpenCV的人脸检测,但我无法加载对象检测XML文件。

Im trying face detection using opencv in android but I unable to load the object detection xml files.

在code如下,

......

static CvHaarClassifierCascade* cascade = 0;
  CvMemStorage* storage = 0;
  LOGI("before haarcascade");  

if (!cascade) {
    const char* file = "/Users/Downloads/OpenCV-

2.2.0/data/haarcascadeshaarcascade_frontalface_alt.xml";
    cascade = (CvHaarClassifierCascade *)cvLoad(file, 0, 0, 0);
    storage = cvCreateMemStorage(0);
  }  

if(cascade)
      LOGI("xml loaded");
  else
          LOGI("unable to load the xml");

......

......

在它的logcat显示,无法加载XML。

In logcat it showing that unable to load the xml.

如何加载XML ??

How to load the xml??

请人帮助我。

谢谢, 斯里尼瓦桑

推荐答案

蠢问题...但该文件确实存在,不是吗?

Daft question... but the file does exist doesn't it?

如果是code运行在Android设备上,但主机上的文件是否存在键(Mac OS)的工作站,你的运气了!

If that code runs on your android device, but the file exists on the host (Mac OS) workstation you're out of luck!