cvLoadHaarClassifierCascade xml formats - old/new

asked 2014-06-14 11:38:10 -0600

Gerald gravatar image

updated 2014-06-14 11:47:47 -0600

berak gravatar image

Hi, I have downloaded a ClassifierCascade (https://github.com/geraldstanje/opencv-haar-classifier-training/blob/master/trained_classifiers/banana_classifier.xml) trained with opencv_traincascade, which uses the new xml format... how can you tell cvLoadHaarClassifierCascade that the xml file to load is a new format?

Thanks, Gerald

edit retag flag offensive close merge delete

Comments

cvLoadHaarClassifierCascade can only load the old format.

you should avoid the old cv* functions anyway, and use the c++ api, so: CascadeClassifier::load()

berak gravatar imageberak ( 2014-06-14 11:45:54 -0600 )edit

why is the feature only available with c++ and not in the c api? is there a tool to convert between both formats?

Gerald gravatar imageGerald ( 2014-06-15 05:34:31 -0600 )edit

honestly, better change your code.

berak gravatar imageberak ( 2014-06-15 05:37:44 -0600 )edit

i use the golang wrapper for opencv, not sure how i could use c++ code... https://github.com/lazywei/go-opencv any idea?

Gerald gravatar imageGerald ( 2014-06-15 05:47:28 -0600 )edit

wow, did not knew that ;) i'll look into it !

unfortunately it builds upon opencv 1.0. like 10 years ago.

berak gravatar imageberak ( 2014-06-15 05:51:43 -0600 )edit

join #go-nuts on freenode irc? contribute the go-opencv project? :)

Gerald gravatar imageGerald ( 2014-06-15 05:52:51 -0600 )edit

is there a way to port that feature to go-opencv? or is it possible to implement for the opencv c api?

Gerald gravatar imageGerald ( 2014-06-15 05:57:04 -0600 )edit

they switched to c++ in 2010 already, and the c-api is definitely being phased out

imho, to wrap the c++ api, one would have to do a c-wrapper around the c++ api again, and link / feed that into cgo. i even tried something similar, but did not get far ... (and yes, the #go-nuts guys were nice and helpful as always ;)

the major pain point whith go was for me, that you still have to do manual memory management, i'll probably restart, if i find a way to trigger all the defer blah.release() statements from within the cgo wrappers, but that's future ;)

also, cgo generates a lot of indirections / boiler plate code under the hood, really disgusting !

berak gravatar imageberak ( 2014-06-15 06:44:30 -0600 )edit

is there a way to convert between both xml formats?

as i see the following golang wrapper is around the opencv c api? https://github.com/lazywei/go-opencv ... just join the go-opencv guys and constribute? :)

Gerald gravatar imageGerald ( 2014-06-15 07:20:28 -0600 )edit

link hidden above ^^

and yes, lazywei's wrapper is using the c-api directly. unfortunately cgo does not like c++ at all, you can't import c++ functions/classes without further indirection.

(oh, and no, afaik there's no such conversion tool)

berak gravatar imageberak ( 2014-06-15 07:31:43 -0600 )edit