A
A
artshelom2018-12-23 12:10:02
C++ / C#
artshelom, 2018-12-23 12:10:02

When starting OpenCV, it writes an Emgu.CV.Util.CvException error. How to fix??

I downloaded the XML file from Github OpenCV , but it still writes an error when starting

Emgu.CV.Util.CvException: "OpenCV: C:\User\...\haarcascade_frontalface_alt.xml(1): Valid XML should start with '<?xml ...?>'"

Although everything is original and made according to the instructions. How to fix?
Here is the code:
using Emgu.CV;
using Emgu.Util;
using Emgu.CV.Structure;
 HaarCascade faceCascade = new HaarCascade("haarcascade_frontalface_alt.xml");
            Image<Bgr, Byte> image = _capture.QueryFrame();
            Image<Gray,double> IntegralImage = image.Convert<Gray, double>();   //Интегральное изображение, строим средствами OpenCV
        
            var Face = IntegralImage.DetectHaarCascade(faceCascade)[0];
            foreach (var face in Face)
            {
                image.Draw(face.rect, new Bgr(255, 255, 255), 10);
            }
            VideoWindow.Image = image;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2018-12-24
@xaoc80

Can you view your XML with a viewer and start posting it here? If you download from github directly, then html tags can get there and it will be invalid.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question