Accord.Imaging.UnsafeTools.Sum C# (CSharp) Method

Sum() public static method

Computes the sum of all pixels within a given image region.
public static Sum ( byte src, int width, int height, int stride ) : int
src byte The image region.
width int The region width.
height int The region height.
stride int The image stride.
return int
        public static int Sum(byte* src, int width, int height, int stride)
        {
            int sum = 0;

            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++, src++)
                    sum += *src;

                src += stride - width;
            }

            return sum;
        }