Accord.Vision.Detection.HaarFeature.GetSum C# (CSharp) Method

GetSum() public method

Gets the sum of the areas of the rectangular features in an integral image.
public GetSum ( IntegralImage2 image, int x, int y ) : double
image Accord.Imaging.IntegralImage2
x int
y int
return double
        public double GetSum(IntegralImage2 image, int x, int y)
        {
            double sum = 0.0;

            if (!Tilted)
            {
                // Compute the sum for a standard feature
                foreach (HaarRectangle rect in Rectangles)
                {
                    sum += image.GetSum(x + rect.ScaledX, y + rect.ScaledY,
                        rect.ScaledWidth, rect.ScaledHeight) * rect.ScaledWeight;
                }
            }
            else
            {
                // Compute the sum for a rotated feature
                foreach (HaarRectangle rect in Rectangles)
                {
                    sum += image.GetSumT(x + rect.ScaledX, y + rect.ScaledY,
                        rect.ScaledWidth, rect.ScaledHeight) * rect.ScaledWeight;
                }
            }

            return sum;
        }