Mosaicking Using ENVI - Tutorial of ENVI Software - Completely GIS, GPS, and Remote Sensing Lecture Material - facegis.com
Mosaicking Using ENVI

Overview of This Tutorial

This tutorial is designed to give you a working knowledge of ENVI's image mosaicking capabilities. For additional details, please see the ENVI User's Guide or ENVI On-Line-Help.

Files Used in this Tutorial

You must have the ENVI TUTORIALS & DATA CD-ROM mounted on your system to access the files used by this tutorial, or copy the files to your disk.

The files used in this tutorial are contained in the AVMOSAIC subdirectory of the ENVIDATA directory on the ENVI TUTORIALS & DATA CD-ROM.

Required Files

The files listed below are required to run this exercise.

Pixel-Based Mosaicking

DV06_2.IMG	AVIRIS Scene 02
DV06_2.HDR	ENVI Header for Above
DV06_3.IMG	AVIRIS Scene 03
DV06_3.HDR	ENVI Header for Above
DV06A.MOS	Mosaic Template for end-to-end AVIRIS mosaic
DV06B.MOS	Mosaic Template for feathered overlapping AVIRIS mosaic
DV06_FEA.IMG	Feathered Mosaic image
DV06_FEA.HDR	ENVI Header for Above

Georeferenced Mosaicking

LCH_01W.IMG	Warped, histogram matched image
LCH_01W.HDR	ENVI Header for Above
LCH_01W.ANN	Cut-line feathering annotation for above
LCH_02W.IMG	Warped, histogram matched image
LCH_02W.HDR	ENVI Header for Above
LCH_A.MOS	Mosaic Template for Georeferenced Image Mosaicking
LCH_MOS1.IMG	Georeferenced mosaic result
LCH_MOS1.HDR	ENVI Header for Above

Background - Mosaicking in ENVI

Mosaicking is the art of combining multiple images into a single composite image. It can be used to combine pixel-based images, to lay out images for publication or map composition, or as a means for combining georeferenced images into an image covering a larger geographic area. ENVI provides interactive capabilities for placing pixel-based images within a mosaic, and automated placement of georeferenced images within a georeferenced output mosaic. The software provides tools for common mosaic requirements such as blending edges (feathering), image border transparency, and histogram matching. ENVI's Virtual Mosaic capability allows users to optionally create and display mosaics without creating large output files.


General Topics

The following sections walk you through some of the preparation required to make mosaics in ENVI. The actual start of the exercises begins with the section "Pixel-based Mosaicking Example" or alternatively, for georeferenced mosaicks in the section " Georeferenced Mosaicking Example".

Start ENVI

Before attempting to start the program, ensure that ENVI is properly installed as described in the installation guide.

  • To open ENVI in Unix, enter " envi " at the UNIX command line.
  • To open ENVI from a Windows or Macintosh system, d ouble-click on the ENVI icon.

The ENVI Main Menu appears when the program has successfully loaded and executed.

Preparing Images

Raw image data can be mosaicked together if desired (ENVI can be used to easily produce multiband mosaics of multiple data types), however, most mosaics are for output and usually require scaling (contrast stretching), and histogram matching to minimize image differences in the output mosaic. The first step in a mosaic using ENVI is usually to contrast stretch the images. This is done by displaying the bands to be mosaicked and either using one of ENVI's quick (default) stretches or using ENVI's interactive contrast stretching capabilities. For mosaics with overlapping images, see the histogram matching description below in the Georeference Image Mosaic example.

  1. Start in either the Pixel-Based or the Georeferenced Image Mosaic section below and open the appropriate images by navigating to the AVMOSAIC subdirectory of the ENVIDATA directory on the ENVI TUTORIALS & DATA CD-ROM just as you would in any other application, selecting the desired file from the list and clicking "OK".

Open the files

  1. Select File ->Open Image File.

Note that on some platforms you must hold the left mouse button down to display the submenus from the Main Menu.

An Enter Input Data File file selection dialog appears.

  1. Display the image(s) by selecting the desired bands in the Available Bands List and clicking "Load".
  2. Click the right mouse button in the Main Image window to toggle the Functions menu and select Functions->Display Enhancements->Default (quick) Stretches->the desired stretch type, or select Functions->Display Enhancements->Interactive Stretching.
  3. Stretch the image to enhance the desired image features and output to memory or a new file by selecting Functions->Output Display->Image File in the Main Display window.

Histogram Matching

When mosaicking two or more images that overlap, it is usually necessary to choose a base image and balance grayscales in the rest of the images to match the base image. This is called histogram matching (Richards, 1993). ENVI's interactive contrast stretching function provides interactive tools to perform histogram matching. The procedure for performing the histogram matching is described below.

