【问题标题】:Program doesn't find file (EmguCV)程序找不到文件(EmguCV)
【发布时间】:2017-02-28 23:42:12
【问题描述】:

我下载了 EmguCV 的示例。

我尝试将图像从默认更改为我的图像

默认是这样的

 static void Run()
  {
     var image = new Mat("lena.jpg", LoadImageType.Color); //Read the files as an 8-bit Bgr image  
     long detectionTime;
     List<Rectangle> faces = new List<Rectangle>();
     List<Rectangle> eyes = new List<Rectangle>();

     //The cuda cascade classifier doesn't seem to be able to load "haarcascade_frontalface_default.xml" file in this release
     //disabling CUDA module for now
     bool tryUseCuda = false;

     DetectFace.Detect(
       image, "haarcascade_frontalface_default.xml", "haarcascade_eye.xml", 
       faces, eyes,
       tryUseCuda,
       out detectionTime);

     foreach (Rectangle face in faces)
        CvInvoke.Rectangle(image, face, new Bgr(Color.Green).MCvScalar, 2);
     foreach (Rectangle eye in eyes)
        CvInvoke.Rectangle(image, eye, new Bgr(Color.Aquamarine).MCvScalar, 2);

     //display the image 
     ImageViewer.Show(image, String.Format(
        "Completed face and eye detection using {0} in {1} milliseconds", 
        (tryUseCuda && CudaInvoke.HasCuda) ? "GPU"
        : CvInvoke.UseOpenCL ? "OpenCL" 
        : "CPU",
        detectionTime));
  }

} }

我将更改“lena.jpg”添加到我的图像 - “oleg.jpg”。

我将此图片添加到项目文件夹中

通过添加现有文件 - oleg.jpg。

但是当我运行我的程序时,它说'文件 oleg.jpg 不存在'

问题出在哪里?

谢谢你的帮助

【问题讨论】:

  • 使用完整路径,如f:/myfile/haar/haarcascade_frontalface_default.xml 和其他文件也
  • 谢谢它的作品)

标签: c# visual-studio opencv emgucv


【解决方案1】:

它可以将您的图像文件放在 Bin 地毯上。

问候。

【讨论】:

    猜你喜欢
    • 2012-09-17
    • 1970-01-01
    • 2023-03-12
    • 1970-01-01
    • 2017-07-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-28
    相关资源
    最近更新 更多