Introduction to ENVI - Tutorial of ENVI Software - Completely GIS, GPS, and Remote Sensing Lecture Material -
Introduction to ENVI

Overview of This Tutorial

This tutorial provides basic information about ENVI and some suggestions for your initial investigations of the software. It is designed to introduce first-time ENVI users to the basic concepts of the package and to explore some of its key features. It assumes that you are already familiar with general image-processing concepts.

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 CAN_TM subdirectory of the ENVIDATA directory on the ENVI TUTORIALS & DATA CD-ROM.

Required Files

The files listed below are required to run this exercise.

CAN_TMR.IMG,	Boulder Colorado TM Data 
CAN_TMR.HDR,	ENVI Header for Above

Working with ENVI

ENVI tutorial - facegis.comENVI uses a graphical user interface (GUI) to provide point-and-click access to image processing functions (Figure 1). You select menu choices and functions using a three-button mouse.

  • If you are using ENVI for Windows with a two-button mouse, you can simulate a "middle" mouse button press by holding down the Control key and pressing the left mouse button. If you are using ENVI for Macintosh , hold down the Option key while pressing the mouse button to simulate a "middle" mouse button press, or hold down the Command key while pressing the mouse button to simulate a "right" mouse button press.

When you start ENVI, the ENVI Main Menu appears in the form of a button menu bar. Clicking with the left mouse button on any of the Main Menu buttons brings up a menu of options, which may in turn contain submenus with further options. The choices selected from these submenus will often bring up dialog boxes that allow you to enter information or set parameters relating to the ENVI function you have selected.

Note that most menus in ENVI windows and dialog boxes appear as buttons. Often the button label changes to reflect the currently-selected menu option.

ENVI File Formats

ENVI uses a generalized raster data format consisting of a simple "flat binary file" and a small associated ASCII (text) header file. This file format permits ENVI to use nearly any image file, including those that contain their own embedded header information.

Generalized raster data is stored as a binary stream of bytes in either Band Sequential (BSQ), Band Interleaved by Pixel (BIP), or Band Interleaved by Line (BIL) format.

  • BSQ is the simplest format, with each line of data followed immediately by the next line of the same spectral band. BSQ format is optimal for spatial (X,Y) access to any part of a single spectral band.

BIP format provides optimal spectral processing performance. Images stored in BIP format have the first pixel for all bands in sequential order, followed by the second pixel for all bands, followed by the third pixel for all bands, etc., interleaved up to the number of pixels. This format provides optimum performance for spectral (Z) access of the image data.

  • BIL format provides a compromise in performance between spatial and spectral processing and is the recommended file format for most ENVI processing tasks. Images stored in format have the first line of the first band followed by the first line of the second band, followed by the first line of the third band, interleaved up to the number of bands. Subsequent lines for each band are interleaved in similar fashion.

ENVI supports a variety of data types: byte, integer, long integer, floating-point, double-precision floating-point, complex, and double-precision complex.

The separate text header file provides information to ENVI about the dimensions of the image, any embedded header that may be present, the data format, and other pertinent information. The header file is normally created (with your input) the first time a particular data file is read by ENVI. You can view and edit it at a later time using the Edit ENVI Header function under the ENVI File menu. You can also generate ENVI header files outside ENVI, using a text editor, if desired.

ENVI Windows and Displays

As you work with ENVI, a number of different windows and dialog boxes will appear on your screen. These allow you to manipulate and analyze your image. The most important of these displays is a group of three windows that display your image, allow you to move around in it, and allow you to magnify different areas. This group of windows is collectively referred to as the "Display group" (Figure 2). The Display group consists of:

  • The Main Display Window - t his is where all or part of your image is displayed at full resolution.
  • The Scroll Window - I f your entire image does not fit in the Main window, the Scroll window will appear. The Scroll window displays a reduced-size version of the entire image, which allows you to select the portion that is displayed in the Main window. A colored box in the Scroll window indicates the spatial location and coverage of the Full-Resolution Main Display window. A number in the title bar of the Scroll Window tells you what reduction factor has been applied to the image to display the full spatial extent within the Scroll Window.
  • The Zoom Window - this window displays an enlarged version of a selected portion of the Main window. A colored box in the Main Image Display indicates the spatial location and coverage of the Zoom window. A number in the title bar of the Zoom Window tells you what zoom factor has been applied to the image.

