Commit a2a3ec69 authored by Maria Dimashova's avatar Maria Dimashova

Fixed FernClassifier

parent bbc20150
...@@ -665,15 +665,13 @@ void GenericDescriptorMatch::clear() ...@@ -665,15 +665,13 @@ void GenericDescriptorMatch::clear()
Ptr<GenericDescriptorMatch> createGenericDescriptorMatch( const string& genericDescritptorMatchType, const string &paramsFilename ) Ptr<GenericDescriptorMatch> createGenericDescriptorMatch( const string& genericDescritptorMatchType, const string &paramsFilename )
{ {
GenericDescriptorMatch *descriptorMatch = 0; 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; descriptorMatch = new FernDescriptorMatch();
params.signatureSize = numeric_limits<int>::max();
descriptorMatch = new FernDescriptorMatch (params);
} }
else if( ! genericDescritptorMatchType.compare ("CALONDER") ) else if( ! genericDescritptorMatchType.compare ("CALONDER") )
{ {
......
...@@ -805,7 +805,7 @@ void FernClassifier::prepare(int _nclasses, int _patchSize, int _signatureSize, ...@@ -805,7 +805,7 @@ void FernClassifier::prepare(int _nclasses, int _patchSize, int _signatureSize,
patchSize = Size(_patchSize, _patchSize); patchSize = Size(_patchSize, _patchSize);
nstructs = _nstructs; nstructs = _nstructs;
structSize = _structSize; structSize = _structSize;
signatureSize = std::min(_signatureSize, nclasses); signatureSize = _compressionMethod == COMPRESSION_NONE ? nclasses : std::min(_signatureSize, nclasses);
compressionMethod = signatureSize == nclasses ? COMPRESSION_NONE : _compressionMethod; compressionMethod = signatureSize == nclasses ? COMPRESSION_NONE : _compressionMethod;
leavesPerStruct = 1 << structSize; leavesPerStruct = 1 << structSize;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment