ImageProcessor.Imaging.FastBitmap.GetSum2 C# (CSharp) Метод

GetSum2() публичный Метод

Gets the sum of the squared pixels in a rectangle of the Integral image.
public GetSum2 ( int x, int y, int rectangleWidth, int rectangleHeight ) : long
x int The horizontal position of the rectangle x.
y int The vertical position of the rectangle y.
rectangleWidth int The rectangle's width w.
rectangleHeight int The rectangle's height h.
Результат long
        public long GetSum2(int x, int y, int rectangleWidth, int rectangleHeight)
        {
            int a = (this.normalWidth * y) + x;
            int b = (this.normalWidth * (y + rectangleHeight)) + (x + rectangleWidth);
            int c = (this.normalWidth * (y + rectangleHeight)) + x;
            int d = (this.normalWidth * y) + (x + rectangleWidth);

            return this.squaredSum[a] + this.squaredSum[b] - this.squaredSum[c] - this.squaredSum[d];
        }