This function constructs an ENVIRaster from a source raster where a first-order entropy texture has been computed.

ENVI uses the following equation from Anys et al. (1994) to compute entropy using the pixel values in a kernel centered at the current pixel. Entropy is calculated based on the distribution of the pixel values in the kernel. It measures the disorder of the values in a kernel.


= Probability of each pixel value

= Number of distinct grey levels in the quantized image

Reference: Anys, H., A. Bannari, D. C. He, and D. Morin. "Texture analysis for the mapping of urban areas using airborne MEIS-II images." Proceedings of the First International Airborne Remote Sensing Conference and Exhibition 3 (1994): 231-245.

See Process for Computing Texture Metrics for the preprocessing steps used to compute texture metrics such as entropy.

The result is a virtual raster, which has some additional considerations with regard to methods and properties. See Virtual Rasters for more information, including how they differ from ENVITasks.

The equivalent task is FirstOrderEntropyTextureRaster.


; Start the application
e = ENVI()
; Select an input file
file = FILEPATH('qb_boulder_msi', $
raster = e.OpenRaster(file)
; Compute first-order entropy
entropyImage = ENVIFirstOrderEntropyTextureRaster(raster, [3,3], 64)
; Display each entropy band in a separate view
view1 = e.GetView()
layer1 = view1.CreateLayer(entropyImage, BANDS=[0], $
  NAME='First-order entropy for band 1')
view2 = e.CreateView()
layer2 = view2.CreateLayer(entropyImage, BANDS=[1], $
  NAME='First-order entropy for band 2')
view3 = e.CreateView()
layer3 = view3.CreateLayer(entropyImage, BANDS=[2], $
  NAME='First-order entropy for band 3')
view4 = e.CreateView()
layer4 = view4.CreateLayer(entropyImage, BANDS=[3], $
  NAME='First-order entropy for band 4')
; Create a geographic and zoom link for all views
view1.GeoLink, /LINK_ALL, /ZOOM_LINK


ENVIRaster = ENVIFirstOrderEntropyTextureRaster(Input_Raster, Kernel_Size, Bin_Count [, Keywords=value])

Return Value

This routine returns a reference to an ENVIRaster.



Specify the input ENVIRaster.


Specify a two-element array [n,m] as the kernel size, where n is the number of columns and m is the number of rows. The values must be odd and at least 3, for example [3,3].


Specify the number of bins in the histogram to be used for the entropy calculation.


This virtual raster inherits methods and properties from ENVIRaster; however the following methods will override the ENVIRaster methods:




ERROR (optional)

Set this keyword to a named variable that will contain any error message issued during execution of this routine. If no error occurs, the ERROR variable will be set to a null string (''). If an error occurs and the routine is a function, then the function result will be undefined.

When this keyword is not set and an error occurs, ENVI returns to the caller and execution halts. In this case, the error message is contained within !ERROR_STATE and can be caught using IDL's CATCH routine. See IDL Help for more information on !ERROR_STATE and CATCH.

See Manage Errors for more information on error handling in ENVI programming.

MAX_SRC_VALUES (optional)

Set this keyword to an array of maximum source values to be used in the histogram for the entropy calculation, one for each band. The number of elements in the array must match the number of bands. If you set this keyword, you must also set MIN_SRC_VALUES.

MIN_SRC_VALUES (optional)

Set this keyword to an array of minimum source values to be used in the histogram for the entropy calculation, one for each band. The number of elements in the array must match the number of bands. If you set this keyword, you must also set MAX_SRC_VALUES.


Specify a string that identifies the raster.

Version History

ENVI 5.4


API Version


See Also

ENVIRaster, FirstOrderEntropyTexture Task, ENVILabelEntropyTextureRaster, LabelEntropyTexture Task, ENVIRankStrengthTextureRaster, RankStrengthTexture Task