@@ -611,11 +611,6 @@ void ERFilterNM::er_merge(ERStat *parent, ERStat *child)
611
611
parent->central_moments [1 ] += child->central_moments [1 ];
612
612
parent->central_moments [2 ] += child->central_moments [2 ];
613
613
614
- // child region done, we can calculate 1st stage features from the incrementally computable descriptors
615
- child->aspect_ratio = (float )(child->rect .width )/(child->rect .height );
616
- child->compactness = sqrt ((float )(child->area ))/child->perimeter ;
617
- child->num_holes = (float )(1 -child->euler );
618
-
619
614
vector<int > m_crossings;
620
615
m_crossings.push_back (child->crossings ->at ((int )(child->rect .height )/6 ));
621
616
m_crossings.push_back (child->crossings ->at ((int )3 *(child->rect .height )/6 ));
@@ -1004,7 +999,11 @@ ERClassifierNM1::ERClassifierNM1()
1004
999
double ERClassifierNM1::eval (const ERStat& stat)
1005
1000
{
1006
1001
// Classify
1007
- float arr[] = {0 ,stat.aspect_ratio , stat.compactness , stat.num_holes , stat.med_crossings };
1002
+ float arr[] = {0 ,(float )(stat.rect .width )/(stat.rect .height ), // aspect ratio
1003
+ sqrt ((float )(stat.area ))/stat.perimeter , // compactness
1004
+ (float )(1 -stat.euler ), // number of holes
1005
+ stat.med_crossings };
1006
+
1008
1007
vector<float > sample (arr, arr + sizeof (arr) / sizeof (arr[0 ]) );
1009
1008
1010
1009
float votes = boost.predict ( Mat (sample), Mat (), Range::all (), false , true );
@@ -1038,8 +1037,12 @@ ERClassifierNM2::ERClassifierNM2()
1038
1037
double ERClassifierNM2::eval (const ERStat& stat)
1039
1038
{
1040
1039
// Classify
1041
- float arr[] = {0 ,stat.aspect_ratio , stat.compactness , stat.num_holes , stat.med_crossings ,
1042
- stat.hole_area_ratio , stat.convex_hull_ratio , stat.num_inflexion_points };
1040
+ float arr[] = {0 ,(float )(stat.rect .width )/(stat.rect .height ), // aspect ratio
1041
+ sqrt ((float )(stat.area ))/stat.perimeter , // compactness
1042
+ (float )(1 -stat.euler ), // number of holes
1043
+ stat.med_crossings , stat.hole_area_ratio ,
1044
+ stat.convex_hull_ratio , stat.num_inflexion_points };
1045
+
1043
1046
vector<float > sample (arr, arr + sizeof (arr) / sizeof (arr[0 ]) );
1044
1047
1045
1048
float votes = boost.predict ( Mat (sample), Mat (), Range::all (), false , true );
0 commit comments