From a2a3ec69cb341b5b63109ba15ec50f2273abc218 Mon Sep 17 00:00:00 2001 From: Maria Dimashova Date: Fri, 10 Sep 2010 11:40:28 +0000 Subject: [PATCH] Fixed FernClassifier --- modules/features2d/src/descriptors.cpp | 10 ++++------ modules/features2d/src/planardetect.cpp | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) 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;