【发布时间】: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