Search code examples
c#exceptionemgucvface-detection

EMGU CV Exception


I am trying to perform simple face detection using EMGUCV. But when I try to initialise the CascadeClassifier object it throws the exception

An unhandled exception of type 'System.EntryPointNotFoundException' occurred in Emgu.CV.dll

Additional information: Unable to find an entry point named 'CvCascadeClassifierCreate' in DLL 'cvextern'.

Below is my source code

` private CascadeClassifier _cascadeClassifier;

        _cascadeClassifier = new CascadeClassifier(Application.StartupPath + "/haarcascade_frontalface_default.xml");
        using (var imageFrame = _capture.QueryFrame().ToImage<Bgr, Byte>())
        {
            if (imageFrame != null)
            {
                var grayframe = imageFrame.Convert<Gray, byte>();
                var faces = _cascadeClassifier.DetectMultiScale(grayframe, 1.1, 10, Size.Empty); //the actual face detection happens here
                foreach (var face in faces)
                {
                    imageFrame.Draw(face, new Bgr(Color.BurlyWood), 3); //the detected face(s) is highlighted here using a box that is drawn around it/them

                }
            }
            imgCamUser.Image = imageFrame;
        }

`

Please how can I workaround this problem?.


Solution

  • I was using the dll EMGU.CV and EMGU.CV.Util. which were from previous versions of EMGU cv. In version 3.1 these dll are embedded in the EMGU.CV.World. I solved this problem by removing the reference to the old dll and replacing it with the new one.

    Check the release note for version 3.1 for more details.