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

GetHaarYWavelet() public method

Calculate vertical (Y) haar wavelet at the specified point.

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

public GetHaarYWavelet ( 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 GetHaarYWavelet(int x, int y, int radius)
        {
            int x1 = x - radius;
            int x2 = x + radius - 1;

            float a = GetRectangleSum(x1, y, x2, y + radius - 1);
            float b = GetRectangleSum(x1, y - radius, x2, y - 1);

            return (int)(a - b);
        }