Skip to content Skip to sidebar Skip to footer

Opencv Error: Unknown Error Code -49 In Python

I am trying to learn face detection in python-3.6 using cv2. I follow the src given in a book. I have already installed opencv-python(3.2.0) by pip .xml and .jpg files are all in t

Solution 1:

I have spent lot of manhours on this small trivial issue. The real issue is that Open CV will work only with the Haarcascade XML files, which are available on the Opencv.org website and not from the github

Solution 2:

This error arises when your xml file is not a valid cascade file.

I suggest using the frontal face cascade from this link. https://github.com/opencv/opencv/tree/master/data/haarcascades

Solution 3:

I had the same error, and it was because you downloaded the model using the method of clicking the right buttom mouse and "Download as...". If you open that file, you will see that the structure of the XML is wrong. It should start with something like this:

<?xml version="1.0"?><!--
number of positive samples 3000
number of negative samples 1500
--><opencv_storage><cascadetype_id="opencv-cascade-classifier"><stageType>BOOST</stageType><featureType>LBP</featureType>

So, you should open as raw the file in the repository(https://github.com/opencv/opencv/blob/master/data/lbpcascades/lbpcascade_frontalface.xml) and copy it or download the repository using git.

Even my answer is 3 years later, I hope it helps someone.

Post a Comment for "Opencv Error: Unknown Error Code -49 In Python"