Import Landsat Files and Create Composite RGB Image

Before reading this example, review the Combining Channels into Images topic.

Landsat 7 images are often delivered as several .dat files that are accompanied by one or more header files. Each frequency band acquired by the satellite has one .dat file. For example, band 3 is Red, band 2 is Green and band 1 is Blue. The header files give information on the organization of the files.

In this example we import Landsat 7 Fast-L7A format .dat files to create a composite RGB image. We then alter the image to provide better contrast. Finally, we combine the RGB image with a higher resolution panchromatic image to provide an image that has both high resolution and color tinting. The result is an enhanced image that has much better readability than default R, G, B composites created using Landsat bands.

Step 1: Determine image sizes

By reviewing the header files (we can open them with Notepad or import them as comments components into Manifold) we can see the organization of the .dat files.

PIXELS PER LINE = 1720 LINES PER BAND = 3322

The header.hpr file in the line above tells us that most bands have 1270 width (pixels per line) and 3322 height (lines per band). The .hpr file defines parameters for bands 1, 2, 3, 4, 5, and 7.

Similarly, the header.hpn file tells us that the panchromatic band has 3440 height and 6644 width. This makes sense, since we know from the PIXEL SIZE parameter listed in the header files that most Landsat 7 bands provide 25 meter resolution while the panchromatic band provides 12.5 meter resolution. For the same area the panchromatic band therefore should have twice as many pixels as the other bands. The header.htm file provides information for the relatively low resolution bands 6h and 6l, which have pixels that are 50 meters in size. These bands are not used in this example.

Note: the example uses a recent Landsat 7 data set using the Fast-L7A data format. Older Landsat data has lower resolution, with 30 meter resolution in most bands and 15 meter resolution in the panchromatic band. Read the header files to see the exact specifications for your data set. The header.htm file provides information for the relatively low resolution bands 6h and 6l, which have pixels that are 50 meters in size.

Step 2: Import .dat files

Use File - Import - Surface with Files of Type set to Raw Binary Files (*.bin, *.dat, *.*) to import band1.dat.

images/eg_landsat_01.png

In the Import Raw Binary File dialog we use the settings shown above with a Width of 1720 and a Height of 3322. Press OK. The result of the import is a new surface. Import band2.dat and band3.dat using the same settings.

images/eg_landsat_02.png

When we finish the imports we will see three surfaces in our project file. The Header comment component was created when we imported the header.hpr file (not shown explicitly in this example) as a comment. We did this to find out the values of Width and Height to use for importing.

Step 3: Create mask images

We will now create grayscale mask images from the surfaces. These can then be combined in the R, G and B channels of an RGB image to create a composite color image.

Open the Band1 surface. It appears as a speckled pattern. Choose View - Display Options to open the Display Options dialog.

images/eg_landsat_03.png

In the Display Options dialog, uncheck the Shading and Autocontrast boxes. Press OK.

images/eg_landsat_04.png

The result is a visible "image" seen in the surface window. It is a grayscale representation of the contents of Band1, the blue band from Landsat's Enhanced Thematic Mapper remote sensing instrument.

To save Band1 as an image, we click on Edit - Save Mask / Channel.

images/eg_landsat_05.png

In the Save Mask / Channel dialog we choose Channel: grayscale in the Save To box. In the To box we provide the name of the image to be created. We will enter Band 1 (Blue) so that later we will not be confused what the origin is of this image or what the intended usage of it is. Press OK and a new image called Band 1 (Blue) will be created. This new image is exactly the same size as the surface from which it was created: 1720 by 3322 pixels.

We can repeat the above process for the Band2 and Band3 surfaces. We open each surface in turn and use Save Mask / Channel to create an image from it.

images/eg_landsat_06.png

The result of our work so far is that we now have three surfaces and three images created from them. We don't need the surfaces any more so if we are working on a machine with limited RAM we can delete them if desired.

Step 4: Create an RGB image and load R, G and B channels

We will now create an RGB image and then populate the R, G and B channels of the image from the mask images we created in the previous step.

images/eg_landsat_07.png

We begin by creating a new RGB image. Double-click open one of the mask images, such as Band 1 (Blue). Next, choose File - Create - Image and enter the above values into the Create Image dialog. Note that the size of the image is specified as exactly the same size as the surfaces originally imported and the mask images created from them: 1720 by 3322 pixels.

