Goal: To modify a list of rasters using the histogram-equalize stretch-type

What is the appropriate tool to use to change the stretch type of a list of rasters to histogram equalize with arcpy?

Here is how you access the tool from the ArcMap GUI:

enter image description here

Here is my code sans necessary tool which would preform histogram equalization on all of my rasters.

import arcpy, os

inFolder = "pathway to folder containing rasters"

arcpy.env.workspace = inFolder
arcpy.env.overwriteOutput = True
arcpy.env.parallelProcessingFactor = "50%"

rasterList = arcpy.ListRasters("*", "ALL")  # this calls folder in workspace

newlist = [] 
for raster in rasterList:

# Looking for tool which would help with running Histogram Equalize on all rasters.
# Does such a tool even exist?  I am temporarily calling such tool: Name_of_appropriate_tool
# Tools I have tried are listed below along with explanation 

HistEqualized = Name_of_appropriate_tool(raster)


print newlist

I have tried

1. ApplySymbologyFromLayer

ApplySymbologyFromLayer_management (in_layer, in_symbology_layer, {symbology_fields}, {update_symbology})

but I cannot use an in_symbology_layer which would apply to all rasters. The required in_symbology_layer parameter changes all rasters uniformly, whereas the histogram equalize feature accessible in ArcMap -which I want- will change (equalize) all rasters according to their min and max value as well as the distribution of values between the min and max value. This is not a uniform change, it is an alteration which is based on each rasters' unique values.

2. ZonalHistogram

ZonalHistogram (in_zone_data, zone_field, in_value_raster, out_table, {out_graph})

but this just outputs a dBASE table. I want to output a histogram equalized raster, not a table.

3. Stretch Function

This seems to just give me the option of gamma. Gamma modifies each raster according to a standardization equation, but this is not the same standardization equation as the "histogram equalized" standardization equation.

Any advice?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.