The following steps are provided for information and are not to be executed as part of this tutorial.

  1. Display the two images to be histogram matched in two display windows.
  2. Identify the overlap areas, position the zoom windows of both images within the overlap, and resize and/or reposition the Zoom window to cover exactly the same region in both images (try to cover as large an area as possible and a broad range of cover types).
  3. Select Functions->Display Enhancements->Interactive Stretching in both Main Display windows.

The Contrast Stretching dialog will appear.

  1. Stretch the first or base image to show the desired contrast stretch using any of ENVI's contrast stretching methods.
  2. In the base image Contrast Stretching dialog, choose Histogram_Source->Zoom.

The input and output histograms will be shown for the data in the zoom window.

  1. In the second contrast stretching dialog, also select Histogram_Source->Zoom.
  2. Also select Stretch_type->Arbitrary in the second dialog.
  3. In the base contrast stretching dialog, click the left mouse button on the first letter of the word "Output Histogram", hold the button down, drag the text to the output histogram of the second contrast stretching dialog, and release the button.

The output histogram from the base image will be applied to the histogram of the second image.

  1. Click "Apply" in the second dialog to apply this contrast stretch to the image being histogram matched.

The two stretched images should now have the same grayscale characteristics.

  1. Save the contrast stretched images by selecting Functions->Output Display ->Image File in both Main Displays.
  2. Select to save the stretched files either to memory or to new output files.
  3. Repeat for additional overlapping images as required.

You may want to try the histogram matching yourself for the second part of this tutorial, however, for the purpose of this exercise, the prestretched, histogram-matched images LCH_01W.IMG and LCH_02W.IMG are provided, as input to the georeferenced mosaicking function.

Feathering

It is often desirable to blend or blur the seams between mosaicked images. ENVI provides the capability of feathering the edges of overlapping areas using either edge feathering or cutline feathering over a user specified distance. To use feathering when mosaicking images, import the bottom image without feathering. Import the overlapping images with feathering, either edge or cutline, as desired.

Edge Feathering Mosaicking Using ENVI - Tutorial - facegis.com

Edge Feathering uses the distance specified in the "Edge feathering distance (pixels)" text box in the Mosaic Entry Input Parameters dialog to blend the image seams along the edges of the image. The edge feathering distance specified is blended using a linear ramp that averages the two images across that distance. For example, if the specified distance is 20 pixels, 0% of the top image is used in the blending at the edge and 100% of the bottom image is used to make the output image. At the specified distance (20 pixels) in from the edge, 100% of the top image is used to make the output image and 0% of the bottom image is used. 50% of each image is used to make the output at 10 pixels in from the edge.

Cut-Line FeatheringMosaicking Using ENVI - Tutorial - facegis.com

Cut-Line Feathering uses the distance specified in the "Cutline feathering distance (pixels)" text box and the annotation file selected from "Ann File" in the Mosaic Entry Input Parameters dialog to blend the image boundaries. Cutlines must be defined using the annotation tools prior to mosaicking. The annotation file must contain a polyline defining the cutline that is drawn from edge-to-edge and a symbol placed in the region of the image that will be cut off. The cutline distance specified is used to create a linear ramp that averages the two images across that distance from the cutline outwards. For example, if the specified distance is 20 pixels, 100% of the top image is used in the blending at the cutline and 0% of the bottom image is used to make the output image. At the specified distance (20 pixels) out from the cutline, 0% of the top image is used to make the output image and 100% of the bottom image is used. 50% of each image is used to make the output at 10 pixels out from the cutline.

Virtual Mosaics

ENVI allows use of the mosaic template file as a means of constructing a "Virtual Mosaic" - a mosaic that can be displayed and used by ENVI without actually creating the mosaic output file.

  1. To create a virtual mosaic, create the mosaic as described above and save the template file.
  2. To use the mosaic in ENVI as a virtual mosaic, select File->Open Image File from the ENVI Main Menu and open the mosaic template file.

All of the images used in the mosaic will be opened and their bands listed as a mosaic image in the Available Bands list. Display or process any of the bands in the virtual mosaic, and ENVI will treat the individual images as if they were in an actual mosaic output file.

  1. The new processed file will have the specified size of the mosaic and the input files will be in their specified positions within the mosaic.

Steps for Creating a Pixel-Based Mosaic

The following describes the steps required to create a pixel-based image mosaic.

Set up the Mosaicking Dialog

  1. Select Register->Mosaic Images->Pixel Based Images from the ENVI Main Menu.

The pixel-based option can also be used to place georeferenced images, where the georeferencing information will not be retained. Pixel-based images can also be placed within a georeferenced image using the Georeferenced Images option.

  1. For pixel-based images, set the size of the output mosaic by entering the desired size in pixels in X Size (Samples) and Y Size (Line) parameters in the dialog.
  2. Also set the "Snap" factor, which controls a grid to which images will be placed or snapped (for example, a snap of 5 means that pixel-based images will be placed at the nearest intersection of a pixel grid with 5 x 5 pixel spacing)

