Welcome to the Harris Geospatial documentation center. Here you will find reference guides and help documents.


  >  Docs Center  >  Using ENVI  >  Getting Started with ENVI Tutorial

ENVI

Getting Started with ENVI Tutorial

Getting Started with ENVI Tutorial

This tutorial provides a comprehensive introduction to using ENVI. It is designed for new ENVI users or those who have used ENVI Classic in the past and want to learn the newer ENVI user interface. You will learn how to display and navigate imagery, analyze raster data, create presentations, and more. This tutorial uses ENVI 5.5, Service Pack 1 for demonstration. You can use older versions of ENVI, but some of the functionality may be different.

See the following sections:

Files Used in This Tutorial


Tutorial files are available from our website or on the ENVI Resource DVD in the HighResOrthophoto directory. Copy the files to a local drive.

File

Description

CentralParkOrthophoto.dat (and .hdr)

Orthorectified digital photograph of Central Park, New York City, USA, in ENVI raster format

CentralParkWaterROI.xml

Region of interest (ROI) file containing polygons that identify ponds in the orthophoto

The digital photograph is a public-domain U.S. Geological Survey (USGS) High Resolution Orthoimage downloaded from the USGS EarthExplorer web site. Gridded spatial resolution is 0.15 meters (0.5 feet). The image contains four bands (red, green, blue, near-infrared) and was acquired between April and May of 2014.

Technical Notes:

The orthophoto was originally acquired from an UltraCam Eagle digital camera, which has the following wavelength ranges for visible to near-infrared bands:

  • Blue: 400 - 600 nm, peak at 450 nm
  • Green: 480 - 700 nm, peak at 550 nm
  • Red: 580 - 720 nm, peak at 640 nm
  • Near-infrared: 680 - 1000 nm

Reference: Gruber, M., and M. Muick. "UltraCam Eagle Prime Aerial Sensor Calibration and Validation." Vexcel Imaging GmbH (2016).

The orthophoto did not have any wavelength information, so we manually added the peak wavelengths for each band to the ENVI header file. For the near-infrared band, we used the center wavelength (840 nm).

Explore an Image


  1. Start ENVI.
  2. Click the Open button in the toolbar. The toolbar is located along the top of the ENVI application:
  3. When the Open dialog appears, navigate to the location where you saved the tutorial data. Select CentralParkOrthophoto.dat and click Open. The center of the image is displayed at full (100%) resolution in the Image window.
  4. Press the F12 key on your keyboard to view the full extent of the image. This is a true-color image that shows natural and man-made features.
  5. From the menu bar (located above the toolbar), select Views > Reference Map Link. A separate window appears with a map of the image location. The cyan-colored box indicates the extent of the image, and the dot in the middle indicates the image center. You can see that the image covers a portion of Central Park in New York City. It contains several softball fields, ponds, and an amphitheater. The large building in the lower-right corner is the Metropolitan Museum.
  6. Explore the image using these techniques:
    • If your mouse has a scroll wheel, use it to zoom in and out of the image. If not, press the F9 key to zoom in or the F10 key to zoom out in fixed increments. The zoom level is displayed in the toolbar; for example:
    • To zoom into a specific area, click the Zoom button in the toolbar and draw a box around the area to zoom.
    • To zoom to 100% resolution, press the F11 key.
    • To pan around the image, click the Pan button in the toolbar. Left-click and drag the mouse to pan. Or, click and drag the middle mouse button or scroll wheel.
    • To rotate the image, click the Rotate View button in the toolbar. Left-click and drag the mouse to rotate. Or, select a rotation angle from the drop-down list in the toolbar.
  7. Zoom to an area that you are interested in, then select Placemarks > Add Placemark from the menu bar.
  8. In the New Placemark dialog, enter a name for the location and click OK; for example:
  9. The custom location is saved under the Placemarks menu. When you move to another area in the image, you can go back to the saved location by clicking Placemarks and selecting it from the list; for example:

    As you move the cursor around the image, the latitude and longitude coordinates of the cursor location are displayed in the Status Bar at the bottom of the ENVI application. The Status Bar contains three horizontal segments. By default, the first (left) segment displays geographic coordinates, and the second segment displays the map projection details for the image. The third segment is blank. The following figure shows an example of the first two segments:

    You can choose to display different types of image information in each segment by right-clicking and selecting an option.

  10. Right-click in the first (left) segment and select Raster Data Values. The red, green, and blue data values are displayed for the current pixel location; for example:
  11. Zoom to full resolution (100%) in the image, then click the Overview check box in the Layer Manager. The Layer Manager is located near the upper-left corner of the application. A small yellow overview window is displayed in the upper-left corner of the view.
  12. Pan around the image. The red box in the overview window shows the extent of the current view location, relative to the entire image.
  13. Uncheck the Overview option to hide the overview window.

