Page 212 - MATLAB Recipes for Earth Sciences
P. 212

8.5 Georeferencing Satellite Images                             207

             imwrite(naivasha_rgb,'naivasha.tif','tif')
           This command saves the RGB composite as a TIFF-fi le naivasha.tif (ca.
           50  MB large) in the working directory that can be processed with other
           software such as Adobe Photoshop.



           8.5 Georeferencing Satellite Images

           The processed ASTER image does not yet have a coordinate system. Hence,
           the image needs to be tied to a geographical reference frame ( georeferenc-
           ing). The raw data can be loaded and transformed into a RGB composite
           by typing

             I1 = hdfread('naivasha.hdf','VNIR_Band3N','Fields','ImageData');
             I2 = hdfread('naivasha.hdf','VNIR_Band2','Fields','ImageData');
             I3 = hdfread('naivasha.hdf','VNIR_Band1','Fields','ImageData');

             naivasha_rgb = cat(3,I1,I2,I3);
           The  HDF browser can be used

             hdftool('naivasha.hdf')

           to extract the geodetic coordinates of the four corners of the image. This
           information is contained in the header of the HDF file. Having launched the

           HDF tool, we activate File as HDF and select on the uppermost directory
           naivasha.hdf. This produces a long list of file attributes including product-

           metadata.0, which includes the attribute scenefourcorners that contains the
           following information:

             upperleft = [-0.319922, 36.214332];
             upperright = [-0.400443, 36.770406];
             lowerleft = [-0.878267, 36.096003];
             lowerright = [-0.958743, 36.652213];

           These two-element vectors can be collected into one array inputpoints.

           Subsequently, the left and right columns can be flipped in order to have
           x=longitudes and y=latitudes.
             inputpoints(1,:) = upperleft;
             inputpoints(2,:) = lowerleft;
             inputpoints(3,:) = upperright;
             inputpoints(4,:) = lowerright;
             inputpoints = fliplr(inputpoints);
   207   208   209   210   211   212   213   214   215   216   217