|
@@ -87,6 +87,15 @@ std::string Operation::writeInfos()
|
|
|
return ss.str();
|
|
|
}
|
|
|
|
|
|
+double Equality::getVal ( const Features &feats, const int &x, const int &y )
|
|
|
+{
|
|
|
+ int xsize, ysize;
|
|
|
+ getXY ( feats, xsize, ysize );
|
|
|
+ double v1 = values->getVal ( feats, BOUND ( x + x1, 0, xsize - 1 ), BOUND ( y + y1, 0, ysize - 1 ), channel1 );
|
|
|
+ double v2 = values->getVal ( feats, BOUND ( x + x2, 0, xsize - 1 ), BOUND ( y + y2, 0, ysize - 1 ), channel2 );
|
|
|
+ return (double)(v1 == v2);
|
|
|
+}
|
|
|
+
|
|
|
double Minus::getVal ( const Features &feats, const int &x, const int &y )
|
|
|
{
|
|
|
int xsize, ysize;
|
|
@@ -141,28 +150,28 @@ double IntegralOps::getVal ( const Features &feats, const int &x, const int &y )
|
|
|
{
|
|
|
int xsize, ysize;
|
|
|
getXY ( feats, xsize, ysize );
|
|
|
- return computeMean ( *feats.integralImg, BOUND ( x + x1, 0, xsize - 1 ), BOUND ( y + y1, 0, ysize - 1 ), BOUND ( x + x2, 0, xsize - 1 ), BOUND ( y + y2, 0, ysize - 1 ), channel1 );
|
|
|
+ return computeMean ( *feats.feats, BOUND ( x + x1, 0, xsize - 1 ), BOUND ( y + y1, 0, ysize - 1 ), BOUND ( x + x2, 0, xsize - 1 ), BOUND ( y + y2, 0, ysize - 1 ), channel1 );
|
|
|
}
|
|
|
|
|
|
double GlobalFeats::getVal ( const Features &feats, const int &x, const int &y )
|
|
|
{
|
|
|
int xsize, ysize;
|
|
|
getXY ( feats, xsize, ysize );
|
|
|
- return computeMean ( *feats.integralImg, 0, 0, xsize - 1, ysize - 1, channel1 );
|
|
|
+ return computeMean ( *feats.feats, 0, 0, xsize - 1, ysize - 1, channel1 );
|
|
|
}
|
|
|
|
|
|
double IntegralCenteredOps::getVal ( const Features &feats, const int &x, const int &y )
|
|
|
{
|
|
|
int xsize, ysize;
|
|
|
getXY ( feats, xsize, ysize );
|
|
|
- return computeMean ( *feats.integralImg, BOUND ( x - x1, 0, xsize - 1 ), BOUND ( y - y1, 0, ysize - 1 ), BOUND ( x + x1, 0, xsize - 1 ), BOUND ( y + y1, 0, ysize - 1 ), channel1 );
|
|
|
+ return computeMean ( *feats.feats, BOUND ( x - x1, 0, xsize - 1 ), BOUND ( y - y1, 0, ysize - 1 ), BOUND ( x + x1, 0, xsize - 1 ), BOUND ( y + y1, 0, ysize - 1 ), channel1 );
|
|
|
}
|
|
|
|
|
|
double BiIntegralCenteredOps::getVal ( const Features &feats, const int &x, const int &y )
|
|
|
{
|
|
|
int xsize, ysize;
|
|
|
getXY ( feats, xsize, ysize );
|
|
|
- return computeMean ( *feats.integralImg, BOUND ( x - x1, 0, xsize - 1 ), BOUND ( y - y1, 0, ysize - 1 ), BOUND ( x + x1, 0, xsize - 1 ), BOUND ( y + y1, 0, ysize - 1 ), channel1 ) - computeMean ( *feats.integralImg, BOUND ( x - x2, 0, xsize - 1 ), BOUND ( y - y2, 0, ysize - 1 ), BOUND ( x + x2, 0, xsize - 1 ), BOUND ( y + y2, 0, ysize - 1 ), channel1 );
|
|
|
+ return computeMean ( *feats.feats, BOUND ( x - x1, 0, xsize - 1 ), BOUND ( y - y1, 0, ysize - 1 ), BOUND ( x + x1, 0, xsize - 1 ), BOUND ( y + y1, 0, ysize - 1 ), channel1 ) - computeMean ( *feats.feats, BOUND ( x - x2, 0, xsize - 1 ), BOUND ( y - y2, 0, ysize - 1 ), BOUND ( x + x2, 0, xsize - 1 ), BOUND ( y + y2, 0, ysize - 1 ), channel1 );
|
|
|
}
|
|
|
|
|
|
double HaarHorizontal::getVal ( const Features &feats, const int &x, const int &y )
|
|
@@ -175,7 +184,7 @@ double HaarHorizontal::getVal ( const Features &feats, const int &x, const int &
|
|
|
int lrx = BOUND ( x + x1, 0, xsize - 1 );
|
|
|
int lry = BOUND ( y + y1, 0, ysize - 1 );
|
|
|
|
|
|
- return computeMean ( *feats.integralImg, tlx, tly, lrx, y, channel1 ) - computeMean ( *feats.integralImg, tlx, y, lrx, lry, channel1 );
|
|
|
+ return computeMean ( *feats.feats, tlx, tly, lrx, y, channel1 ) - computeMean ( *feats.feats, tlx, y, lrx, lry, channel1 );
|
|
|
}
|
|
|
|
|
|
double HaarVertical::getVal ( const Features &feats, const int &x, const int &y )
|
|
@@ -188,7 +197,7 @@ double HaarVertical::getVal ( const Features &feats, const int &x, const int &y
|
|
|
int lrx = BOUND ( x + x1, 0, xsize - 1 );
|
|
|
int lry = BOUND ( y + y1, 0, ysize - 1 );
|
|
|
|
|
|
- return computeMean ( *feats.integralImg, tlx, tly, x, lry, channel1 ) - computeMean ( *feats.integralImg, x, tly, lrx, lry, channel1 );
|
|
|
+ return computeMean ( *feats.feats, tlx, tly, x, lry, channel1 ) - computeMean ( *feats.feats, x, tly, lrx, lry, channel1 );
|
|
|
}
|
|
|
|
|
|
double HaarDiag::getVal ( const Features &feats, const int &x, const int &y )
|
|
@@ -201,7 +210,7 @@ double HaarDiag::getVal ( const Features &feats, const int &x, const int &y )
|
|
|
int lrx = BOUND ( x + x1, 0, xsize - 1 );
|
|
|
int lry = BOUND ( y + y1, 0, ysize - 1 );
|
|
|
|
|
|
- return computeMean ( *feats.integralImg, tlx, tly, x, y, channel1 ) + computeMean ( *feats.integralImg, x, y, lrx, lry, channel1 ) - computeMean ( *feats.integralImg, tlx, y, x, lry, channel1 ) - computeMean ( *feats.integralImg, x, tly, lrx, y, channel1 );
|
|
|
+ return computeMean ( *feats.feats, tlx, tly, x, y, channel1 ) + computeMean ( *feats.feats, x, y, lrx, lry, channel1 ) - computeMean ( *feats.feats, tlx, y, x, lry, channel1 ) - computeMean ( *feats.feats, x, tly, lrx, y, channel1 );
|
|
|
}
|
|
|
|
|
|
double Haar3Horiz::getVal ( const Features &feats, const int &x, const int &y )
|
|
@@ -216,7 +225,7 @@ double Haar3Horiz::getVal ( const Features &feats, const int &x, const int &y )
|
|
|
int lrx = BOUND ( x + x2, 0, xsize - 1 );
|
|
|
int lry = BOUND ( y + y2, 0, ysize - 1 );
|
|
|
|
|
|
- return computeMean ( *feats.integralImg, tlx, tly, lrx, mtly, channel1 ) - computeMean ( *feats.integralImg, tlx, mtly, lrx, mlry, channel1 ) + computeMean ( *feats.integralImg, tlx, mlry, lrx, lry, channel1 );
|
|
|
+ return computeMean ( *feats.feats, tlx, tly, lrx, mtly, channel1 ) - computeMean ( *feats.feats, tlx, mtly, lrx, mlry, channel1 ) + computeMean ( *feats.feats, tlx, mlry, lrx, lry, channel1 );
|
|
|
}
|
|
|
|
|
|
double Haar3Vert::getVal ( const Features &feats, const int &x, const int &y )
|
|
@@ -231,7 +240,7 @@ double Haar3Vert::getVal ( const Features &feats, const int &x, const int &y )
|
|
|
int lrx = BOUND ( x + x2, 0, xsize - 1 );
|
|
|
int lry = BOUND ( y + y2, 0, ysize - 1 );
|
|
|
|
|
|
- return computeMean ( *feats.integralImg, tlx, tly, mtlx, lry, channel1 ) - computeMean ( *feats.integralImg, mtlx, tly, mlrx, lry, channel1 ) + computeMean ( *feats.integralImg, mlrx, tly, lrx, lry, channel1 );
|
|
|
+ return computeMean ( *feats.feats, tlx, tly, mtlx, lry, channel1 ) - computeMean ( *feats.feats, mtlx, tly, mlrx, lry, channel1 ) + computeMean ( *feats.feats, mlrx, tly, lrx, lry, channel1 );
|
|
|
}
|
|
|
|
|
|
void IntegralOps::set ( int _x1, int _y1, int _x2, int _y2, int _channel1, int _channel2, ValueAccess *_values )
|