Creating OpenCV Haar Classifier from an existing model

android, c++, java, object-detection, opencv

Solution

In short: I don't think it is possible, unless you are able to render your 3D models realistically according to various lighting conditions.

Haar and LBP classifiers do use some kind of texture information, so the pure shape information isn't enough, afaik. (so instead of HAAR, HoG might or might not be more appropriate for such an approach)

For haar classifier training you could render your 3D models with different material and lighting conditions and in various poses. You'll need background images however as negative samples and as background for your rendered screws (but you could merge the screws to background with opencv_createsamples tool afterwards, too).

So depending on how realistically or appropriate you are able to render the screews, you can use them for your training. Keep in mind that in reality, two screws of same type don't look perfectly the same, the length might vary in small amounts (depending on production quality) and there might be deformations or "noise" like burrs might be present that differ from the perfect model, maybe you would have to consider that in your rendering.

In addition, keep in mind, that haar and lbp cascade classifier work best if they cover a class only from a single pose (like frontal faces or profile faces, not both at the same time), this reduces the use of a signle 3D model.

sometimes, 3D models can be used in combination with chamfer matching to compare them to 2D models.

Problem

I want to make an application that recognizes screws. there is a standard for each screw size and shape, and there are softwares that provide a 360 3d model of each screw (Autocad for example) I wanted to know if there is a any way to take an existing model (of some extension) and create an `Haar classifier` from it. If it wasn't clear, I don't want to take thousands of pictures of every model. I want to somehow reuse the existing models Thanks

Original source