Import Images

Use one of the following methods depending on the type of mosaic and whether the images have overlapping areas.

Without Feathering:

Images that do not overlap, or images that do not require blending should be imported using the Import File without Feathering option.

  1. Select Import->Import File Without Feathering from the menu bar in the Mosaicking dialog.
  2. Open and select the desired image and spectrally and/or spatially subset if desired.

The image description will be listed in the dialog, and a graphic representing the image and its position in the mosaic will be displayed in the draw widget within the dialog.

  1. Open and import the remaining images in the mosaic in the same fashion.

With Feathering:

Images that overlap may require feathering of the overlap areas to avoid obvious seams in the final mosaic.

  1. Select Import->Import File With Feathering from the menu bar in the Mosaicking dialog.

If cutline feathering is being used, the cutline must already have been drawn as a polyline annotation and saved to an annotation file as described below.

  1. For both cutline and edge feathering, specify a distance over which to feather as described above.

Using feathering will eliminate joins between images, but mosaicking with feathering is compute-intensive and requires a long time to run, especially for large mosaics.

Background Value to Ignore:

This option allows image transparency for overlapping images.

  1. Select Import->File With Feathering regardless of whether you want to feather the images.

This allows you to set a background value to ignore when images overlay one another.

  • If feathering is desired, enter the desired values, however, if feathering is not desired, leave the feathering values set to zero.
  • Enter the data value to be ignored in the labeled text box.

The overlap areas with this value will be transparent, allowing underlying images to show through. This value will also be ignored during the feathering process if selected.

Create Template or Select Apply to Create Output Mosaic

  1. To create a virtual mosaic (see below), select File->Save Template, enter the output filename, and click OK. This creates a small text file that describes the mosaic layout.
  2. To view this mosaic, select File->Open Image File from the ENVI Main Menu, choose the mosaic template file as the input file and click Open. Click on the mosaic band name in the Available Bands List and then Load Band to automatically get the required images and display the virtual mosaic to the ENVI Image Display.
  3. Alternatively, to actually create the mosaic as a new file, select File->Apply in the Mosaic dialog and enter an output filename. The output mosaic is a standard ENVI file and can be displayed using the Available Bands List.

Pixel-based Mosaicking Example

This section leads you through creation of Pixel-Based mosaics using ENVI's mosaicking tools.

  1. Start the ENVI Pixel-Based Mosaic function by selecting Register->Mosaic Images->Pixel Based Images from the ENVI Main Menu.

The Pixel-Based Image Mosaicking dialog appears.

Mosaicking Using ENVI - Tutorial - facegis.com

Figure 3. The Pixel-Based Image Mosaicking dialog.

Position the images for the Pixel-Based Mosaic

To position pixel-based images:

  1. Open and import the images DV06_2.IMG and DV06_3.IMG using the methods described above.
  2. Specify the mosaic size by entering the 614 for the X Size and 1024 for the Y Size in the text boxes at the top of the Pixel Based Image Mosaicking dialog.
  3. Click on the second image in the list of images in the dialog (DV06_3.IMG).

The current position of the image in pixels will be listed in the text box at the bottom of the dialog.

  1. Change the image position by entering the desired XO (x offset) and YO (y offset) values in pixels in the corresponding text boxes. Enter a value of 513 for the YO for DV06_3.IMG to place it directly below DV06_2.IMG.
  2. Images can also be positioned by clicking and holding the left mouse button on the desired image in the mosaic diagram on the right side of the dialog, dragging the selected image to the desired location, and releasing the left mouse button to place the image.
  3. Select File->Apply from the Pixel Based Image Mosaicking dialog menu and enter the output filename DV06.IMG and click OK to create the mosaic.
  4. Choose File->Save Template from the Pixel-Based Mosaicking dialog and enter the output filename DV06A.MOS.
  5. Now open this template by selecting File->Open Image File from the ENVI Main Menu and opening the file DV06A.MOS.
  6. Display the mosaicked image by clicking on the band name in the Available Bands List and then Load Band.

Mosaicking Using ENVI - Tutorial - facegis.com

Figure 4: Two single-band AVIRIS images (left) and the final seamless join of the two (right).

