Loading and manipulating the multispectral images

The multispectral images can be stored in various formats. A common format that is often used to store geospatial map data gathered from satellites is the ERDAS LAN format, which uses the extension .lan. MATLAB can read these kinds of files using the function multibandread. Since the files are multiband, in order for us to be able to visualize it in RGB, we must be able to limit the channels to three. This can be done in a single line of code, since multibandread can define the bands that will be read into MATLAB. More details about using this function can be given using our usual tool, which is the help command:

>> help multibandread

The output of the previous code is as follows:

multibandread Read band interleaved data from a binary file
    X = multibandread(FILENAME,SIZE,PRECISION,
                       OFFSET,INTERLEAVE,BYTEORDER)
    reads band-sequential (BSQ), band-interleaved-by-line (BIL), or
    band-interleaved-by-pixel (BIP) data from a binary file, FILENAME.  X is
    a 2-D array if only one band is read, otherwise it is 3-D. X is returned
    as an array of data type double by default.  Use the PRECISION argument
    to map the data to a different data type.

The rest is rather lengthy, so we will leave it at that. The most important thing is that the function is rather complex and uses several inputs to define how it works. We will try to demonstrate its use with some useful multiband image processing techniques.

Let's use one of the .lan files included in the Image Processing Toolbox to demonstrate some basic processing steps. Since, the documentation of MATLAB covers the Landsat imagery of Paris, France, we will use another example. But first, let's see our choices.

The images included in MATLAB 2012b for use in the examples given in the documentation are placed in the folder home oolboximagesimdemos, where home is the installation directory of MATLAB. In our case, this is c:MATLAB2012b. Hence, we can have a look at the images included in this directory, using the following, DOS-like, line of code:

>> dir('C:MATLABR2012b	oolboximagesimdemos*.lan')

This leads to the following result:

Loading and manipulating the multispectral images

In general, the function dir is the same as in DOS; it lists the directories of the current directory. When it is called with a specified path as an input, it lists the contents of the directory specified. The use of the wildcard symbol (*) in our example, asks dir to list all the files in the specified path ending with .lan.

Now that we know there are six different landsat images included in MATLAB, we can choose which one we want to use in our example. Let's use Rio, Brazil.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset