Reputation: 7531
I'm in the process of creating a classifier for an electrical outlet (specifically the three open holes that occur twice on standard outlet panels, not the entire panel itself).
My question is, what are the ideal traits of positive images and what width and height should I pass to train_cascade to enable my object detector to detect the smallest possible outlets? I.e. to detect them from the farthest possible distance? I also care about accuracy, and am fine with a classifier that takes weeks to train (assuming it is actually making progress).
And a question to increase my understanding of this: is the width and height I pass to train_cascade
the dimensions of the search box that will be passed over each image? If so, and I want my detector to detect very small objects, than I should pass a small width and height, correct?
I would like to be able to detect very large and very small instances of outlets. From very close up (the camera is literally 3 inches away from the outlet) to at least a few feet away.
Upvotes: 4
Views: 2675
Reputation: 7531
Ok, so after a few weeks of getting to know OpenCV and its object detection capabilities and no one else has answered, I'll answer my own question.
Anyways, my understanding is that the smallest object can be as small as the positive samples opencv_createsamples
is fed.
I used OpenCV's object detection to detect the outlet, as pictured in the question. I specified 20x20 pixels to createsamples
and got great results. The object can be detected to 3-4', which is I believe when its resolution falls under 20x20 pixels.
One thing to remember is that when you are running your detector, it is sliding squares with the dimensions you specify over the input frame. If your object appears smaller than that square in the image it will simply go undetected.
Upvotes: 10