You may have any number of displays open on the screen at any time. There are a wide variety of other types of ENVI windows you may work with, including scatter plots, spectral profiles and spectral plots, and vector windows.

Menus in ENVI WindowsENVI tutorial -

The ENVI Main Display Window has its own internal menus, which provide access to interactive display and analysis functions (Figure 3). For uncluttered viewing, these menus do not appear automatically; you must call them up by pressing the right mouse button while the mouse pointer is inside the window. Once the window menu is on screen, you can select options from it as you do from any other ENVI menu. These window-specific menus are dismissed from the window by pressing the right mouse button again - not by clicking on the "Cancel" button, which closes the window entirely.




ENVI tutorial - facegis.comThe Available Bands List

ENVI provides access to both image files and to the individual spectral bands in those files. The Available Bands List is a special ENVI dialog that contains a list of all the available image bands in all open files (Figure 4).

Use the Available Bands List to load both color and gray-scale images into a display by entering the display number, clicking on the appropriate radio button, then selecting the desired bands from the list by clicking on the band name(s).

The File button on the menu bar at the top of the dialog provides access to file opening and closing, file information, and the Cancel button. The Options button provides a function to find the band closest to a specific wavelength, and allows toggling between full and shortened band names in the list.



Basic ENVI Functions

This section of the tutorial will take you on a step-by-step tour of ENVI's basic functions.

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.

Open an Image File

To open an image file:

  • 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.

  • Navigate to the CAN_TM subdirectory of the ENVIDATA directory on the ENVI TUTORIALS & DATA CD-ROM just as you would in any other application and select the file CAN_TMR.IMG from the list and click "OK".

The Available Bands List dialog will appear on your screen. This list allows you to select spectral bands for display and processing.

Note that you have the choice of loading either a grayscale or an RGB color image.

  • Select one of the bands listed at the top of the dialog by clicking on the band with the left mouse button.

The band you have chosen is displayed in the field marked "Selected Band:".

  • Click "Load Band" to load the image into a new display.

Familiarize Yourself with the Displays

When the image loads, an ENVI image display will appear on your screen. The display consists of a Main window, a Scroll window, and a Zoom window (See Figure 2 above). These three windows are intimately linked; changes to one window will be mirrored in the others. To get a feel for how the display windows interact, try the following:

Drag the Zoom Indicator Box

  • Note the small red box in the center of the Main window. This box indicates the area of the image displayed in the Zoom window. You can drag the box from place to place in the Main window by clicking inside the box with the left mouse button and dragging it to a new position. The Zoom window is updated automatically to show the new area when you release the mouse button
  • You can also reposition the zoom indicator box by placing the cross-hair cursor in the Main window and clicking the middle mouse button. The zoom region will be centered around the position you have chosen.
  • Finally, if you click inside the zoom indicator box with the middle mouse button and drag the box to a new position, the Zoom window is updated as you move the box.

Zoom In and Out

  • To zoom in on the display in the Zoom window, position the mouse cursor in the Zoom window and click the right mouse button.
  • To zoom the display out, click the left mouse button.

The Zoom factor is shown in parentheses in the Zoom window title bar. Note that as the zoom factor changes, so does the size of the zoom indicator box in the Main window.

Scroll the Image

A red box in the Scroll window indicates what portion of the entire image is currently displayed in the Main window. You can move the selected area by clicking inside the scroll indicator box with the left mouse button and dragging the box to a new position. The displays in the Main and Zoom windows are updated when you release the mouse button. You can also reposition the scroll indicator box by clicking at the desired location using the middle mouse button as for the Zoom window above.

Resize the Windows

You can resize the display windows the same way you would resize windows in other applications, by dragging any of the corners. Note, however, that you cannot make the Main window larger than the image size. If the Main window is large enough to display the entire image, the Scroll window is unnecessary and is automatically removed from your screen. The Scroll window reappears if the Main window is resized smaller than the full image.

Use the Mouse Button Descriptions

ENVI has many interactive functions, and the mouse button combinations and actions are different for each one. The Mouse Button Descriptions dialog is provided to tell you what the mouse buttons do in each graphics window.

  • To start the Mouse Button Descriptions select Basic Tools->Mouse Button Descriptions.

Now whenever your cursor is in an ENVI display or graphics window, the mouse button assignments will be listed in this dialog. MB1 is the left mouse button, MB2 is the middle mouse button, and MB3 is the right mouse button.

Display the Cursor LocationENVI tutorial -

  • To display the cursor location and value, select Basic Tools -> Cursor Location / Value from the ENVI Main Menu.

