>  Docs Center  >  ENVI API  >  Classification Framework  >  Run the Classifier

Run the Classifier

Run the Classifier

The final step in the ENVI classification framework is to classify data. The ENVIClassifyRaster procedure takes in a source raster and a trained classifier. This example will classify an attribute image. Set the OUTPUT_RASTER keyword to a variable that will contain the classification raster.

This code example continues from the previous topic, Evaluate the Classifier.

First, normalize the data using the gains and offsets that you computed in Define and Train the Classifier.

normalizedRaster = ENVIGainOffsetRaster(raster, gain, offset)

Then run the classifier on the normalized raster:

classRaster = ENVIClassifyRaster(normalizedRaster, classifier)

Display the result:

view = e.GetView()
layer = view.CreateLayer(classRaster)
view.Zoom, /FULL_EXTENT

The classified image looks similar to this:

Next, you can create a map that includes a classification legend. See Work with Annotations in ENVI Help.

Next Steps

Now that you have learned about the individual steps in classification, see the following code examples that perform end-to-end classification:

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