Now that you understand some basic exploration techniques, let's learn how to work with multiple data layers and views.

Work with Layers and Views


The Layer Manager shows the datasets that are displayed in the Image window. Since there is only one view (you will learn about multiple views later), the image layer is listed under one View category.

  1. Click the + button next to CentralParkOrthophoto.dat to see the bands that are used to display a true-color composite for this image.
  2. Click the Detach button in the Layer Manager to detach it from the application. It becomes a floating window that you can resize and move to a different location.
  3. Click the Data Manager button in the toolbar.
  4. The Data Manager lists the datasets that are currently open in ENVI. For images, it also lists the available bands. Since the associated header file for this image (CentralParkOrthophoto.hdr) contains wavelength information, the Data Manager also lists the wavelengths for each band.

    In the Data Manager, you can see that the image contains a fourth band (Band 4: Near infrared).

  5. Select Band 4: Near infrared and click the Load Grayscale button. The near-infrared band appears in the Image window, and the Layer Manager shows that a second image layer has been added to the view.
  6. To toggle between the two images, uncheck the [1] CentralParkOrthophoto.dat layer in the Layer Manager to hide it. Then check the layer to display it.
  7. Click the Cursor Value button in the toolbar. Red crosshairs appear in the display, along with the Cursor Value dialog.
  8. Click anywhere in the image. The red crosshairs move to that pixel location, and the Cursor Value dialog reports the data values from the grayscale image layer and the true-color layer for that pixel.
  9. Close the Cursor Value dialog.
  10. In the Data Manager, enable the Load in New View option.
  11. Right-click on CentralParkOrthophoto.dat in the Data Manager and select Load CIR. A second view is added to the Image window, which contains a color-infrared version of the orthophoto. The colors are not real according what the human eye sees. Instead, this type of image is commonly used for discriminating between features based on the infrared response. The Layer Manager shows that a second view has been added.
  12. Having two views provides a convenient way to compare images side-by-side. However, notice that when you zoom or pan in one view that the other view remains the same. You will need to establish a geographic link between the views.

  13. From the menu bar, select Views > Link Views.
  14. In the Link Views dialog click the Link All button, then click OK.
  15. Now when you zoom or pan around one view, the second view moves accordingly.

  16. Now is a good time to save the view layout. If you close and restart ENVI, it will not remember the layers and views that you last displayed. From the menu bar, select File > Views and Layers > Save.
  17. In the output file dialog, navigate to a directory where you want to save the file, and name it TwoViews.json.
  18. Click Save. If you close ENVI at any point in this tutorial, you can restore the views and layers from this step by selecting File > Views and Layers > Restore from the menu bar.
  19. Click inside of the view (in the Image window) that contains the grayscale and true-color image layers. A cyan-colored border surrounds the view to indicate that it is the currently selected view.
  20. From the menu bar, select Views > One View. The color-infrared view is removed.
  21. In the Layer Manager, right-click on [1] CentralParkOrthophoto.dat and select Remove. Now the view only contains the true-color image.

Next you will explore the image data in more detail, beginning with metadata.

View and Edit Metadata


