]> rtime.felk.cvut.cz Git - opencv.git/commitdiff
fixed CvHaarEvaluator::generateFeatures()
authormdim <mdim@73c94f0f-984f-4a5f-82bc-2d8db8d8ee08>
Wed, 17 Mar 2010 16:18:53 +0000 (16:18 +0000)
committermdim <mdim@73c94f0f-984f-4a5f-82bc-2d8db8d8ee08>
Wed, 17 Mar 2010 16:18:53 +0000 (16:18 +0000)
git-svn-id: https://code.ros.org/svn/opencv/trunk@2842 73c94f0f-984f-4a5f-82bc-2d8db8d8ee08

opencv/apps/traincascade/haarfeatures.cpp

index 0945a84873f9f44cb60e01e96ef6001a141ccac8..ee469a94fbbbf021b7cc7e9e9e2ac579c6d9919f 100755 (executable)
@@ -112,32 +112,28 @@ void CvHaarEvaluator::generateFeatures()
                     // haar_x2
                     if ( (x+dx*2 <= winSize.width) && (y+dy <= winSize.height) )
                     {
-                        if ( x+x+dx*2 <= winSize.width ) 
-                            features.push_back( Feature( offset, false,
+                        features.push_back( Feature( offset, false,
                             x,    y, dx*2, dy, -1,
                             x+dx, y, dx  , dy, +2 ) );
                     }
                     // haar_y2
                     if ( (x+dx*2 <= winSize.height) && (y+dy <= winSize.width) ) 
                     {
-                        if ( y+y+dy <= winSize.width )
-                            features.push_back( Feature( offset, false,
+                        features.push_back( Feature( offset, false,
                             y,    x, dy, dx*2, -1,
                             y, x+dx, dy, dx,   +2 ) );
                     }
                     // haar_x3
                     if ( (x+dx*3 <= winSize.width) && (y+dy <= winSize.height) )
                     {
-                        if ( x+x+dx*3 <= winSize.width )
-                            features.push_back( Feature( offset, false,
+                        features.push_back( Feature( offset, false,
                             x,    y, dx*3, dy, -1,
                             x+dx, y, dx  , dy, +3 ) );
                     }
                     // haar_y3
                     if ( (x+dx*3 <= winSize.height) && (y+dy <= winSize.width) )
                     {
-                        if ( y+y+dy <= winSize.width )
-                            features.push_back( Feature( offset, false,
+                        features.push_back( Feature( offset, false,
                             y, x,    dy, dx*3, -1,
                             y, x+dx, dy, dx,   +3 ) );
                     }
@@ -146,16 +142,14 @@ void CvHaarEvaluator::generateFeatures()
                         // haar_x4
                         if ( (x+dx*4 <= winSize.width) && (y+dy <= winSize.height) ) 
                         {
-                            if ( x+x+dx*4 <= winSize.width )
-                                features.push_back( Feature( offset, false,
+                            features.push_back( Feature( offset, false,
                                 x,    y, dx*4, dy, -1,
                                 x+dx, y, dx*2, dy, +2 ) );
                         }
                         // haar_y4
                         if ( (x+dx*4 <= winSize.height) && (y+dy <= winSize.width ) ) 
                         {
-                            if ( y+y+dy <= winSize.width )
-                                features.push_back( Feature( offset, false,
+                            features.push_back( Feature( offset, false,
                                 y, x,    dy, dx*4, -1,
                                 y, x+dx, dy, dx*2, +2 ) );
                         }
@@ -163,8 +157,7 @@ void CvHaarEvaluator::generateFeatures()
                     // x2_y2
                     if ( (x+dx*2 <= winSize.width) && (y+dy*2 <= winSize.height) ) 
                     {
-                        if ( x+x+dx*2 <= winSize.width ) 
-                            features.push_back( Feature( offset, false,
+                        features.push_back( Feature( offset, false,
                             x,    y,    dx*2, dy*2, -1,
                             x,    y,    dx,   dy,   +2,
                             x+dx, y+dy, dx,   dy,   +2 ) );
@@ -173,8 +166,7 @@ void CvHaarEvaluator::generateFeatures()
                     {                
                         if ( (x+dx*3 <= winSize.width) && (y+dy*3 <= winSize.height) ) 
                         {
-                            if ( x+x+dx*3 <= winSize.width )  
-                                features.push_back( Feature( offset, false,
+                            features.push_back( Feature( offset, false,
                                 x   , y   , dx*3, dy*3, -1,
                                 x+dx, y+dy, dx  , dy  , +9) );
                         }
@@ -184,48 +176,42 @@ void CvHaarEvaluator::generateFeatures()
                         // tilted haar_x2
                         if ( (x+2*dx <= winSize.width) && (y+2*dx+dy <= winSize.height) && (x-dy>= 0) ) 
                         {
-                            if ( x <= (winSize.width / 2) ) 
-                                features.push_back( Feature( offset, true,
+                            features.push_back( Feature( offset, true,
                                 x, y, dx*2, dy, -1,
                                 x, y, dx,   dy, +2 ) );
                         }
                         // tilted haar_y2
                         if ( (x+dx <= winSize.width) && (y+dx+2*dy <= winSize.height) && (x-2*dy>= 0) ) 
                         {
-                            if ( x <= (winSize.width / 2) ) 
-                                features.push_back( Feature( offset, true,
+                            features.push_back( Feature( offset, true,
                                 x, y, dx, 2*dy, -1,
                                 x, y, dx, dy,   +2 ) );
                         }
                         // tilted haar_x3
                         if ( (x+3*dx <= winSize.width) && (y+3*dx+dy <= winSize.height) && (x-dy>= 0) ) 
                         {
-                            if ( x <= (winSize.width / 2) ) 
-                                features.push_back( Feature( offset, true,
+                            features.push_back( Feature( offset, true,
                                 x,    y,    dx*3, dy, -1,
                                 x+dx, y+dx, dx,   dy, +3 ) );
                         }
                         // tilted haar_y3
                         if ( (x+dx <= winSize.width) && (y+dx+3*dy <= winSize.height) && (x-3*dy>= 0) ) 
                         {
-                            if ( x <= (winSize.width / 2) ) 
-                                features.push_back( Feature( offset, true,
+                            features.push_back( Feature( offset, true,
                                 x,    y,    dx, 3*dy, -1,
                                 x-dy, y+dy, dx, dy,   +3 ) );
                         }
                         // tilted haar_x4
                         if ( (x+4*dx <= winSize.width) && (y+4*dx+dy <= winSize.height) && (x-dy>= 0) ) 
                         {
-                            if ( x <= (winSize.width / 2) ) 
-                                features.push_back( Feature( offset, true,
+                            features.push_back( Feature( offset, true,
                                 x,    y,    dx*4, dy, -1,
                                 x+dx, y+dx, dx*2, dy, +2 ) );
                         }
                         // tilted haar_y4
                         if ( (x+dx <= winSize.width) && (y+dx+4*dy <= winSize.height) && (x-4*dy>= 0) ) 
                         {
-                            if ( x <= (winSize.width / 2) ) 
-                                features.push_back( Feature( offset, true,
+                            features.push_back( Feature( offset, true,
                                 x,    y,    dx, 4*dy, -1,
                                 x-dy, y+dy, dx, 2*dy, +2 ) );
                         }