your image2D you are copying should be function of loop variables.