Don't return axis positions for every single pixel - instead, always sample a reasonable number of points along each axis. This will improve accuracy for low-resolution images, and performance for large fields of view.