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

GetHaarXWavelet() public method

Calculate horizontal (X) haar wavelet at the specified point.

The method calculates horizontal wavelet, which is a difference of two horizontally adjacent boxes' sums, i.e. A-B. A is the sum of rectangle with coordinates (x, y-radius, x+radius-1, y+radius-1). B is the sum of rectangle with coordinates (x-radius, y-radius, x-1, y+radiys-1).

public GetHaarXWavelet ( int x, int y, int radius ) : int
x int X coordinate of the point to calculate wavelet at.
y int Y coordinate of the point to calculate wavelet at.
radius int Wavelet size to calculate.
return int
        public int GetHaarXWavelet(int x, int y, int radius)
        {
            int y1 = y - radius;
            int y2 = y + radius - 1;

            long a = GetRectangleSum(x, y1, x + radius - 1, y2);
            long b = GetRectangleSum(x - radius, y1, x - 1, y2);

            return (int)(a - b);
        }