title: OpenCV positive samples dimensions?
body: <p>So I've come across lots of tutorials about OpenCV's haartraining and cascaded training tools. In particular I'm interested in training a car classifier using the createsamples tool but there seem to be conflicting statements all over the place regarding the -w and -h parameters, so I'm confused.
  I'm referring to the command:</p>
  
  <pre><code>$ createsamples -info samples.dat -vec samples.vec -w 20 -h 20
  </code></pre>
  
  <p>I have the following three questions:</p>
  
  <ul>
  <li><p>I understand that the aspect ratio of the positive samples should be the same as the aspect ratio you get from the -w and -h parameters above. But do the -w and -h parameters of ALL of the positive samples have to be the same <em>size</em>, as well? Eg. I have close to 1000 images. Do all of them have to be the same size after cropping?</p></li>
  <li><p>If it is not the size but the aspect ratio that matters, then how precisely matching must the aspect ratio be of the positive samples, compared to the -w and -h parameters mentioned in the OpenCV tools? I mean, is the classifier very sensitive, so that even a few pixels off here and there would affect its performance? Or would you say that it's safe to work with images as long as they're all approximately the same ratio by eye.</p></li>
  <li><p>I have already cropped several images to the same size. But in trying to make them all the same size, some of them have a bit more background included in the bounding boxes than others, and some have slightly different margins. (For example, see the two images below. The bigger car takes up more of the image, but there's a wider margin around the smaller car). I'm just wondering if having a collection of images like this is fine, or if it will lower the accuracy of the classifier and that I should therefore ensure tighter bounding boxes around all objects of interest (in this case, cars)?</p></li>
  </ul>
  
  <p><img src="https://i.stack.imgur.com/ctfrW.jpg" alt="big car"> <img src="https://i.stack.imgur.com/23Uqc.jpg" alt="small car"></p>