Use the Feature Counting Tool to count up to 5000 individual features in raster and vector data. Examples of using the Feature Counting Tool include counting roads, buildings, water bodies, trees, and livestock.

You can create separate feature types and count within each type. For example, create one type for water bodies and another for buildings. You can also overlay a grid on the image and count within the gridded areas. This can be useful for large images, where multiple users need to perform feature counting within different areas of the image.

Count and Manage Features


  1. Click the Feature Counting Tool button . A Feature Counting layer is added to the Layer Manager, and the Feature Counting Tool dialog appears with the following default settings. You can change the defaults.

    • Feature 1 is the name of the first feature group. The name appears as a label in the Image window view if the Label check box is enabled. To change the name, click in the name field, enter a new name, and press the Enter key.
    • Light blue is the color of the first feature group. The features you click for this group will be marked in a light-blue symbol and text. To change the color, click the Feature Color drop-down list from the toolbar. You can choose ENVI, System, or pre-defined Custom colors in the Standard tab, or select the Custom tab on the color palette to create a custom color.
    • Symbol is enabled, with a balloon as the default symbol that will be visible in the view. Disable the check box to hide the symbol.
    • Label is enabled so the feature group label will be visible in the view. Disable the check box to hide the label.
    • Description is disabled by default. Enable this option to include a description of the point in the view.
    • Count is enabled to show count number of each feature in the view. Disable the check box to hide the count.
    • Grid is disabled. When enabled, a grid is overlaid on the view and the feature count will include grid values (A1, A2, and so forth) and the count number (if Count Number is enabled). When enabled, the default grid size is 4x4 pixels, but you can change the grid size by entering different values in the fields provided. For details on using a grid, see Feature Counting with a Grid.
    • Coordinates is disabled by default. Enable this option to display the coordinates of the point in the view. When Coordinates is enabled, a drop-down list next to the check box allows you to select the units to display (File, Map, Lat/Lon, or MGRS).
  2. To count features, click on features in the view, or hover the cursor over a feature and press the Enter key. A record for the feature is added to the Feature Counting Tool table. If needed, you can delete a feature record by pressing the Backspace key. If you used the default settings in the Feature Counting Tool dialog, the symbol, feature label, and count will display in the view, as shown below.
  3. The number keys (1-9) on your keyboard provide shortcuts for adding points for different feature groups. For example, if you have four different features (Feature_1 through Feature_4), clicking the 3 key will add a point beneath the cursor location for Feature_3.

  4. To move to a different part of the image to continue counting features, click and drag the middle mouse button to pan around the image. Or, click the Scroll View button in the toolbar to advance to the next section of an image. If you select this, or any other tool in the toolbar (for example, Select or Pan), the Feature Counting tool will lose focus. To continue counting features, click the Feature Counting Tool button again.
  5. To create a new feature type to count, click the Add Feature button .

To create a custom color:

  1. In the Custom tab, use the color space table to select a color, or enter R,G,B or H,S,L values in the fields provided.
  2. Use the slider below the color space table to adjust the color gradient.
  3. Click OK to add the new color to the Custom colors section on the Standard tab.

To manage the Feature Counting Tool table:

  • By default, the record for a marked spot appears in the table in the color defined for that feature. So, if Feature 1 was red and Feature 2 was green, the table would display Feature 1 and Feature 2 text in their respective colors. To display the table records in black-text only, select Options from the Feature Counting Tool menu and toggle off Colored Text in Table.
  • The default coordinate included in the table is MGRS. To show coordinates in other formats, right-click one of the table columns and select File x,y, Map x,y, or Lat/Lon to show the selected coordinates in new table columns. You can select one coordinate format, or all formats, and you can toggle off any coordinate options you do not want to show in the table.
  • When multiple records are listed in the table, you can sort them. Select a table column, then right-click and select Sort by Original Order, Sort by Selected Column Forward, or Sort by Selected Column Reverse.
  • To jump to a counted feature and center it in the middle of the Image window view, click on the row number for that record. You can also use the GoTo arrow buttons at the bottom of the dialog to step through the records in the table.
  • To delete a record, select the row of the record to delete in the Feature Counting Tool table, then click the Delete button . To delete all feature counting records, click the Delete All button .
  • To delete the selected feature and all of its records, click the Delete Feature button . To delete all features and their records, click the Delete All Features button .

Feature Counting using a Grid


When the Grid check box is enabled, a grid is overlaid on the raster. The size of the grid is not based on the projection of the raster.