Metadata provide details about a dataset in general such as its source, data type, and projection. Follow these steps to view the orthophoto metadata:

  1. In the Data Manager, expand the File Information category. Here you can view basic metadata such as file location, dimensions, interleave, data type, size, file type, projection, and wavelength range.
  2. Right-click on CentralParkOrthophoto.dat in the Layer Manager and select View Metadata. Here you can view the full set of metadata for the orthophoto. The Raster node shows most of the same metadata as you viewed in the Data Manager.
  3. Click the Extents node on the left side of the View Metadata dialog. This node shows the UTM map coordinates of the four corners of the image, along with the units of the map projection. Next, you will add two new fields to the metadata.
  4. Click the Edit Metadata button in the View Metadata dialog. The Edit ENVI Header dialog appears. Here you can see the metadata fields that are currently populated with values.
  5. Click Add in the Edit ENVI Header dialog. The Add Metadata Items dialog appears.
  6. Use the Ctrl key on your keyboard to select both Data Ignore Value and Description.
  7. Click OK.
  8. Scroll to the bottom of the Edit ENVI Header dialog. The Data Ignore Value and Description metadata fields have been added.
  9. If an image has a specific pixel value that you want to remain transparent when displaying the image and to ignore when doing any processing, you can set that value in the Data Ignore Value metadata field. An example of an area to ignore would be background pixels that surround an image. While this orthophoto does not have any background pixels, you should still learn how to set a data-ignore value as it is a common scenario when working with remote sensing imagery. Enter a value of 0 in the Data Ignore Value field.
  10. Add a custom description in the Description field; for example: USGS High Resolution Orthophoto, Central Park, 2014, 0.5 foot resolution.
  11. Ensure that the Display result option is enabled.
  12. Click OK in the Edit ENVI Header field. The image closes and reopens while the associated header file (CentralParkOrthophoto.hdr) is updated with the new metadata.
  13. Right-click on CentralParkOrthophoto.dat in the Layer Manager and select View Metadata. In the Raster node, note the new Description and Data Ignore Value fields, along with the values you just added.
  14. Close the View Metadata dialog.

Explore Data in More Detail


In this section you will learn more about the data itself.

Image Statistics

  1. The orthophoto used in this tutorial is a byte image that contains data values ranging from 0 to 255 in the red, green, blue, and near-infrared bands. To confirm this, right-click on CentralParkOrthophoto.dat in the Layer Manager and select Quick Stats. Two progress dialogs appear, followed by a Statistics View dialog.
  2. The top part shows a graphical summary of the following across all bands:

    • Minimum and maximum data values (red)
    • Mean data value (black)
    • Standard deviation (green, centered over the mean)

    The Basic Stats section shows the actual minimum, maximum, and mean data values in each band, along with the standard deviation.

  3. Click the Select Plot drop-down list at the top of the Statistics View, and select All Histograms. A plot shows the histograms for all four bands.
  4. Click the right-facing arrow to the right of the plot. This expands to show the plot key so that you can see the bands and their corresponding colors.
  5. Close the Statistics View dialog.

Spectral Profiles

  1. Right-click CentralParkOrthophoto.dat in the Layer Manager and select Profiles > Spectral. Red crosshairs appear in the display, and the Spectral Profile dialog appears. A spectral profile shows the data values for a selected pixel (Y-axis) in all four bands spanning the visible to near-infrared wavelength range (X-axis).
  2. In the Go To field (located in the toolbar), type the values 2641p, 3588p and press the Enter key. These are pixel coordinates for a dark-green tree within the orthophoto. The "p" indicates that these are pixel coordinates, not to be confused with any map coordinates that might have the same values. The spectral profile updates to show the spectral signature of healthy, green vegetation. The curve peaks in the green wavelength region (around 550 nm), decreases in the blue and red wavelengths, and increases dramatically in the near-infrared region (above 620 nm).
  3. Close the Spectral Profile dialog.

Measure Distances

