Commit 7ba7abb1 authored by Hamdi Sahloul's avatar Hamdi Sahloul

Renamed unnamed enum to CvFeatureParams.FeatureType

parent b6ece95d
......@@ -137,17 +137,18 @@ class CvParams
class CvFeatureParams : public CvParams
{
public:
enum
enum FeatureType
{
HAAR = 0,
LBP = 1,
HOG = 2
};
CvFeatureParams();
virtual void init( const CvFeatureParams& fp );
virtual void write( FileStorage &fs ) const CV_OVERRIDE;
virtual bool read( const FileNode &node ) CV_OVERRIDE;
static Ptr<CvFeatureParams> create( int featureType );
static Ptr<CvFeatureParams> create(CvFeatureParams::FeatureType featureType);
int maxCatCount; // 0 in case of numerical features
int featSize; // 1 in case of simple features (HAAR, LBP) and N_BINS(9)*N_CELLS(4) in case of Dalal's HOG features
int numFeatures;
......@@ -163,7 +164,7 @@ class CvFeatureEvaluator
virtual void setImage( const Mat& img, uchar clsLabel, int idx );
virtual void writeFeatures( FileStorage &fs, const Mat& featureMap ) const = 0;
virtual float operator()( int featureIdx, int sampleIdx ) = 0;
static Ptr<CvFeatureEvaluator> create( int type );
static Ptr<CvFeatureEvaluator> create(CvFeatureParams::FeatureType type);
int getNumFeatures() const
{
......
......@@ -100,7 +100,7 @@ bool CvFeatureParams::read( const FileNode &node )
return ( maxCatCount >= 0 && featSize >= 1 );
}
Ptr<CvFeatureParams> CvFeatureParams::create( int featureType )
Ptr<CvFeatureParams> CvFeatureParams::create(FeatureType featureType)
{
return featureType == HAAR ? Ptr<CvFeatureParams>( new CvHaarFeatureParams ) : featureType == LBP ? Ptr<CvFeatureParams>( new CvLBPFeatureParams ) :
featureType == HOG ? Ptr<CvFeatureParams>( new CvHOGFeatureParams ) : Ptr<CvFeatureParams>();
......@@ -128,7 +128,7 @@ void CvFeatureEvaluator::setImage( const Mat &img, uchar clsLabel, int idx )
cls.ptr<float>( idx )[0] = clsLabel;
}
Ptr<CvFeatureEvaluator> CvFeatureEvaluator::create( int type )
Ptr<CvFeatureEvaluator> CvFeatureEvaluator::create(CvFeatureParams::FeatureType type)
{
return type == CvFeatureParams::HAAR ? Ptr<CvFeatureEvaluator>( new CvHaarEvaluator ) :
type == CvFeatureParams::LBP ? Ptr<CvFeatureEvaluator>( new CvLBPEvaluator ) :
......
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