An another improvement?

This commit is contained in:
laurentBerger 2015-05-09 10:29:53 +02:00
parent 26d7da68fc
commit 16e20e5c73

View File

@ -97,12 +97,18 @@ int main(int argc, char *argv[])
// Match method loop // Match method loop
for (itMatcher = typeAlgoMatch.begin(); itMatcher != typeAlgoMatch.end(); itMatcher++){ for (itMatcher = typeAlgoMatch.begin(); itMatcher != typeAlgoMatch.end(); itMatcher++){
descriptorMatcher = DescriptorMatcher::create(*itMatcher); descriptorMatcher = DescriptorMatcher::create(*itMatcher);
if ((*itMatcher == "BruteForce-Hamming" || *itMatcher == "BruteForce-Hamming(2)") && (b->descriptorType() == CV_32F || b->defaultNorm() <= NORM_L2SQR) ) if ((*itMatcher == "BruteForce-Hamming" || *itMatcher == "BruteForce-Hamming(2)") && (b->descriptorType() == CV_32F || b->defaultNorm() <= NORM_L2SQR))
{ {
cout << "**************************************************************************\n"; cout << "**************************************************************************\n";
cout << "It's strange. You should use Hamming distance only for a binary descriptor\n"; cout << "It's strange. You should use Hamming distance only for a binary descriptor\n";
cout << "**************************************************************************\n"; cout << "**************************************************************************\n";
} }
if ((*itMatcher == "BruteForce" || *itMatcher == "BruteForce-L1") && (b->defaultNorm() >= NORM_HAMMING))
{
cout << "**************************************************************************\n";
cout << "It's strange. You shouldn't use L1 or L2 distance for a binary descriptor\n";
cout << "**************************************************************************\n";
}
try try
{ {
descriptorMatcher->match(descImg1, descImg2, matches, Mat()); descriptorMatcher->match(descImg1, descImg2, matches, Mat());