I’m trying to load a haar classifier .xml file with ofxCvHaarFinder, but I get the following error:
OpenCV Error: Unspecified error (The node does not represent a user object (unknown type?)) in cvRead, file /Users/danielrosser/Documents/openFrameworks/scripts/apothecary/build/opencv/modules/core/src/persistence.cpp, line 4991
libc++abi.dylib: terminating with uncaught exception of type cv::Exception: /Users/danielrosser/Documents/openFrameworks/scripts/apothecary/build/opencv/modules/core/src/persistence.cpp:4991: error: (-2) The node does not represent a user object (unknown type?) in function cvRead
Thing is, for some .xml files it just works fine, but for some others (sadly, the ones I wanna use) it gives the error.
Anyone knows how to solve this?
Thanks a million in advance!
This looks more about a Opencv issue and there are references in Internet about it.
Which version of OF (Opencv) are you using ? And which cascade XML files are not working for you. That could be nice to know.
Ive checked a bit in google:
> persistence.cpp:4991: error: (-2) The node does not represent a user object (unknown type?) in function cvRead
And it seems that issue was resolved for OpenCV 2.4.9. An extra comment about XML format used seems to point to a new way to Tag those XML
Additionally, a newly trained “lost” cascade.xml may be manually edited with this specific tag to enable backward compatibility for GPU examples etc. I am regression testing the cascade, and so far it appears to behave itself amicably.
Might be interesting to check differences between those cascade xmls…
I am using the latest ofxOpenCV version.
I tried with some of the potential solutions I found on google but no success, including those changes suggested on the link you posted (perhaps I didn’t get to implement the changes correctly)
I attach screen capture of the top part of the two cascade files: the one that works (I took it from the OpenCV library) and the one that doesn’t (generated by me using OpenCV haartraining). There’s evident differences between them, but as I’m not an expert on the matter I cannot understand what’s wrong and what’s not. Do you find anything weird?
Thanks for the help!
Last Opencv in OF 0.9 it seems to be 2.4.9.
You should ask this directly to the Opencv forum, just like here but there ^^.
Please, Left us a link about your question there and updload here this wrong haar file if you can and which feature detection its supoused to be.
As a heads up, OpenCV 3.1 is now in the the github version of OF following the merging of this PR. If you need a newer version you can try that:
I also have the same problem. I’ve been trying to use my own haar classifier but i got this error instead:
OpenCV Error: Unspecified error (Trees node is not a valid sequence. (stage 0)) in icvReadHaarClassifier, file …\modules\objdetect\src\haar.cpp, line 2101
I assume it meant that it doesn’t recognize the way the xml file was structured (it’s quite evident in the photos posted above by ferranaltarriba). If the problem occurred because of the opencv version like what mattfelsen said, I hope opencv 3.1 will be included in the next version of OF. Otherwise, any advise on solving this would be greatly appreciated.
Oops, nevermind, please disregard my post. I’ve figure out how to convert the xml to old format. Everything worked fine now.
May be you could comment here too how you modified
Before you train the classifier, make sure to add this flag called -baseFormatSave. It will convert the haar cascades to legacy format. Also, add type_id=“opencv-haar-classifier” in the xml tag to ensure compatibility, for example:
<cascade type_id="opencv-haar-classifier"> ... </cascade>