Zusammenfassung
Applies a matrix to a multiband image to affect the color values of the output.
Diskussion
For more information about how this function works, see the Spectral Conversion raster function.
The referenced raster dataset for the raster object is temporary. To make it permanent, you can call the raster object's save method.
Syntax
SpectralConversion (raster, conversion_matrix)
Parameter | Erläuterung | Datentyp |
raster | The input raster. This can be a raster dataset within a mosaic dataset or raster catalog, or a raster dataset outside the mosaic dataset. | Raster |
conversion_matrix | The matrix used to convert the input raster. The equation used to perform this conversion is as follows:
where:
| Raster |
Datentyp | Erläuterung |
Raster | The output raster. |
Codebeispiel
This example is applying a matrix to a multiband image to change the color values of the output.
from arcpy.sa import *
out_raster = SpectralConversion("3bands_raster",
[0.1, 0.9, 0, 0.3, 0, 0.7, 0.1, 0.1, 0.8])
out_raster.save("C:/arcpyExamples/outputs/out_spectralconversion_raster.tif")
This example is applying a matrix to a multiband image to change the color values of the output.
# Import system modules
import arcpy
from arcpy.sa import *
# Set the analysis environments
arcpy.env.workspace = "C:/arcpyExamples/data"
# Set the local variables
in_raster = "3bands_raster"
in_conversion_matrix = [0.1, 0.9, 0, 0.3, 0, 0.7, 0.1, 0.1, 0.8]
# Execute SpectralConversion function
out_raster = SpectralConversion(in_raster, in_conversion_matrix)
#Output band 1 = (0.1 * InputBand1) + (0.9 * InputBand2) +(0 * InputBand3)
#Output band 2 = (0.3 * InputBand1) + (0 * InputBand2) +(0.7 * InputBand3)
#Output band 3 = (0.1 * InputBand1) + (0.1 * InputBand2) +(0.8 * InputBand3)
# Save output
out_raster.save("C:/arcpyExamples/outputs/out_spectralconversion_raster.tif")