简体   繁体   English

矩形图像可以用于OpenCV Haar训练吗

[英]Can rectangular images be used for opencv haar training

I am sorry it seems a starting question but just wondering can i use rectangular dimensions for training opencv haar cascade . 对不起,这似乎是一个开始的问题,但我只是想知道我可以使用rectangular dimensions来训练opencv haar cascade I tried with square samples and the resultant image was detected fine but when i tried with rectangular width and height as for license plate the aspect ratio is 2:1 between width and height so i am using the same aspect ratio while training but the resultant classifier is not detecting anything in the image. 我尝试使用square samples并且检测到的图像很好,但是当我尝试使用矩形宽度和高度(如车牌)时,宽高比为2:1 ,因此我在训练时使用相同的宽高比,但是得到的分类器没有在图像中检测到任何东西。

nStages = 14
nPositive = 1780
minHitrate = 0.996
maxFalseAlarm = 0.2
nNegatives = 14000
width = 48
height = 24
Haar classifier type = BASIC
Boost type = gentle adaboost

The above are the parameters i have set for training of the classifier . 以上是我为训练classifier设置的参数。 Can anyone please confirm that can i use rectangular parameters for positive samples or not. 任何人都可以确认我是否可以对正样本使用rectangular parameters Also please suggest some modifications to have the training done properly. 另外,请提出一些修改以正确完成培训。

The size of negative images for training is around 240x161 annd 420x240 用于训练的负片图像的大小约为240x161420x240

Thank you. 谢谢。


EDIT 1: 编辑1:


I am using the call as follows. 我正在使用以下电话。

f_cascade.detectMultiScale( image, detected_objects, pyramidScale, 2, 0|CV_HAAR_SCALE_IMAGE);

The key parts of this are making sure your positive samples and training dimensions are the same. 关键在于确保您的阳性样本和训练量相同。 There is no reason why you won't be able to detect a rectangular object. 没有理由不能检测矩形对象。

They key thing to remember is that traincascade is running whatever dimensions you specify over your images. 他们要记住的关键是, traincascade运行的是您在图像上指定的任何尺寸。

See here for some proof that rectangular objects should be detected just fine: http://coding-robin.de/2013/07/22/train-your-own-opencv-haar-classifier.html 参见此处以了解应能很好地检测矩形对象的一些证据: http : //coding-robin.de/2013/07/22/train-your-own-opencv-haar-classifier.html

Also I wrote a tutorial about object detection if anyone gets stuck on this stuff: 另外,如果有人卡住了这些东西,我也写了一个有关对象检测的教程:

http://johnallen.github.io/opencv-object-detection-tutorial/ http://johnallen.github.io/opencv-object-detection-tutorial/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM