Your pixelOffset calculations are inconsistent...
int pixelOffset = y + normX * 51;
is different than...
int j = x + normX;
int i = y + normY;
int pixelOffset = j + i * 51;
One uses x * 51 + y and the other uses y * 51 + x.
Your pixelOffset calculations are inconsistent...
int pixelOffset = y + normX * 51;
is different than...
int j = x + normX;
int i = y + normY;
int pixelOffset = j + i * 51;
One uses x * 51 + y and the other uses y * 51 + x.