0

I am trying to find different options in using the OpenCV feature matching.

I am using version 2.4.4.

I heard that there is a "templated" version for the brute force matching - and that i may be able to get different matching methods...

So far this is what i found - but i can't see how to use the templated version, other than passing the matching method in the constructor. Is that how it works ? are there any alternatives that i can explore ?

cv::BFMatcher matcher(use_hamming ? cv::NORM_HAMMING : cv::NORM_L2);
matcher.knnMatch(descriptors2, descriptors1, matches, 2);

Thank you

Thalia
  • 13,637
  • 22
  • 96
  • 190

2 Answers2

0

The template detection is described in OpenCV documentation at: http://docs.opencv.org/modules/imgproc/doc/object_detection.html?highlight=template%20match#void matchTemplate(InputArray image, InputArray templ, OutputArray result, int method)

You can find a tutorial at: http://docs.opencv.org/doc/tutorials/imgproc/histograms/template_matching/template_matching.html?highlight=template%20match

unxnut
  • 8,509
  • 3
  • 27
  • 41
  • I looked at the suggested information - it seems though that it performs a completely different operation, than the feature matching operation that i am looking for - is that correct ? instead of finding features, this procedure requires knowledge of overlapping image regions, and computes values for the match accuracy - so it would be more of a final test in a chain of operations rather than an alternative to the feature matching ? – Thalia Nov 04 '13 at 21:42
  • You may get a better response in answers.opencv.org. – unxnut Nov 04 '13 at 21:48
0

unxnut probably suggested template matching because you mix two different things: 1)Matching of the templates - suggested by unxnut and 2)Use of C++ templates in OpenCV function (which is technical issue, not relevant for your question).

Answering your question, BFmatcher is only one part of the pipeline. You need to 1)Detect features http://docs.opencv.org/doc/tutorials/features2d/feature_detection/feature_detection.html 2)Describe detected features http://docs.opencv.org/doc/tutorials/features2d/feature_description/feature_description.html 3)Match features (BFMatcher is used here. Hamming for binary features like ORB, FREAK, L2 for SIFT and SURF) 4)Geometric verification with RANSAC.

If you want working example of whole process, look at http://docs.opencv.org/doc/tutorials/features2d/feature_homography/feature_homography.html

If you are interested in understanding of this process, I`d recommend you to look for some university lectures and\or labs about this, e.g. http://www.cvl.isy.liu.se/education/undergraduate/tsbb15/lectures/lecture-08

old-ufo
  • 2,799
  • 2
  • 28
  • 40
  • Thank you, i was actually looking for advice on using a templated matching method, instead of an enumeration that fits into the constructor type. That may allow me to use a custom matching method. I am sorry i don't express myself very well. I think i will have to try to inherit from BFMatcher using a class template. – Thalia Nov 06 '13 at 00:13