made flann dependency for features2d optional

it will allow to build features2d even if flann module is not available
This commit is contained in:
Vladislav Vinogradov
2017-10-13 11:01:48 +03:00
parent 1ba29cc95d
commit 26fe8bd4f2
8 changed files with 36 additions and 3 deletions
+10 -1
View File
@@ -1005,11 +1005,14 @@ void BFMatcher::radiusMatchImpl( InputArray _queryDescriptors, std::vector<std::
Ptr<DescriptorMatcher> DescriptorMatcher::create( const String& descriptorMatcherType )
{
Ptr<DescriptorMatcher> dm;
#ifdef HAVE_OPENCV_FLANN
if( !descriptorMatcherType.compare( "FlannBased" ) )
{
dm = makePtr<FlannBasedMatcher>();
}
else if( !descriptorMatcherType.compare( "BruteForce" ) ) // L2
else
#endif
if( !descriptorMatcherType.compare( "BruteForce" ) ) // L2
{
dm = makePtr<BFMatcher>(int(NORM_L2)); // anonymous enums can't be template parameters
}
@@ -1044,9 +1047,11 @@ Ptr<DescriptorMatcher> DescriptorMatcher::create(int matcherType)
switch(matcherType)
{
#ifdef HAVE_OPENCV_FLANN
case FLANNBASED:
name = "FlannBased";
break;
#endif
case BRUTEFORCE:
name = "BruteForce";
break;
@@ -1071,6 +1076,7 @@ Ptr<DescriptorMatcher> DescriptorMatcher::create(int matcherType)
}
#ifdef HAVE_OPENCV_FLANN
/*
* Flann based matcher
@@ -1419,4 +1425,7 @@ void FlannBasedMatcher::radiusMatchImpl( InputArray _queryDescriptors, std::vect
convertToDMatches( mergedDescriptors, indices, dists, matches );
}
#endif
}