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

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

Gets the sum of the pixels in a rectangle of the Integral image.
public GetSum ( 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 GetSum(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.normalSum[a] + this.normalSum[b] - this.normalSum[c] - this.normalSum[d];
        }