From 96f69b160cf0d667a73f4e5a58ad6bcb931b7e97 Mon Sep 17 00:00:00 2001 From: Maria Dimashova Date: Fri, 10 Jun 2011 13:07:31 +0000 Subject: [PATCH] added implementation of CvHaarFeatureParams::read() in traincascade application (#1061) --- modules/traincascade/haarfeatures.cpp | 16 ++++++++++++++++ modules/traincascade/haarfeatures.h | 1 + 2 files changed, 17 insertions(+) diff --git a/modules/traincascade/haarfeatures.cpp b/modules/traincascade/haarfeatures.cpp index 3b22edfd54..6344af5a25 100644 --- a/modules/traincascade/haarfeatures.cpp +++ b/modules/traincascade/haarfeatures.cpp @@ -29,6 +29,22 @@ void CvHaarFeatureParams::write( FileStorage &fs ) const fs << CC_MODE << modeStr; } +bool CvHaarFeatureParams::read( const FileNode &node ) +{ + if( !CvFeatureParams::read( node ) ) + return false; + + FileNode rnode = node[CC_MODE]; + if( !rnode.isString() ) + return false; + String modeStr; + rnode >> modeStr; + mode = !modeStr.compare( CC_MODE_BASIC ) ? BASIC : + !modeStr.compare( CC_MODE_CORE ) ? CORE : + !modeStr.compare( CC_MODE_ALL ) ? ALL : -1; + return (mode >= 0); +} + void CvHaarFeatureParams::printDefaults() const { CvFeatureParams::printDefaults(); diff --git a/modules/traincascade/haarfeatures.h b/modules/traincascade/haarfeatures.h index da0067d463..a871c54128 100644 --- a/modules/traincascade/haarfeatures.h +++ b/modules/traincascade/haarfeatures.h @@ -19,6 +19,7 @@ public: virtual void init( const CvFeatureParams& fp ); virtual void write( FileStorage &fs ) const; + virtual bool read( const FileNode &node ); virtual void printDefaults() const; virtual void printAttrs() const;