使用 emgu 进行人脸识别测试时出现 'Emgu.CV.CvInvoke 错误

发布于 2024-10-15 04:04:24 字数 472 浏览 7 评论 0原文

我遇到了一点困难我可能只是缺乏一些关于如何在.net(c#express 2010)中设置项目的基本理解,但我似乎无法让这个程序工作

基本上我只是想设置一个简单的程序,它将获取网络摄像头并检查其是否有面部,如果是这样,则启动偶数(随着时间的推移,我会变得更加复杂)

我已经看到了几个使用 EMGU 进行面部识别的示例(没有一个有效) )所以我认为我正在吠叫正确的树,但是当我查看代码时,

var cap = new Capture(0);

我得到一个'Emgu.CV.CvInvoke

所以我添加了适当的(至少我认为)参考dll并添加了using语句我只是不这样做知道还能做什么。

显然我错过了一些东西。

我不确定共享整个项目的最佳方式是什么(我愿意接受建议),但是有人知道在 c#express 2010 中编译的工作示例吗?或者有包含要添加哪些文件的教程?

谢谢

I'm hitting a bit of a brick wall I may just lack some fundamental understanding about how to setup projects in .net (c# express 2010) but I just can not seem to get this program to work

Basically I'm trying to just setup a simple program that will take a web cam feed and check it for a face and if so fire off an even ( I'll get more complex as time goes on)

I've seen several examples of face recognition using EMGU (none that work) so i think I'm barking up the right tree but when I to the code

var cap = new Capture(0);

I get a 'Emgu.CV.CvInvoke

So Ive added the appropriate (at least i think) reference dll's and added the using statements I just don't know what else to do.

Clearly I'm missing something.

I'm not sure what the best way to share my entire project is (I'm open to suggestions) but does anyone know of a working example that compiles in c# express 2010? or have a tutorial that includes what files to add?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

伪心 2024-10-22 04:04:24

如果您关注 EmguCV wiki,您应该会发现运行代码没有问题:

http://www.emguCV.com/wiki/index.php/Download_And_Installation" emgu.com/wiki/index.php/Download_And_Installation

看来您尚未将 opencv dll 复制到 bin 文件夹中

[更新]
你能尝试调试这个简单的代码并告诉我你的结果是什么吗?

using Emgu.CV;
using Emgu.CV.CvEnum;
using Emgu.CV.Structure;
using Emgu.CV.UI;
using System.Drawing;

...

using (Image<Bgr, Byte> img = new Image<Bgr, byte>(400, 200, new Bgr(255, 0, 0))) 
{
   MCvFont f = new MCvFont(CvEnum.FONT.CV_FONT_HERSHEY_COMPLEX, 1.0, 1.0);

   img.Draw("Hello, Stack Overflow", ref f, new Point(10, 80), new Bgr(0, 255, 0)); 

   //Show the image using ImageViewer from Emgu.CV.UI
   ImageViewer viewer = new ImageViewer(img, "Stack Test");
   viewer.ShowDialog();
}

If you follow EmguCV wiki you should find no problem in running your code:

http://www.emgu.com/wiki/index.php/Download_And_Installation

It seems that you have not copied opencv dll's inside your bin folder

[UPDATE]
Can you try to debug this simple code and tell me what's your result?

using Emgu.CV;
using Emgu.CV.CvEnum;
using Emgu.CV.Structure;
using Emgu.CV.UI;
using System.Drawing;

...

using (Image<Bgr, Byte> img = new Image<Bgr, byte>(400, 200, new Bgr(255, 0, 0))) 
{
   MCvFont f = new MCvFont(CvEnum.FONT.CV_FONT_HERSHEY_COMPLEX, 1.0, 1.0);

   img.Draw("Hello, Stack Overflow", ref f, new Point(10, 80), new Bgr(0, 255, 0)); 

   //Show the image using ImageViewer from Emgu.CV.UI
   ImageViewer viewer = new ImageViewer(img, "Stack Test");
   viewer.ShowDialog();
}
糖粟与秋泊 2024-10-22 04:04:24

仔细检查您的 dll 后,您似乎没有复制 cvextern.dll !

After a double check of your dll's it seems that you have not copied cvextern.dll !!!

一影成城 2024-10-22 04:04:24

添加 cvextern.dll 和需要复制到输出文件夹的另一个 dll,作为 dll 的链接,然后转到该链接的属性,并在高级属性上,将 CopyToOutputDirectory 值设置为“如果较新则复制”,或“始终复制”。
要添加为链接,当您添加现有项目时,添加按钮上的右侧有一个向下的箭头,单击它会出现“添加为链接”选项。

Add the cvextern.dll, and another dlls that you need copied to the output folder, as an link to dll, then go to the properties of that link, and on the advance properties, set the CopyToOutputDirectory value to "Copy if Newer", or "Copy Always".
To add as an link, when you add an existing item, on the add Button is an arrow pointing down in the reight, click it and the "add as an link" option appears.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文