OpenCV haar training for static image

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 02:26:21
George Profenza

As @Neon22 mentioned, great tutorial. From my experience, it's quite a lengthy process(collecting positive and negative samples, training, generating haar cascade), but then again maybe I was doing it wrong.

For detecting cards, it might be useful to have a look at OpenCV SURF as well.

Check out toxi's video.

Funny you mention cards, Eugene Zatepyakin did an actionscript port called ASSURF:

amit

If you are interested in making your xml file then this may help http://nayakamitarup.blogspot.in/2011/07/how-to-make-your-own-haar-trained-xml.html

But if you are interested in making it rotation invariant, then surf seems like a better option. http://nayakamitarup.blogspot.in/2011/06/2d-ar-using-surf-based-application-of.html

Try this tutorial instead. http://cgi.cse.unsw.edu.au/~cs4411/wiki/index.php?title=OpenCV_Guide

but the tutorial you identify is quite good. I used it to get my haar classifier sorted out. The facedetect sample code included in opencv 2.1 distribution is a good example for checking the resulting xml file. (I use python)

I found several problems with the supplied help applicatoins. 1. createsamples will not read a description file with more than 8 samples from the same image - manually break your relationship file up into several lines with no more than 8 rectangles per image.

The haar training would not continue if my .vec file was made with images of width and height > 24 pixels

Main issue with haar appears to be that it is not invariant to scale and you need thousands of test images - which is what the createsamples program will help you to do with single images but will not if you have a description file of individual sample images. Hence the tutorials extra code to allow createsamples to be called many times and for the resulting vec files to be merged into a single super vec file.

You can refer :
http://opencv-hub.blogspot.in/2016/03/how-to-train-your-own-opencv-haar-classifier-haar-training-train-cascade.html
for making your own haar-cascade xml file.
This OpenCV Tutorial is on C++ where in they have mentioned in detail the methods of Haar Training.Also Note that Haar is not rotation invariant.
Thus as soon as you rotate the image, it wont get detected.
You need to use SURF for that purpose.
But Object detection through Haar is much faster than that of SURF. If you want to learn how to use the trained Haar Cascade File you can refer:
http://opencv-hub.blogspot.in/2016/03/how-to-do-real-time-face-detection-using-haar-cascade.html
The Code of real time face detection would be analogous to that of real time object detection.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!