When you enable the grid, it is overlaid on the top-most layer listed in the Layer Manager and the features that are counted are related specifically to that raster. If you have multiple rasters open and want the grid and the feature counting to be related to a different raster, select Options > Grid Layer Host from the Feature Counting Tool menu bar and select a different raster.

The image below shows an example of how feature counting is incremented when it is done without a grid. The count increments numerically in the order in which items were clicked, no matter where is located in the view.

When the Grid check box is enabled, the grid appears with the x-axis grids labeled alphabetically and the y-axis grids labeled numerically.

Counting is incremented by grid position first, followed by the count number of the item, as in the example below. If you click outside the grid, there will not be a grid number, for example, Feature 1 ** [1]. When you toggle on and off the grid, the numbering will toggle between the non-grid numbering shown previously, and the grid-style numbering shown below.

Save, Export, and Restore Feature Counting Files


To save feature counting records, select one of the following from the Feature Counting Tool menu bar:

  • To save new feature counting records to an ENVI feature counting file (.efc), select File > Save As.
  • To save additional records to an existing ENVI feature counting file (.efc), select File > Save.

To export feature counting records to other formats, select one of the following from the Feature Counting Tool menu bar:

  • File > Export > Shapefile, to save to a .shp file format.
  • File > Export > Report, to save to a .txt file format.
  • File > Export > ENVI ROIs, to save to point-based regions of interest (ROIs) in .xml file format.
  • File > Export > Comma-Separated Values (CSV), to save to a .csv file format.

You can write a script to export feature counting records to ROIs using the FeatureCountToROI task.

To restore feature counting records from a file:

  1. Select File > Open from the ENVI main menu bar. A Data Selection dialog appears.
  2. Choose an associated raster, and click OK.

To restore feature counting records from another file within the Feature Counting Tool:

  1. Select File > Restore from the Feature Counting Tool menu bar.

    One of the following appears:

    • If you have unsaved marked features on the raster, you are prompted to save them in the Save Features dialog.
    • If you do not have unsaved marked features, the Restore Features dialog appears.
  2. In the Restore Features dialog, select an .efc or .dbz file.
  3. Click Open to open the Feature Counting layer.

Edit Feature Counting Properties


Click the Feature Counting Properties button in the Feature Counting Tool to open the property sheet. When you change the defaults for a property, all the records of the selected feature group are automatically updated with the new setting.

  • Feature Name: The name of the feature group. The system default is Feature n, where the number increments by 1 for each new group added.
  • Feature Color: The text and symbol color for the feature group. The system default is red for the first feature group, then green, then blue, and so forth.
  • Description: A brief description of the feature. By default, this field does not contain a description.
  • Text Font Size: The font size for the label, count, and symbol. The default is 12.
  • Text Background Color: The font color. The default is black.
  • Text Background Fill: The method used to display a background color for text. The None option disables background coloring. The Outline option (default) uses the specified Background Color to outline the text without creating a full background. The Full option uses the specified Background Color to create a background for the text; for example:

    Note: The Outline option does not work if the IDL Software Rendering preference is enabled. If you use ENVI from a remote session, software rendering is enabled and, thus, outlines may not be visible.

  • Symbol: Select a symbol style to display as the feature marker. The default is a flag.
  • Symbol Font Name: The font type for the symbol. The default is ENVI Symbols.
  • Symbol Horizontal Alignment: The horizontal margin to offset the symbol from where you clicked in the view to count the feature. The default is .5. You can also adjust the position by clicking and dragging the symbol graphic on the right side of properties sheet.
  • Symbol Vertical Alignment: The vertical margin to offset the symbol from where you clicked in the view to count the feature. The default is -.18. You can also adjust the position by clicking and dragging the symbol graphic on the right side of properties sheet.
  • Show Symbol: Show or hide the symbol in the view. The default is Yes.
  • Label Font Name: The font type for the label and count text. The default is Calibri.
  • Label Position: The alignment of the label in relation to the feature marker. The position can be Right, Left, Above, Below, or Centered. The default is Right.
  • Show Label: Show or hide the label in the view. The default is Yes.
  • Show Count: Show or hide the feature count number in the view. The default is Yes.
  • Show Coordinates: Show or hide the map coordinates of the point in the view. The default is No.
  • Units: The units of the map coordinates. The default is MGRS.
  • Show Description: Show or hide the description of each point. The default is No.

See Also


Vector to Feature Count, Convert Feature Counts to ROIs