A dialog box will appear displaying the location of the cursor in the Main, Scroll, or Zoom windows (Figure 5). The dialog also displays the screen value (color) and the actual data value of the pixel underneath the cross-hair cursor.

  • To dismiss the dialog, select "Cancel" from the pulldown File menu at the top of the dialog.

Display Image Profiles

X (horizontal), Y (vertical), and Z (spectral) profile plots can be selected and displayed interactively. These profiles show the data values across an image line (X), column (Y), or spectral bands (Z).

  1. Click the right mouse button anywhere in the Main window to display the Functions menu button and press and hold the left mouse button on the Functions button to pull down the menu.
  2. Select Functions-> Profiles-> X Profile. to display a window plotting data values versus sample number for a selected line in the image (Figure 6).
  3. Repeat the process, selecting Y Profile to display a plot of data value versus line number, and selecting Z Profile to display a spectral plot (Figure 6).
  4. Position the plot windows so you can see all three at once.

ENVI tutorial - A red cross-hair extends to the top and bottom and to the sides of the Main window. The red lines indicate the line or sample locations for the vertical or horizontal profiles.

  1. Move the cross-hair around the image (just as you move the zoom indicator box), to see how the three image profile plots are updated to display data on the new location. The Mouse Button Descriptions dialog can be used to guide your exploration of these windows.
  2. Close the profile plots by selecting File->Cancel from within each plot window.


Perform Interactive Contrast Stretching

Interactive Contrast Stretching plots a histogram and allows you to interactively control the contrast of the displayed image. Many different types of stretches can be applied. By default, a linear 2% stretch is applied to the data when it is first displayed.

  • To access ENVI's interactive contrast stretching functions, select Functions -> Display Enhancements-> Interactive Stretching.

A dialog that allows you to change the contrast stretch of the displayed image appears (Figure 7). Two histogram plots display the color or grayscale range of the input image (left) and the output image after contrast stretching (right). Initially, the input and output histograms reflect the default stretch applied to the data when the image was displayed.

  • The Stretch_Type pulldown menu at the top of the histogram has a variety of contrast-stretching options. Try applying the following methods described below and observe the results in the Main window.
  • Also, try selecting both Zoom and Scroll from the Histogram_Source pulldown menu and note the differences in the histograms and stretches.

ENVI tutorial -


When images are loaded into the Main window, a 2% linear contrast stretch is applied by default.

  • Select Functions-> Display Enhancements-> Interactive Contrast Stretching in the main display, then choose Linear from the pulldown Stretch_Type menu item in the dialog

Note the red and green vertical lines in the input histogram plot--these bars can be repositioned to control the minimum and maximum value used in the contrast stretch.

  • Position the mouse cursor on the red bar and hold down the left mouse button, then drag the bar from side to side.

Numbers above the plot display the current data value, the number of pixels and the percentage of pixels that have that value, and the cumulative percentage of pixels with values less than or equal to the current value.

  1. Try positioning the red bar so that approximately 5% of the pixels are selected, and the green bar so that approximately 95% of the pixels are selected.
  2. Click "Apply" to apply the stretch and observe the results.
  3. You can also position the bars by entering minimum and maximum values in the fields next to the "Apply" button at the top of the dialog. You can enter either data values or percentages.
  4. Enter "4%" in the left box and "96%" in the right box (press Enter after typing each value) and click "Apply".

The red and green bars will be adjusted and the two text entries updated to display the data values at 4% and 96%, respectively.


  1. Select Stretch_Type->Equalization and note the change in the "Output Histogram" display.
  2. Click "Apply" to apply the stretch shown in the output histogram plot to the image in the Main window.


  1. Select Stretch_Type -> Gaussian.
  2. Set the Standard Deviation by selecting Options -> Set Gaussian Stdv.
  3. Apply the stretch and note the change in the Main window.
  4. Click "Cancel" to close the contrast stretching dialog.

Display Interactive Scatter Plots

ENVI tutorial - facegis.comYou can plot the data values of two selected image bands versus each other in a scatter plot to graphically display the overlapping values.

  1. Select Functions->Interactive Analysis->2D Scatter Plots in the Main window.

A dialog will appear that lets you choose two image bands to compare.

2. Select one band for the X axis and another band for the Y axis and click "OK."

It may take a few seconds for ENVI to extract and tabulate the data values.

  • Once the scatter plot has appeared (Figure 8), position the mouse cursor anywhere in the Main window and drag with the left mouse button pressed.

