2i
is a complex
number, the positive squareroot of -4
. It is nothing to do with your variable i
. I think you meant 2*i*2*j
(although your loop is not the correct way to iterate over a 2-D array, and you will access outside the bounds that you have malloc'd)
I think you intended
for (i = 0; i < output.GetX(); i++)
{
for (j=0; j < output.GetY(); j++)
{
output.GetData()[i * output.GetY() + j]
= input.GetData()[2*i*input.GetY() + 2*j];
}
}