How do I create a custom haar classifier?
OpenCV provides two utility commands createsamples.exe
and haartraining.exe
, which can generate xml files used by Haar Classifiers. That is, with the xml file outputted from haartraining.exe
, you can directly use the face detection sample with your xml file to detect any customized objects.
About the detailed procedures to use the commands, you may consult Page 513-516 in the book "Learning OpenCV", or this tutorial.
About the internal mechanism of how the classifier works, you may consult the paper "Rapid Object Detection using a Boosted Cascade of Simple Features", which has been cited 5500+ times.
Related videos on Youtube
CLJ
Updated on June 04, 2022Comments
-
CLJ almost 2 years
I am struggling to create a custom haar classifier. I have found a couple tutorials on the web, but they do not specify which version of opencv they are using. What I need is a very concise and simplified example of the steps that are required, along with a simple dataset of images. I also need to know the opencv version and the OS platform so I can get it running. I have tried a matrix of opencv versions on both windows and linux and I have run into memory error after memory error. I would like to start with a known good set of data and simple commands before expanding it to fit my problem.
Thanks for your help, Chris
-
CLJ over 12 yearsThanks for confirming that I am on the right track, but I am really wondering if someone could post the commands and args in order and with accompanying images. That would be helpful!
-
grapeot over 12 yearsPlease check the tutorial I provided, whose link is again posted here. You'll find all the sample images (including positive/negative samples), command usage, and sample command in it. Hope this is helpful.
-
CLJ over 12 yearsI did not realize the sample images were included. My apologies. I will check that out and report back.
-
CLJ about 12 yearsGood advice, grapeot! I used the info from the book and I was finally able to get it to work. Thanks!