Commit d9fe1bd018dc06879c2a6b6325ee9a0fb748ca6e
1 parent
9567b975
Step 1 (OpenCV I/O within OpenBR) complete
Showing
2 changed files
with
9 additions
and
6 deletions
openbr/core/cascade.cpp
| @@ -209,7 +209,7 @@ void CascadeParams::write( FileStorage &fs ) const | @@ -209,7 +209,7 @@ void CascadeParams::write( FileStorage &fs ) const | ||
| 209 | string stageTypeStr = stageType == BOOST ? CC_BOOST : string(); | 209 | string stageTypeStr = stageType == BOOST ? CC_BOOST : string(); |
| 210 | CV_Assert( !stageTypeStr.empty() ); | 210 | CV_Assert( !stageTypeStr.empty() ); |
| 211 | fs << CC_STAGE_TYPE << stageTypeStr; | 211 | fs << CC_STAGE_TYPE << stageTypeStr; |
| 212 | - string featureTypeStr = featureType == FeatureParams::LBP ? CC_HAAR : | 212 | + string featureTypeStr = featureType == FeatureParams::LBP ? CC_LBP : |
| 213 | 0; | 213 | 0; |
| 214 | CV_Assert( !stageTypeStr.empty() ); | 214 | CV_Assert( !stageTypeStr.empty() ); |
| 215 | fs << CC_FEATURE_TYPE << featureTypeStr; | 215 | fs << CC_FEATURE_TYPE << featureTypeStr; |
| @@ -544,7 +544,6 @@ bool BrCascadeClassifier::readParams( const FileNode &node ) | @@ -544,7 +544,6 @@ bool BrCascadeClassifier::readParams( const FileNode &node ) | ||
| 544 | FileNode rnode = node[CC_STAGE_PARAMS]; | 544 | FileNode rnode = node[CC_STAGE_PARAMS]; |
| 545 | if ( !stageParams->read( rnode ) ) | 545 | if ( !stageParams->read( rnode ) ) |
| 546 | return false; | 546 | return false; |
| 547 | - | ||
| 548 | featureParams = FeatureParams::create(cascadeParams.featureType); | 547 | featureParams = FeatureParams::create(cascadeParams.featureType); |
| 549 | rnode = node[CC_FEATURE_PARAMS]; | 548 | rnode = node[CC_FEATURE_PARAMS]; |
| 550 | if ( !featureParams->read( rnode ) ) | 549 | if ( !featureParams->read( rnode ) ) |
| @@ -599,12 +598,16 @@ void BrCascadeClassifier::save( const string filename, bool baseFormat ) | @@ -599,12 +598,16 @@ void BrCascadeClassifier::save( const string filename, bool baseFormat ) | ||
| 599 | bool BrCascadeClassifier::load( const string cascadeDirName ) | 598 | bool BrCascadeClassifier::load( const string cascadeDirName ) |
| 600 | { | 599 | { |
| 601 | FileStorage fs( cascadeDirName + CC_PARAMS_FILENAME, FileStorage::READ ); | 600 | FileStorage fs( cascadeDirName + CC_PARAMS_FILENAME, FileStorage::READ ); |
| 602 | - if ( !fs.isOpened() ) | 601 | + qDebug() << "1"; |
| 602 | + if ( !fs.isOpened() ) { | ||
| 603 | + qDebug() << "2"; | ||
| 603 | return false; | 604 | return false; |
| 605 | + } | ||
| 604 | FileNode node = fs.getFirstTopLevelNode(); | 606 | FileNode node = fs.getFirstTopLevelNode(); |
| 605 | - if ( !readParams( node ) ) | 607 | + if ( !readParams( node ) ) { |
| 608 | + qDebug() << "3"; | ||
| 606 | return false; | 609 | return false; |
| 607 | - | 610 | + } |
| 608 | featureEvaluator = FeatureEvaluator::create(cascadeParams.featureType); | 611 | featureEvaluator = FeatureEvaluator::create(cascadeParams.featureType); |
| 609 | featureEvaluator->init( ((FeatureParams*)featureParams), numPos + numNeg, cascadeParams.winSize ); | 612 | featureEvaluator->init( ((FeatureParams*)featureParams), numPos + numNeg, cascadeParams.winSize ); |
| 610 | fs.release(); | 613 | fs.release(); |
openbr/plugins/metadata/cascade.cpp
| @@ -111,7 +111,7 @@ class CascadeTransform : public MetaTransform | @@ -111,7 +111,7 @@ class CascadeTransform : public MetaTransform | ||
| 111 | QString cascadeDir = Globals->sdkPath + "/share/openbr/models/openbrcascades/" + model; | 111 | QString cascadeDir = Globals->sdkPath + "/share/openbr/models/openbrcascades/" + model; |
| 112 | classifier.train(cascadeDir.toStdString(), | 112 | classifier.train(cascadeDir.toStdString(), |
| 113 | vecFile.toStdString(), negFile.toStdString(), | 113 | vecFile.toStdString(), negFile.toStdString(), |
| 114 | - numPos, numNeg, 1024, 1024, 20, | 114 | + numPos, numNeg, 1024, 1024, 17, |
| 115 | cascadeParams, featureParams, stageParams); | 115 | cascadeParams, featureParams, stageParams); |
| 116 | } | 116 | } |
| 117 | 117 |