Pixel values contained in a ten-pixel by ten-pixel box surrounding the crosshair will be highlighted in red on the scatter plot. Again, note that the Mouse Button Descriptions dialog can help you know the functions of the different mouse buttons in the Scatterplot.

  • Move the cursor around in the Main window to observe the "dancing pixels" effect.

You can also use the scatter plot to highlight specific data values in the Main window.

  • Place the mouse cursor in the scatter plot window and click and drag with the middle mouse button.

A ten-pixel-square box will appear in red on the plot. Pixels with the values contained in the box are highlighted on the image in the Main window as "Image Dancing Pixels".

  • Select File -> Cancel to close the scatter plot window.

Apply a Display Filter

ENVI gives you the ability to apply several different pre-defined or user-defined filters to a display (file-based filtering is also available and is accessed via the Filter menu on the ENVI main menu). The following example shows you how to apply a pre-defined filter to the image in the Main display window.

Choose a Filter

  1. Select Functions->Display Enhancements->Filter and choose the desired filter type from the pulldown filter menu to apply a filter to the displayed image.
  2. Try the different sharpening, smoothing, median, and edge detection filters on the displayed image.

Display A Second Image and Apply Filter

  • Click "New" in the Available Bands List dialog to create a second display group, select an image band, and click "Load Band" to load the image into the second display. Choose Functions->Display Enhancements->Filter and select a filter different from that applied to image #1 from the pulldown filter menu.

Link Two Displays

Link the two displays together to compare the filter results. When you link two displays, any action you perform on one display (scrolling, zooming, etc.) is echoed in the linked display. To link the two displays you have on screen now:

  1. Select Functions ->Link- >Link Displays from one of the display windows.
  2. Click "OK" in the Link Displays dialog.
  3. Now try scrolling or zooming in one display group and observe as your changes are mirrored in the second display.

Dynamic Overlays

ENVI's Multiple Dynamic Overlay feature allows you to dynamically superimpose parts of one or more linked images onto the other image. Dynamic overlays are turned on automatically when you link two displays.

  • To use the overlay, position the mouse cursor anywhere in either Main window and hold down and drag with the left mouse button.

A small portion of the linked image will be superimposed on the current image window. The overlay will appear in either the Main window or the Zoom window.

  • To change the size of the overlay area, hold down the middle mouse button and drag the overlay area until it is the desired size.

Load a Color Image

  1. If the Available Bands List is not already on your screen, call it up by selecting File-> Available Bands List (Figure 4).
  2. Load a color image in the second display by clicking on the toggle button labelled "RGB Color" in the Available Bands List dialog.
  3. Select a band for each color from the list and click "Load RGB" to load the image.
  4. Try the dynamic overlay feature with the color and grayscale images.
  5. Dismiss the first display by clicking "Cancel".

Select Regions Of Interest

ENVI lets you define "Regions of Interest" (ROIs) in your images. ROIs are typically used to extract statistics for classification, masking, and other operations.ENVI tutorial -

  1. Select Basic Tools->Region of Interest->Define Region of Interest from the ENVI Main Menu. The ROI Definition dialog will appear (Figure 9).
  2. Draw a polygon that represents the region of interest.
  3. Click the left mouse button in the Main window to establish the first point of the ROI polygon.

Select further border points in sequence by clicking the left button again, and close the polygon by clicking the right mouse button.The middle mouse button deletes the most recent point, or (if you have closed the polygon) the entire polygon.

  • ROIs can also be defined in the Zoom and Scroll windows.

When you have finished defining an ROI, it is shown in the dialog's list of Available Regions, with the name, region color, and number of pixels enclosed (Figure 10).

  1. To define a new ROI, click "New Region".
  2. You can enter a name for the region and select the color and fill patterns for the region by clicking on the "Edit" button.

Other types of ROIs

ROIs can also be defined as polylines or as a collection of individual pixels by selecting the desired ROI type from the ROI_Type pulldown menu. See the ENVI User's Guide or the hypertext online help for further discussion of these types of ROI.ENVI tutorial -

Working with ROIs

You can define as many ROIs as you wish in any image (Figure 10).

  • Once you have created the ROI definitions, you can erase them from the display (leaving the definition in the list) by selecting the ROI from the list and clicking on the "Erase" button.
  • Clicking on the "Stats" button allows you to view statistics about the ROI you select.
  • Clicking the "Delete" button permanently deletes ROI definitions from the list.
  • The other buttons and options under the pulldown menus at the top of the ROI Definitions dialog let you calculate ROI means, save your ROI definitions, load saved definitions, or display or delete all the definitions in the list.