If an image is georeferenced to a standard map projection (as with this orthophoto), you can measure the distance between objects.

  1. Click the Mensuration button in the toolbar. Red crosshairs appear in the display, and the Cursor Value dialog appears.
  2. In the Go To field, enter pixel coordinates 1512.46p, 2629.02p and press the Enter key. The image centers on the first base in a softball field.
  3. Click on the first base exactly where the crosshairs intersect, then click on the second base (up and to the right). A red line is drawn between the two bases.

  1. Right-click and select Accept. The Cursor Value dialog reports the distance of the line segment (approximately 20.3 meters), along with the angle (67 degrees). The line segment becomes a polyline annotation that is added to the Layer Manager.
  2. Click the Units drop-down list in the Cursor Value dialog, and select US Survey Feet. What is the length of the line segment?
  3. Close the Cursor Value dialog.
  4. Right-click on New Annotation in the Layer Manager and select Remove.
  5. When prompted to save the changes to the new annotation, click No. The line segment is removed from the Image window and the Layer Manager.

Create Presentations


Next, you will learn how to modify the display properties of the image and add grid lines to the image. Steps like these are normally taken to create screen captures or full-resolution presentations that you can share with others. They do not modify the original image data in any way.

Apply a Stretch

You can apply one of 10 quick stretches to the image using the Stretch Type drop-down list in the toolbar. By default, no stretch is applied to this orthophoto.

  1. Experiment with each option to see the effect it has on the image.
  2. Experiment with the Brightness, Contrast, Sharpen, and Transparency sliders in the toolbar.
  3. Tip: The Contrast slider is only available when you choose a Linear, Equalization, Gaussian, Square Root, or Logarithmic stretch type.

    You can click the Reset button next to each slider to go back to the default value. To the left of the Stretch Type drop-down list are three buttons that let you choose how the stretch is computed. By default, the Stretch on Full Extent button is enabled, which means the selected stretch is based on the histogram of the entire image.

  4. Press the F11 key on your keyboard to zoom to full resolution.
  5. Click the Stretch on View Extent button in the toolbar. Now the selected stretch is only computed from the pixels that are displayed in the Image window.
  6. Pan around the image and notice how the stretch looks the same even though you are viewing a different area. You have to click the Stretch on View Extent button each time you pan around, to apply the stretch to the viewable area.
  7. Click the Stretch on View Extent with auto update button , then pan around the image. The selected stretch is automatically recomputed each time you view a different area.
  8. Click the Stretch on Full Extent button.
  9. Click the Histogram Stretch button in the toolbar. The Histogram Stretch dialog lets you adjust the histogram values for the red, green, and blue display bands.
  10. Drag the minimum and maximum vertical sliders in each histogram to see the effect the changes have on the image.
  11. To learn more about the different options available, click the blue help button in the Histogram Stretch dialog. A web browser will launch, and you will be taken to the Display Tools topic in ENVI Help.
  12. Close the Histogram Stretch dialog.
  13. Tip: To cancel any changes you made in the Histogram Stretch dialog, click the Reset button to the right of the Stretch Type drop-down list in the toolbar.

Add Grid Lines

  1. Click the Zoom drop-down list in the toolbar and select 12.5% (1:8).
  2. Click the Annotations drop-down list in the toolbar and select Grid Lines. Grid lines and labels are added to the display, but the spacing is not optimal and the labels are too small. You will modify these properties next.
  3. Double-click the Grid layer in the Layer Manager. The Edit Properties dialog appears.
  4. Click in the white space next to Coordinate System, then click the small arrow that appears. The Select Coordinate System dialog is displayed.
  5. Type WGS 1984 in the search field of the Select Coordinate System dialog, and press the Enter key.
  6. Double-click WGS 1984 in the search results. The coordinate system changes to GCS_WGS_1984 and the Select Coordinate System dialog is dismissed.
  7. Modify the following grid line properties in the Edit Properties dialog, while leaving the remaining properties at their default values:
    • X Spacing: 0.002
    • Y Spacing: 0.002
    • Text Font Size: 72
    • Geographic Format: Degrees
    • Geographic Precision: 2
    • Grid Thickness: 2

    The image should look similar to the following figure:

  8. Close the Edit Properties dialog.

