OpenCV: how to create .vec file to use with opencv_traincascade

﹥>﹥吖頭↗ 提交于 2019-11-29 12:00:51

I've used the negative samples database of the INRIA training http://pascal.inrialpes.fr/data/human/

and this input (png with alpha transparency around the coin):

using this with this command:

opencv_createsamples -img pos_color.png -num 10 -bg neg.txt -info test.dat -maxxangle 0.6 -maxyangle 0 -maxzangle 0.3 -maxidev 100 -bgcolor 0 -bgthresh 0

produces output like this:

so background color obviously didn't work. Converting to grayscale in the beginning however gives me this input:

and same command produces output like this:

I know this is no answer to all of your questions, but maybe it still helps.

OpenCV cascades (HAAR, LBP) can excellently detect objects which have permanent features. As example all faces have nose, eyes and mouth at the same places. OpenCV cascades are trained to search common features in required class of object and ignore features which changes from object to object. The problem is conclude that the cascade uses rectangular shape of search window, but a coin has round shape. Therefore an image of the coin always will be have part of background. So training images of the coin must includes all possible backgrounds in order to classifiers can ignore them (otherwise it will be detect coin only on the specific background).

So all training samples must have the same image ratio, size and position of the coin (square images with coin in center, diameter of coin = 0.8-0.9 image width), and different background!

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