I'm new in OpenCV and trying to figure out methods what would be the best method for searching components from drawings like circuit diagrams. Components are always black with white background but components can be rotated and scaled.
Example of simple diagram with components. Diagrams have always better resolution than this.
Should I make Haar training for every component? Or template matching?
Thanks!
You probably can rule out using template matching because of this statement
components can be rotated and scaled
Template matching will not work well under these circumstance unless you plan on making many templates (i.e., lots of rotations and scales) for each component type.
Haar cascades might work, but at least with face detection it is somewhat limited on the amount of rotation that it can handle +/- 20 degrees or so. Although, I think this is mostly due to the training set used. Haar cascades require lots (in the thousands to get a good one) of training images both positive and negative sets. So, data collection may take a while.
You might start with the squares.cpp sample and see how that works for detecting the rectangular blocks on the diagram for basic shape detection. Then if you're pleased with square detection extend it to detect triangles, etc.
Then there are the feature-based approaches (SURF, SIFT, MSER, etc...). You may find some of these samples helpful:
matcher_simple.cpp
matching_to_many_images.cpp
descriptor_extractor_matcher.cpp
bagofwords_classification.cpp
Hope that is helpful!