Update the North Arrow Symbol

  1. From the menu bar, select File > Preferences.
  2. Click North Arrow in the list of items on the left side of the Preferences dialog.
  3. Click in the white space next to Symbol, then click the small arrow that appears.
  4. Select any of the north arrow symbols that are available and click OK.
  5. Click OK in the Preferences dialog.

Create a Screen Capture of the View

In the following steps you will create a screen capture (also called a chip) of the contents of the Image window. The options under File > Chip View to will preserve any display enhancements such as brightness, stretch type, etc. It also captures any annotations that are visible in the view.

  1. With the zoom percentage still at 12.5%, resize the ENVI application so that the image and grid lines fill up the Image window and no white space is left; for example:
  2. From the menu bar, select File > Chip View to > File. The Chip to File Parameters dialog appears.
  3. From the Output Format drop-down list, select JPEG.
  4. Select an output filename and location for the screen capture.
  5. Uncheck the Display result option.
  6. Click OK.
  7. Open the new JPEG file in a separate image or photo viewing application to verify that it looks good.
  8. Optionally experiment with chipping the view to PowerPoint, Geospatial PDF, and/or Google Earth.

The Chip View to options are best used for taking a quick snapshot of the contents of a view; for example, to send via e-mail or to embed in a PowerPoint presentation. However, these are not ideal options when creating publication-ready images, posters, or PDF files. In these cases, you will likely want to create an output image that preserves the original resolution of the input image. You will learn how to do this next.

Export a Full-Resolution View to an Image File

The Export View to > Image File menu option exports the contents of a view, or the entire dataset extent, to an RGB 24-bit image file in ENVI or TIFF format. It preserves any annotations and image enhancements you add; however, it does not preserve the north arrow.

  1. Maximize the ENVI application so that it fills the screen. Or, click and drag the lower-right corner of the application to resize it however you want.
  2. Double-click the Grid layer in the Layer Manager. The Edit Properties dialog appears.
  3. Change the Text Font Size to 18.
  4. Change the Grid Thickness to 1.
  5. Close the Edit Properties dialog.
  6. Select the CentralParkOrthophoto.dat layer in the Layer Manager.
  7. Press the F11 key on your keyboard to zoom to full resolution. You do not have to pan to any particular location.
  8. Click the Zoom drop-down list in the toolbar and select Use Map Scale. The map scale should be 1:613.
  9. From the menu bar, select File > Export View to > Image File. The Export View to Image File dialog appears.
  10. Click the Full radio button for Output Extent. You will export the full extent of the dataset to an image file.
  11. In the Map Scale field, enter a denominator value of 613.
  12. Leave the Pixel Size and Zoom Factor fields at their default values (0.5 and 1.0).
  13. From the Output Format drop-down list, select TIFF.
  14. Select an output filename and location for the full-resolution TIFF file.
  15. Disable the Display result option.
  16. Click OK.
  17. Open the new TIFF file in a separate application to verify that it looks good. It should contain the entire dataset, including the grid lines. When viewed at 100% resolution, the grid line labels have a font size of 18 points.
  18. Right-click on the Grid layer in the Layer Manager and select Remove.

Two similar options are also available:

  • File > Export View to > Geospatial PDF: This option lets you control the print resolution and page size for PDF output.
  • File > Export Selected Layer to TIFF: This option exports a single image layer displayed in the view to a TIFF file. It saves the entire image extent, including any enhancements (except for sharpening) at full resolution. No other layers are retained such as annotations or vectors.

Next you will learn more about data-processing tools in ENVI.

Process Data


At the heart of ENVI is a wide variety of analytics that process image data into information used for vegetation studies, land use monitoring, defense and intelligence, and other applications. Examples of analytics include change detection, feature extraction, and classification. All of the analytics are available from the Toolbox, located on the right side of the ENVI application. The ENVI Toolbox also contains tools used for image preprocessing, raster operations, geographic positioning, and mosaicking. Tools are organized by folder according to different applications.

In this section you will run two different tools while learning about masks and regions of interest (ROIs).

Spectral Indices

