Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

There are two applications to train cascade classifiers in OpenCV now, see http://answers.opencv.org/question/757/haartraining-vs-traincascade-object-detection/#759.

c-example-convert_cascade is for cascades trained by haartraining application and it does not support a format of cascades trained by traincascade application. This is why you got the exception.

For the conversion in your case you should run opencv_traincascade again with the same "-data" but set "-numStages 6". The application will load the trained stages, realize that there is required number of stages, write the result cascade in xml and finish a work.

Please also keep in mind that when you kill the application the last stage*.xml can be broken (partially saved). In this case you'll get an exception with the suggested conversion too because the broken xml can not be read. You can just remove the last stage xml or set "-numStages 5".