Résumé
Applies a matrix to a multiband image to affect the color values of the output.
Discussion
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.
Syntaxe
SpectralConversion (raster, conversion_matrix)
Paramètre | Explication | Type de données |
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 |
Type de données | Explication |
Raster | The output raster. |
Exemple de code
This example is applying a matrix to a multiband image to change the color values of the output.
from arcpy.ia 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.ia 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")
Vous avez un commentaire à formuler concernant cette rubrique ?