Spectral indices are combinations of spectral reflectance from two or more wavelengths that indicate the relative abundance of a feature of interest. Vegetation indices are the most common type such as the Normalized Difference Vegetation Index (NDVI). To ensure the most quantitatively accurate results, the input image used for spectral indices should be in units of reflectance and corrected for atmospheric effects. You do not need to perform those steps in this tutorial. However, we provide a region of interest (ROI) file that you can use to mask out water from the image, before creating spectral index images.

  1. Press the F12 key on your keyboard to zoom to the full extent of the orthophoto.
  2. Click the Open button in the toolbar.
  3. Navigate to the directory where you saved the tutorial data, and select CentralParkWaterROI.xml. Click Open. Colored polygons overlay the ponds in the orthophoto.
  4. Type indices in the search window of the Toolbox.
  5. Double-click Spectral Indices. The Data Selection dialog appears.
  6. Click the Mask button.
  7. Select the Water ROI.
  8. Enable the Inverse mask option.
  1. Click OK in the Mask Selection dialog, then again in the Data Selection dialog.
  2. In the Spectral Indices dialog, select Triangular Greenness Index. This index (TGI) highlights vegetation greenness in an image with red, green, and blue bands. The TGI is highly correlated with leaf chlorophyll content.
  3. Keep the default selection of File for Input Raster.
  4. Choose an output directory for the file, and name it CentralParkTGI.dat.
  5. Enable the Display result option.
  6. Click OK. When processing is complete, the TGI image is displayed. Brighter pixels correspond to vegetation that has a light-green color in the orthophoto.
  7. Toggle the CentralParkTGI.dat layer on and off in the Layer Manager, to compare it with the orthophoto.
  8. Right-click on the CentralParkTGI.dat and Regions of Interest layers in the Layer Manager, and select Remove.
  9. Click the Clear Search button in the Toolbox.

Run Tasks

The ENVI application programming interface (API) contains over 200 tools called ENVITasks that you can use in a programming script. Some ENVITasks are exposed as tools in the ENVI Toolbox; for example, Spectral Indices. Others are not, such as RGB to HSI Raster and Export to PNG. However, you can still run these unexposed tasks through the ENVI user interface using the Run Task tool. The following steps provide an example.

  1. In the Toolbox, expand the Task Processing folder and double-click Run Task. The Run Task dialog appears.
  2. In the Run Task dialog, type rgb in the search field.
  3. Select RGB to HSI Raster, and click Run. The RGB to HSI Raster dialog appears.
  4. This task will create a new image that has been transformed from a red/green/blue (RGB) color space to a hue/saturation/intensity (HSI) color space. It requires an input image that only has three bands in the order of red, green, and blue. Since the orthophoto has four bands, you must define a spectral subset that only includes the first three bands.

  5. Click the Browse button next to the Input Raster field. The Data Selection dialog appears.
  6. Click the Spectral Subset button. The Spectral Subset dialog appears.
  7. Click Band 1: Red, then press the Shift key on your keyboard and select Band 3: Blue. Bands 1-3 are now selected.
  8. Click OK in the Spectral Subset dialog, followed by OK in the Data Selection dialog.
  9. Click the Virtual Raster radio button next to Output Raster, to write the output image to memory instead of disk.
  10. Click OK in the RGB to HSI Raster dialog to run the task. The new HSI image appears in the Image window.

This concludes the tutorial. Close ENVI by selecting File > Exit from the menu bar.

Learn More


As you continue to explore ENVI, here are some resources to help you:

  • ENVI supports imagery from many different sensors as well as vector formats. Beginning with version 5.5, Service Pack 1, ENVI also reads and displays OpenStreetMap® vectors. For a full list of data formats, see Supported Data Types.
  • You can export images to different formats using the File > Save As menu. This only saves the raster data, regardless of the contents of the view.
  • See Visual Programming with the ENVI Modeler to learn how to create powerful workflows in ENVI, including batch processing and running analytics in different environments.
  • See the ENVI Programming Guide to learn how to write programming scripts that use ENVI+IDL functionality.
  • See Tutorials for more exercises on using ENVI in different applications.



© 2019 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us