Search code examples
c#invokeemgucv

'Emgu.CV.CvInvoke error on face recognition test using emgu


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


Solution

  • 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();
    }