private static tiltedIntegral2 ( byte img ) : ].int[ | ||
img | byte | |
Результат | ].int[ |
private static int[,] tiltedIntegral2(byte[,] img)
{
int val = 0;
int[,] expected = new int[img.GetLength(0) + 1, img.GetLength(0) + 1];
for (int x = 0; x < img.GetLength(0) + 1; x++)
{
for (int y = 0; y < img.GetLength(1) + 1; y++)
{
int sum = val;
for (int xl = 0; xl < img.GetLength(0); xl++)
{
for (int yl = 0; yl < img.GetLength(1); yl++)
{
if (xl <= x &&
xl <= x - System.Math.Abs(y - yl))
sum += img[yl, xl];
}
}
expected[y, x] = sum;
}
}
return expected;
}