diff --git a/modules/features2d/src/descriptors.cpp b/modules/features2d/src/descriptors.cpp index adad4875a6..f9f4eb4a2f 100644 --- a/modules/features2d/src/descriptors.cpp +++ b/modules/features2d/src/descriptors.cpp @@ -665,15 +665,13 @@ void GenericDescriptorMatch::clear() Ptr createGenericDescriptorMatch( const string& genericDescritptorMatchType, const string ¶msFilename ) { GenericDescriptorMatch *descriptorMatch = 0; - if( ! genericDescritptorMatchType.compare ("ONEWAY") ) + if( ! genericDescritptorMatchType.compare("ONEWAY") ) { - descriptorMatch = new OneWayDescriptorMatch (); + descriptorMatch = new OneWayDescriptorMatch(); } - else if( ! genericDescritptorMatchType.compare ("FERN") ) + else if( ! genericDescritptorMatchType.compare("FERN") ) { - FernDescriptorMatch::Params params; - params.signatureSize = numeric_limits::max(); - descriptorMatch = new FernDescriptorMatch (params); + descriptorMatch = new FernDescriptorMatch(); } else if( ! genericDescritptorMatchType.compare ("CALONDER") ) { diff --git a/modules/features2d/src/planardetect.cpp b/modules/features2d/src/planardetect.cpp index e1bdafb217..0289226966 100644 --- a/modules/features2d/src/planardetect.cpp +++ b/modules/features2d/src/planardetect.cpp @@ -805,7 +805,7 @@ void FernClassifier::prepare(int _nclasses, int _patchSize, int _signatureSize, patchSize = Size(_patchSize, _patchSize); nstructs = _nstructs; structSize = _structSize; - signatureSize = std::min(_signatureSize, nclasses); + signatureSize = _compressionMethod == COMPRESSION_NONE ? nclasses : std::min(_signatureSize, nclasses); compressionMethod = signatureSize == nclasses ? COMPRESSION_NONE : _compressionMethod; leavesPerStruct = 1 << structSize;