OpenCV creates trace parameters and parameters (width and height)

I am trying to create training samples (and subsequently train a classifier). I am confused about the -h and -w options used in the createamples and traincascade files. The examples that I see usually use small values ​​for them, but my training images (negative and positive) are much larger (480x640) with the object that I train to usually occupy 75-100% of the image. It seems that these options do not ask about the size of the images (which it can just pull out of the images), but I suspect that it also does not ask for the size of the object in the image. If I have to guess (and rather do not want to), large sizes can lead to better detection accuracy, but will increase the computational load during training.

Can someone describe what these options really mean? Most of the examples I've seen use defaults of 24x24 or higher than 40x40, but never much higher as far as I can see.

+4
source share
1 answer

These small image values ​​are the positives (objects) for which you want to train the classifier. The object in your real frame can be of arbitrary size, because the cascading classifier works for different image scales.

Here is a good tutorial that helped me when I trained my own classifier. Your cropped images used for training may be larger, but when you createsamples you need to specify the size at which the positive textures are scaled. These new tiny patterns are the ones used for the classifier. It also affects the speed of the cascading classifier, so they are tiny in size.

Background images may be larger in size if I'm not mistaken, but I remember that I still cropped the background images that I had in smaller sizes.

When you run your classifier with real 640x480 data, you specify the limits of the minimum size that can be positive (of course, this value must be at least the size -w -h that you specified earlier), as well as the maximum expected size.

The haar detector will only search for objects in the window range of your test image, which can be as large as possible.

+7
source

All Articles