Region Of Interest definitions are retained in memory after the ROI Definition dialog is closed, unless you explicitly delete them. This means the ROIs are available to other ENVI functions even if they are not displayed.

Annotate the Image

ENVI's flexible annotation features allow you to add text, polygons, color bars, and other symbols to your plots and images.

  • To annotate an image, click the right mouse button in the Main Image window and select Functions- >Overlays ->Annotation. The Annotation dialog will appear (Figure 11).
  • To annotate plots, 3-D surfaces, and similar objects, select Options ->Annotation within the plot windows.

Annotation Types

The Annotation dialog allows you to choose from a variety of annotation types. Different types are selected from the Object menu and include Text, Symbols, Rectangles, Ellipses, Polygons, Polylines, Arrows, Map Scale Bars and Declination Diagrams, Map Keys, Color Table Ramps, and Images. By default, the Annotation dialog starts up with "Text" selected. Other fields in the dialog let you control the size, color, placement, and angle of the annotation text. When you select different annotation types from the menu, the fields in the dialog change to display options appropriate to the new type.ENVI tutorial -

Placing Annotation

Try placing a text annotation in your Main window:

  1. Type some text in the text field in the center of the dialog.
  2. Select a font, color, and size from the appropriate menus and parameters in the dialog, then position the mouse pointer in the Main window and press the left mouse button. Again, the Mouse Button Description dialog will help you remember the mouse button interactions within annotation.

Your text will be displayed in the window at the point you chose (Figure 12).

  1. Drag the handle using the left mouse button to position the text.
  2. You can continue to change the annotation's properties and position by changing the fields in the dialog box or dragging the text or symbol while holding down the left mouse button.
  3. When you are satisfied with the annotation, press the right mouse button to fix the annotation in position.

Saving and Restoring Annotation

  • ENVI tutorial - facegis.comYou can save your image annotation by selecting File- >Save Annotation in the Annotation dialog.
  • If you do not save your annotation in a file, it will be lost when you close the Annotation dialog (you will be prompted to save the annotation if you close without first saving).
  • You can also restore saved annotation files by selecting File ->Restore Annotation in the dialog.

Editing Previously Placed Annotation

To edit an annotation element that has already been "fixed" on the image:

  1. Select Object- >Selection/Edit in the Annotation dialog.
  2. Draw a box around the annotation you wish to edit by clicking and dragging with the left mouse button.
  3. When the handle reappears, move and configure the item just as you would a new annotation.

Suspending the Annotation Function Temporarily

  • To suspend annotation operations and return to normal ENVI functionality temporarily, select the "Off" toggle button at the top of the Annotation dialog.

This allows you to use the scroll and zoom features in your display without losing your annotations.

  • To return to the annotation function, select the toggle button for the window you are annotating.

Leave your annotation on the Main window image as you complete this tutorial.

Add Grid Lines

Try adding a grid to your image (Figure 13):

  1. To overlay grid lines on your image, select Functions->Overlays->Grid Lines in the Main display window.
  2. You can adjust the grid lines by setting the line thickness and color and the grid spacing using the Options pulldown menu.

An image border is automatically added when you overlay grid lines.

  • When you have added a satisfactory grid, click "Apply" in the Grid Line Parameters dialog.

Save and Output an Image

ENVI gives you several options for saving and outputting your filtered, annotated, gridded images. You can save your work in ENVI's image file format (Figure 20), or in several popular graphics formats (including Postscript) for printing or importing into other software packages.

Saving your Image in ENVI Image Format

To save your work in ENVI's native format (as an RGB file):

  • Select Functions->Output Display ->Image File in the Main window.

The Output Display to Image Parameters dialog will appear.

  • Select 24-Bit color or 8-Bit grayscale output, graphics options (including annotation and gridlines), and borders.

If you have left your annotated and gridded color image on the display, both the annotation and grid lines will be automatically listed in the graphics options.

You can also select other annotation files to be "burned in" to the output image.

  1. Select output to "Memory" or "File".
  2. If output to "File" is selected, enter an output filename.
  3. Click "OK" to save the image.
  4. If you select other graphics file formats from the "Output File Type" button, your choices will be slightly different.