|
|
|
@ -412,6 +412,7 @@ bool CvCascadeClassifier::readStages( const FileNode &node) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// For old Haar Classifier file saving
|
|
|
|
|
#define ICV_HAAR_TYPE_ID "opencv-haar-classifier" |
|
|
|
|
#define ICV_HAAR_SIZE_NAME "size" |
|
|
|
|
#define ICV_HAAR_STAGES_NAME "stages" |
|
|
|
|
#define ICV_HAAR_TREES_NAME "trees" |
|
|
|
@ -434,11 +435,12 @@ void CvCascadeClassifier::save( const string filename, bool baseFormat ) |
|
|
|
|
if ( !fs.isOpened() ) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
fs << FileStorage::getDefaultObjectName(filename) << "{"; |
|
|
|
|
fs << FileStorage::getDefaultObjectName(filename); |
|
|
|
|
if ( !baseFormat ) |
|
|
|
|
{ |
|
|
|
|
Mat featureMap; |
|
|
|
|
getUsedFeaturesIdxMap( featureMap ); |
|
|
|
|
fs << "{"; |
|
|
|
|
writeParams( fs ); |
|
|
|
|
fs << CC_STAGE_NUM << (int)stageClassifiers.size(); |
|
|
|
|
writeStages( fs, featureMap ); |
|
|
|
@ -450,6 +452,7 @@ void CvCascadeClassifier::save( const string filename, bool baseFormat ) |
|
|
|
|
CvSeq* weak; |
|
|
|
|
if ( cascadeParams.featureType != CvFeatureParams::HAAR ) |
|
|
|
|
CV_Error( CV_StsBadFunc, "old file format is used for Haar-like features only"); |
|
|
|
|
fs << "{:" ICV_HAAR_TYPE_ID; |
|
|
|
|
fs << ICV_HAAR_SIZE_NAME << "[:" << cascadeParams.winSize.width << |
|
|
|
|
cascadeParams.winSize.height << "]"; |
|
|
|
|
fs << ICV_HAAR_STAGES_NAME << "["; |
|
|
|
|