Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV Error: Unknown error code -49 (persistence.cpp error=

Hi,

i tried use opencv and detect face, but this pyhton code given to this cascade error: i was downloaded cascades files from this link.

https://github.com/opencv/opencv/tree/master/data/haarcascades

where i was wrong? thanks.

import cv2 as cv
face_cascade = cv.CascadeClassifier('haarcascade_frontalface_default.xml')
eye_cascade = cv.CascadeClassifier('haarcascade_eye.xml')
img = cv.imread('X.JPG')
gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)

OpenCV Error: Unknown error code -49 (Input file is empty) in cvOpenFileStorage, file C:\projects\opencv-python\opencv\modules\core\src\persistence.cpp, line 4484 cv2.error: C:\projects\opencv-python\opencv\modules\core\src\persistence.cpp:4484: error: (-49) Input file is empty in function cvOpenFileStorage

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:/opencv/x.py", line 3, in <module> face_cascade = cv.CascadeClassifier('haarcascade_frontalface_default.xml') SystemError: <class 'cv2.cascadeclassifier'=""> returned a result with an error set