Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
% Information copied from the map.yaml file
% NOTE: These numbers will change on a case-by-case basis!
resolution = 0.05;
origin = [-10.000000, -21.200000, 0.000000];

% Read the image - assumes the image file is in your home directory, change path as necessary
ifile = '.~/map.pgm';   % Image file name
I=imread(ifile);

% Span of image in meters
dx = size(I,1)*resolution;
dy = size(I,2)*resolution;

% Set the size scaling
xWorldLimits = [0 dx]+origin(1);
yWorldLimits = [0 dy]+origin(2);
% Reference to world coordinates (meters)
RI = imref2d(size(I),xWorldLimits,yWorldLimits)
 
% Plot
figure(1);
clf()
imshow(flipud(I),RI)
set(gca,'YDir','normal')

% Optionally, put a maker at the origin
hold on;
plot(0,0,'r*')

...