Roma
Roma

Reputation: 49

convert pixel coordinates to map coordinates

I have an image A of dimension p x q. If I know the UTM coordinate of A(1,1) and A(p,q) and pixel size in meters.

How to convert the pixel coordinates to map coordinates in MATLAB?

Upvotes: 0

Views: 1041

Answers (1)

Adriaan
Adriaan

Reputation: 18177

Xsize = (1:p)*PixelSizeInMeter+UTM_x_onA11;
Ysize = (1:q)*PixelSizeInMeter+UTM_y_onA11;
figure;
surface(Xsize,Ysize,A);

Now you can plot your map using Xsize and Ysize. Since UTM is a Cartesian grid, life's quite easy: get the correct number of elements, multiply with the grid size and add the lower corner's coordinates to shift the plot to the correct location.

Upvotes: 1

Related Questions