Solved XML file whose path is specified in qrc file is not loaded
CascadeClassifier faceClassifier; CascadeClassifier eyeClassifier; Q_ASSERT(faceClassifier.load(":/resources/haarcascade_frontalface_default.xml")); Q_ASSERT(eyeClassifier.load(":/resources/haarcascade_eye.xml"));
This is a simple OpenCV code and load() function is blocked by Q_ASSERT. (which means it can not find the xml file)
<!DOCTYPE RCC><RCC version="1.0"> <qresource> <file>resources/icon.ico</file> <file>resources/MaestroTimes.ttf</file> <file>resources/haarcascade_eye.xml</file> <file>resources/haarcascade_frontalface_default.xml</file> </qresource> </RCC>
This is the qrc file
What XML parser are you using ?
The Qt one ?
Also please show code for
for test, please delete whole build folder so tmp files are 100% surely deleted.
then rebuild all.
@mrjj CascadeClassifier::load is not a function I made, but a function in OpenCV module.
I tried deleting the build folder, but it doesn't work either
@Aaron-Kim Does OpenCV know anything about Qt resource files? If not this can't work. You will need to copy the XML file from the resource to some temporary location.
@jsulm Yes I guess that OpenCV does not support it. thanks!