Fixed FernClassifier

This commit is contained in:
Maria Dimashova 2010-09-10 11:40:28 +00:00
parent bbc2015014
commit a2a3ec69cb
2 changed files with 5 additions and 7 deletions

View File

@ -665,15 +665,13 @@ void GenericDescriptorMatch::clear()
Ptr<GenericDescriptorMatch> createGenericDescriptorMatch( const string& genericDescritptorMatchType, const string &paramsFilename )
{
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<int>::max();
descriptorMatch = new FernDescriptorMatch (params);
descriptorMatch = new FernDescriptorMatch();
}
else if( ! genericDescritptorMatchType.compare ("CALONDER") )
{

View File

@ -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;