Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/294.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 程序不';找不到文件(EmguCV)_C#_Visual Studio_Opencv_Emgucv - Fatal编程技术网

C# 程序不';找不到文件(EmguCV)

C# 程序不';找不到文件(EmguCV),c#,visual-studio,opencv,emgucv,C#,Visual Studio,Opencv,Emgucv,我下载了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>(

我下载了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));
  }
static void Run()
{
var image=new Mat(“lena.jpg”,LoadImageType.Color);//将文件作为8位Bgr图像读取
检测时间长;
列表面=新列表();
列表眼睛=新列表();
//cuda级联分类器似乎无法在此版本中加载“haarcascade_frontalface_default.xml”文件
//暂时禁用CUDA模块
bool tryUseCuda=false;
探测面,探测(
图像,“haarcascade_frontalface_default.xml”,“haarcascade_eye.xml”,
脸,眼睛,
tryUseCuda,
超出检测时间);
foreach(面中的矩形面)
矩形(图像,面,新Bgr(颜色.绿色).MCvScalar,2);
foreach(眼睛中的矩形眼睛)
矩形(图像,眼睛,新Bgr(颜色.海蓝色).MCvScalar,2);
//显示图像
ImageViewer.Show(图像,字符串,格式(
“使用{0}在{1}毫秒内完成人脸和眼睛检测”,
(tryUseCuda&&CudaInvoke.HasCuda)?“GPU”
:CvInvoke.UseOpenCL?“OpenCL”
:“CPU”,
检测时间);
}
} }

我在我的图片中添加了“lena.jpg”的变化——“oleg.jpg”

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

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

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

问题在哪里


感谢您的帮助

将图像文件放在垃圾箱地毯上很有效


注意。

使用完整的路径,如
f:/myfile/haar/haarcascade\u frontalface\u default.xml
和其他文件(也适用于银行的it工作)