public void GetSumTest4()
{
byte[,] img =
{
{ 1, 1, 1, 1, 1, 1 },
{ 1, 1, 1, 1, 1, 1 },
{ 1, 1, 1, 1, 1, 1 },
{ 1, 1, 1, 1, 1, 1 },
{ 1, 1, 1, 1, 1, 1 },
{ 1, 1, 1, 1, 1, 1 },
};
Bitmap bmp = Accord.Imaging.Tools.ToBitmap(img);
IntegralImage2 ii = IntegralImage2.FromBitmap(bmp, 0, true);
// http://software.intel.com/sites/products/documentation/hpc/ipp/ippi/ippi_ch11/functn_TiltedIntegral.html
long[,] expected = tiltedIntegral3(img);
long[,] iit =
{
{ 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0 },
{ 1, 3, 5, 6, 6, 5, 3 },
{ 3, 6, 9, 11, 11, 9, 6 },
{ 6, 10, 14, 16, 16, 14, 10 },
{ 10, 15, 19, 21, 21, 19, 15 },
{ 15, 19, 22, 24, 24, 22, 19 },
};
long[,] iit2 =
{
{ 1, 3, 6, 10, 15, 19, 0 },
{ 1, 4, 8, 13, 18, 22, 0 },
{ 1, 4, 9, 14, 19, 23, 0 },
{ 1, 4, 8, 13, 18, 22, 0 },
{ 1, 3, 6, 10, 15, 19, 0 },
{ 0, 1, 3, 6, 10, 15, 0 },
};
long[,] iit3 =
{
{ 0, 0, 0, 1, 3, 6, 10, 15 },
{ 0, 0, 1, 3, 6, 10, 15, 21 },
{ 0, 0, 1, 4, 8, 13, 19, 25 },
{ 0, 0, 1, 4, 9, 15, 21, 27 },
{ 0, 0, 1, 4, 9, 15, 21, 27 },
{ 0, 0, 1, 4, 8, 13, 19, 24 },
{ 0, 0, 1, 3, 6, 10, 14, 18 },
{ 0, 0, 0, 1, 3, 5, 7, 9 }
};
Assert.IsTrue(Matrix.IsEqual(iit3, expected));
long[,] actual = ii.Rotated;
Assert.IsTrue(Matrix.IsEqual(expected, actual));
}