A digression: We clicked open the Band 1 ( Blue) image because any newly-created image will use whatever coordinate system is in use by an open image window that has the focus when the new image is created. This is a nuance that has no effect in this example as written because all images so far are in the default Orthographic projection; however, if we had georegistered the band surfaces when they were first imported (to, say, UTM projection normally used with Landsat images) we would want all subsequent components to be created using the same projection.

images/eg_landsat_08.png

We open the new image and see it is entirely black (as a newly created image will be by default). We can now populate it with R, G and B channel information from the saved mask images.

images/eg_landsat_09.png

Choose Edit - Load Mask/Channel and in the Load Mask/Channel dialog specify the red channel in the Load box and the Band 3 (Red) image in the From box. We use the default mode, Replace, so the contents of the mask override whatever is in the image's red channel. Press OK.

images/eg_landsat_10.png

The red channel will now be populated in our image. Since only red values appear, the image will seem to be a reddish rendition of the Band 3 ( Red) grayscale image.

images/eg_landsat_11.png

We choose Edit - Load Mask/Channel once again and in the Load Mask/Channel dialog we specify the green channel in the Load box and the Band 2 (Green) image in the From box. Press OK.

images/eg_landsat_12.png

The green channel will now be populated as well as the red channel. Since greens and reds together make yellows, the image appears mostly in yellow tones.

images/eg_landsat_13.png

Yet again we choose Edit - Load Mask/Channel and in the Load Mask/Channel dialog we specify the blue channel in the Load box and the Band 1 (Blue) image in the From box. Press OK.

images/eg_landsat_14.png

With all three channels populated the image appears in "natural" shades. Like many Landsat images it seems to have poor contrast as if seen through a hazy atmosphere. Image processing within Manifold and use of other bands can improve the contrast.

Step 5: Process image for better appearance

If desired, we can open each of the band images, such as Band 1 (Blue), and adjust their brightness and contrast. We can then load the R, B and G channels again using the adjusted band masks.

images/eg_landsat_15.png

Opening the Band 1 (Blue) image we see it does not have a very great contrast variation.

images/eg_landsat_16.png

Using the Brightness / Contrast command we can increase the contrast and decrease the brightness slightly. We will also open the Band 2 ( Green) image and increase the contrast on that image as well.

We can also import band7.dat which provides an image using infrared frequencies. We will import band7.dat and create a mask image from it as we did for the other three bands in step 3 above. We can then open the resultant mask image and increase the contrast on that image.

images/eg_landsat_17.png

Next, we repeat step 4 above to re-load the R, G and B channels of the composite RGB image. We use the increased contrast blue and green mask images and the new, increased contrast infrared image for the red channel. This achieves a composite image with enhanced appearance.

images/eg_landsat_18.png

If desired, we can adjust the Brightness / Contrast on this image and also increase the saturation using Hue / Saturation to achieve even greater definition.

Step 6: Incorporate panchromatic band for increased resolution

We can increase the resolution of the image yet further by combining information from the panchromatic Landsat band. The Landsat bands used so far have a resolution of 25 meters per pixel.

images/eg_landsat_20a.png

We can specify this for the composite image by opening the Edit - Projection - Current Projection dialog (called by pressing the Current Projection button in the Edit - Projection dialog) and specifying 25 meters as the X and Y Local scale.

However, the panchromatic instrument in Landsat creates a grayscale image using green to infrared wavelengths that has 12.5 meter resolution. We can import this surface from band8.dat using a setting of 3440 for width and 6644 for height. Like the other images, we can create an image from the surface using Edit - Save Mask/Channel. We can then open the mask image and increase the contrast slightly.

images/eg_landsat_21.png

The result is seen above, zoomed into the same area shown in the other illustrations. Clearly, the panchromatic instrument provides better resolution. We can exploit this enhanced resolution by using the panchromatic image together in a map with the composite RGB image.

images/eg_landsat_21a.png

To do so, we first have to tell Manifold the pixel size of the panchromatic image. We do this by opening Edit - Projection - Current Projection and specifying 12.5 meters as the X and Y Local scale.

