fixed a bug in retrieving the pixel data in the gradient magnitude map