@ -18,8 +18,8 @@ public:
CvHaarFeatureParams ( int _mode ) ;
virtual void init ( const CvFeatureParams & fp ) ;
virtual void write ( FileStorage & fs ) const ;
virtual bool read ( const FileNode & node ) ;
virtual void write ( cv : : FileStorage & fs ) const ;
virtual bool read ( const cv : : FileNode & node ) ;
virtual void printDefaults ( ) const ;
virtual void printAttrs ( ) const ;
@ -32,11 +32,11 @@ class CvHaarEvaluator : public CvFeatureEvaluator
{
public :
virtual void init ( const CvFeatureParams * _featureParams ,
int _maxSampleCount , Size _winSize ) ;
virtual void setImage ( const Mat & img , uchar clsLabel , int idx ) ;
int _maxSampleCount , cv : : Size _winSize ) ;
virtual void setImage ( const cv : : Mat & img , uchar clsLabel , int idx ) ;
virtual float operator ( ) ( int featureIdx , int sampleIdx ) const ;
virtual void writeFeatures ( FileStorage & fs , const Mat & featureMap ) const ;
void writeFeature ( FileStorage & fs , int fi ) const ; // for old file fornat
virtual void writeFeatures ( cv : : FileStorage & fs , const cv : : Mat & featureMap ) const ;
void writeFeature ( cv : : FileStorage & fs , int fi ) const ; // for old file fornat
protected :
virtual void generateFeatures ( ) ;
@ -48,13 +48,13 @@ protected:
int x0 , int y0 , int w0 , int h0 , float wt0 ,
int x1 , int y1 , int w1 , int h1 , float wt1 ,
int x2 = 0 , int y2 = 0 , int w2 = 0 , int h2 = 0 , float wt2 = 0.0F ) ;
float calc ( const Mat & sum , const Mat & tilted , size_t y ) const ;
void write ( FileStorage & fs ) const ;
float calc ( const cv : : Mat & sum , const cv : : Mat & tilted , size_t y ) const ;
void write ( cv : : FileStorage & fs ) const ;
bool tilted ;
struct
{
Rect r ;
cv : : Rect r ;
float weight ;
} rect [ CV_HAAR_FEATURE_MAX ] ;
@ -65,9 +65,9 @@ protected:
} ;
std : : vector < Feature > features ;
Mat sum ; /* sum images (each row represents image) */
Mat tilted ; /* tilted sum images (each row represents image) */
Mat normfactor ; /* normalization factor */
cv : : Mat sum ; /* sum images (each row represents image) */
cv : : Mat tilted ; /* tilted sum images (each row represents image) */
cv : : Mat normfactor ; /* normalization factor */
} ;
inline float CvHaarEvaluator : : operator ( ) ( int featureIdx , int sampleIdx ) const
@ -76,7 +76,7 @@ inline float CvHaarEvaluator::operator()(int featureIdx, int sampleIdx) const
return ! nf ? 0.0f : ( features [ featureIdx ] . calc ( sum , tilted , sampleIdx ) / nf ) ;
}
inline float CvHaarEvaluator : : Feature : : calc ( const Mat & _sum , const Mat & _tilted , size_t y ) const
inline float CvHaarEvaluator : : Feature : : calc ( const cv : : Mat & _sum , const cv : : Mat & _tilted , size_t y ) const
{
const int * img = tilted ? _tilted . ptr < int > ( ( int ) y ) : _sum . ptr < int > ( ( int ) y ) ;
float ret = rect [ 0 ] . weight * ( img [ fastRect [ 0 ] . p0 ] - img [ fastRect [ 0 ] . p1 ] - img [ fastRect [ 0 ] . p2 ] + img [ fastRect [ 0 ] . p3 ] ) +