Next, we create a map component using the panchromatic image, we open the map and then we drag and drop the composite RGB image into the map. Drag the composite image layer to below the panchromatic layer. Change the opacity of the panchromatic image to 70% so the colors from the composite image underneath can show through. Finally, open the composite image in its own window and increase the saturation using Hue / Saturation to a very high value so that the colors seen in the map window will be reasonably clear even though they are seen through the panchromatic grayscale image.

images/eg_landsat_22.png

The result (seen above) provides visual cues from the high resolution grayscale panchromatic image that are tinted by the colors from the composite RGB image seen from below. Our eye is assisted by the black and white detail from the high-resolution image into seeing a clearer picture of the landforms.

However, the image could have better contrast. There are several ways to accomplish increased contrast. One way is to alter the contrast of the panchromatic image and to adjust the opacity to allow more or less of the RGB image to show through. A different way is to merge the panchromatic image and the RGB image into a single image and to then make contrast adjustments to that combined image.

To merge our map view of the partially transparent panchromatic image and the RGB image into a single image, with the map view open we create a layout for the map, and then the Tools - Make Image command to create a single image from the map at whatever resolution is desired. Note that Make Image preserves the coordinate system (projection) of whatever component it images.

images/eg_landsat_23.png

We can then open the resulting image and apply commands such as Autocontrast in the transform toolbar to create the result seen above. Clearly, it's a long way from the original assembly of R, G and B channels as seen below.

images/eg_landsat_19.png

Step 7: Georegistering the image

When Landsat bands are imported as surfaces they are imported using the default Orthographic projection with a scale of one pixel per meter. All components created from these original surfaces will have the same projection. To superimpose different bands having different pixel sizes upon each other in a map we must at least inform Manifold of the scales for each image using the Edit - Projection - Current Projection dialog as done above.

To use the images in any geographic context we must also tell Manifold what projection is to be used. If we know the projection (from, for example, a reading of the header files) we can specify the projection in Edit - Projection - Current Projection as well. The image will then be georegistered.

If the Landsat image is to be correctly georegistered, this would actually be one of the first steps in the process, immediately upon importing the .dat files. However, since many users will employ a Landsat image purely for visual effect and don't care whether it is registered or now we have placed this step at the end of the sequence.

To georegister the Landsat image we need to know what projection was used for it. From the header.hrf file giving specifications for all bands except 8 and 6h and 6l we read:

GEOMETRIC DATA MAP PROJECTION =UTM

ELLIPSOID =GRS80

DATUM =GDA

USGS MAP ZONE = 55

LL = 1462457.5412E 432422.2444S 452712.500 5193912.500

The LL values provide the coordinate location of the lower left corner of the display with the first pair of numbers given in degrees - minutes - seconds and the second being the offset in meters within the UTM zone 55 projection coordinate system. This magic information may be found through careful reading of documentation for Landsat.

To georegister this image, all we need do is correct the projection information loaded by default (Orthographic) into what the projection of the image actually is. To do this, we use the Edit - Projection - Current Projection dialog:

images/eg_landsat_20.png

From the header.hrf file we know the projection is UTM zone 55. We know that this is the UTM zone from the Universal Transverse Mercator (South) collection of UTM projections because the LL value gives a South latitude in the degrees - minutes - seconds pair of numbers for LL. Expert readers will immediately realize the Landsat image in question is in the Southern Hemisphere (it shows a forest region in Tasmania).

The datum is set to Geodetic Reference 1980 using the ellipsoid and datum information in header.hrf as well. Sometimes when parsing government header files it is important to know what the various abbreviations (such as GRS80 and GDA) mean. Enough digging into documentation available on Internet will usually provide answers.

The Local offset values are taken directly from the second pair of LL values. The values for Local scale are taken from the PIXEL SIZE value given in header.hrf. This pixel size will be different for the other bands.

Notes

The above commentary on georegistering a Landsat image has been placed in Step 7 at the end of this topic in order not to confuse those readers who will be working with Landsat images for purely visual presentation where georegistration is not necessary.

When users desire a georegistered Landsat image, most will georegister the bands right after they import them in Step 2. All subsequent components created from the bands (such as images used as masks or composite images) will then also be georegistered. To assure the composite RGB image is georegistered, make sure one of the mask images is opened and has the focus when the new RGB image is created. The new, blank image will then be created using the same coordinate system as the image that currently has the focus.

Back to Manifold Home Page