Geoscience Reference
In-Depth Information
xmax = input('Specify xmax! ');
ymin = input('Specify ymin! ');
ymax = input('Specify ymax! ');
% Read image and display
B = imread(imagefile);
a = size(B,2); b = size(B,1);
imshow(B);
% Define lower left and upper right corner of image
disp('Click on lower left and upper right corner, then <return>')
[xcr,ycr] = ginput;
XMIN = xmin-((xmax-xmin)*xcr(1,1)/(xcr(2,1)-xcr(1,1)));
XMAX = xmax+((xmax-xmin)*(a-xcr(2,1))/(xcr(2,1)-xcr(1,1)));
YMIN = ymin-((ymax-ymin)*ycr(1,1)/(ycr(2,1)-ycr(1,1)));
YMAX = ymax+((ymax-ymin)*(b-ycr(2,1))/(ycr(2,1)-ycr(1,1)));
% Digitize data points
disp('Click on data points to digitize, then <return>')
[xdata,ydata] = ginput;
XDATA = XMIN + ((XMAX-XMIN)*xdata/size(B,2));
YDATA = YMIN + ((YMAX-YMIN)*ydata/size(B,1));
data(:,1) = XDATA; data(:,2) = YDATA;
h e function minput has four stages. In the i rst stage the user enters the limits
of the coordinate axes as reference points for the image. h e image is then
imported into the workspace and displayed on the screen. h e third stage
uses ginput to dei ne the upper let and lower right corners of the image. In
the fourth stage the relationship between the coordinates of the two corners
on the i gure window and the reference coordinate system is then used to
compute the transformation for all of the digitized points.
As an example we use the image stored in the i le naivasha_georef.jpg and
digitize the outline of Lake Naivasha in the center of the image. We activate
the new function minput from the Command Window using the commands
clear
data = minput('naivasha_georef.jpg')
h e function i rst asks for the coordinates of the limits of the x -axis and the
y -axis, for the reference frame. We enter the corresponding numbers and
press return at er each input.
Specify xmin! 36.1
Specify xmax! 36.7
Specify ymin! -1
Specify ymax! -0.3
h e function then reads the i le naivasha_georef.jpg and displays the image.
We ignore the warning
Search WWH ::




Custom Search