Accord.Imaging.IntegralImage.GetRectangleSum C# (CSharp) Method

GetRectangleSum() public method

Calculate sum of pixels in the specified rectangle.

The method calculates sum of pixels in square rectangle with odd width and height. In the case if it is required to calculate sum of 3x3 rectangle, then it is required to specify its center and radius equal to 1.

public GetRectangleSum ( int x, int y, int radius ) : uint
x int X coordinate of central point of the rectangle.
y int Y coordinate of central point of the rectangle.
radius int Radius of the rectangle.
return uint
        public uint GetRectangleSum(int x, int y, int radius)
        {
            return GetRectangleSum(x - radius, y - radius, x + radius, y + radius);
        }

Same methods

IntegralImage::GetRectangleSum ( int x1, int y1, int x2, int y2 ) : uint

Usage Example

        private double haarX(int row, int column, int size)
        {
            double a = integral.GetRectangleSum(column, row - size / 2,
                                                column + size / 2 - 1, row - size / 2 + size - 1);

            double b = integral.GetRectangleSum(column - size / 2, row - size / 2,
                                                column - size / 2 + size / 2 - 1, row - size / 2 + size - 1);

            return((a - b) / 255.0);
        }
All Usage Examples Of Accord.Imaging.IntegralImage::GetRectangleSum