The second part of this example shows positioning of the two images into a composite mosaic image, accomplished by either entering the XO and YO values, or dragging the images to their desired locations within the dialog. An example of edge feathering is also presented.

  1. Using the images already displayed, enter a value of 768 into both the Mosaic X Size and Y Size text boxes to change the size of the output mosaic
  2. Click and drag using the left mouse button in the center of the graphic outline of image #2, which appears green in the Pixel-Based Image Mosaicking dialog. Drag the #2 image to the lower right hand corner of the diagram.
  3. Edit the mosaic characteristics by selecting Options->Edit Entry in the Image Mosaicking dialog. Enter a value of 25 for the Edge Feathering Distance and a Background Data Value to Ignore of 0, and click OK. Repeat for the second image.
  4. Choose File->Save Template and enter the output filename DV06B.MOS. Now open this template file for display as a virtual mosaic by selecting File->Open Image File from the ENVI Main menu and clicking on Open. Click on the mosaic template name in the Available Bands list and then Load Band to load into a display as a virtual mosaic. No feathering is performed when using virtual mosaic.
  5. Now make the same image as a feathered mosaic by actually creating the output file. Select File->Apply in the Image Mosaicking dialog and click OK
  6. Enter an output filename, and a Background Value of 255, then click OK. Load the feathered mosaic to the Available Bands List and display in a new image window.
  7. Compare the virtual mosaic and the feathered mosaic using image linking and dynamic overlays.

The figure below shows the feathered output mosaic produced by overlapping the two AVIRIS scenes as described above.

Mosaicking Using ENVI - Tutorial - facegis.com

Figure 5: A feathered pixel-based mosaic.


Georeferenced Mosaicking Example

Putting together georeferenced, overlapping images requires considerable preparation, including histogram matching and usually feathering. The following sections of this tutorial describe some of the requirements and how to accomplish these using ENVI.

Create the Georeferenced Mosaic Image

  1. Start the ENVI Georeferenced Mosaic function by selecting Register->Mosaic Images->Georeferenced Images from the ENVI Main Menu.

Mosaicking Using ENVI - Tutorial - facegis.com

Figure 6: The Georeferenced Image Mosaicking dialog.

Load the Mosaic Template

Select File->Restore Template and select the file LCH_A.MOS. This opens the files and restores the mosaic parameters to make a georeferenced, feathered mosaic.

Optionally Input and Position Images

  1. Optionally, to manually position the georeferenced images and set the feathering options, import the images as described above.

Images will automatically be placed in their correct geographic locations. The location and size of the georeferenced images will determine the size of the output mosaic.

View the Top Image and CutlineMosaicking Using ENVI - Tutorial - facegis.com

  1. In the Available Bands List, select the file LCH_01W.IMG and display as a grayscale by clicking on the band name and then the Load Band button at the bottom of the dialog.
  2. Click the right mouse button in the Main Image Display window to toggle the Functions menu, then choose Functions->Overlays->Annotation to start the Annotation dialog.
  3. Select File->Restore Annotation and choose the file LCH_01W.ANN to display the cutline used to blend the two images in this mosaic.
  4. Display the second image lch_02w.img and examine the nature of the cutline with respect to this image.

View the Virtual, Non-Feathered Mosaic.

  1. Select File->Open File from the ENVI Main Menu and choose LCH_A.MOS as the input file. Load this image to a new display using the Available Bands List and examine the non-feathered edge between the two images used to create the mosaic.

Create the Output Feathered Mosaic

  1. Select File->Apply in the Georeferenced Image Mosaicking dialog and enter the output filename LCH_MOS.IMG and click OK to create the feathered mosaic.
  2. Close the two Image Display Windows containing the individual warped images and load the mosaic image into a new display.
  3. Compare the feathered mosaic to the non-feathered mosaic using image linking and dynamic overlays.

Figure 7: Warped, histogram-matched images with the cutline selected.

 

Mosaicking Using ENVI - Tutorial - facegis.com

Figure 8: Final feathered mosaic result using cutline feathering.


Some Additional Options in The Mosaicking dialog

  • To float the pixel-based image to the top of the stack of overlapping images, click on the image desired in the list, or the mosaic diagram, and select Options->Percolate.

This option is only available for pixel-based images.

  • To center all of the current images in the mosaic as a group, select Options->Center Entries.

This option is only available for pixel-based images.

  • To assign feathering distances, the Background Data Value to Ignore (transparency), and the X and Y image offsets, select Options->Edit Entry and enter the desired values.
  • To replace an image currently in a mosaic with another image of the same size, select the image to be replaced, and select Options->Replace Entry and select the image to use for the replacement.
  • To delete the currently selected image from the mosaic, select Options->Delete Entry.
  • To remove all images from the mosaic and clear the mosaic complete, select Options->Clear All Entries.
  • To place an image as if their upper left corner has the X,Y coordinates 1,1, select Options->Do Not Use Image Offset.

Do this for images which were previously created as subsets from other larger images and which have an "image offset". This means that the upper left corner of the image has X and Y values corresponding to its position in the original image.

  • To place images in the mosaic at the location specified by its location in the original image from which it was subset, select Options->Use Image Offset.

Source: http://www.ltid.inpe.br