Convolution

Summary

Performs filtering on the pixel values in an image, which can be used for sharpening an image, blurring an image, detecting edges within an image, or other kernel-based enhancements.

Discussion

For more information about how this function works, see the Convolution 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

Convolution (raster, kernel)
ParameterExplanationData Type
raster

The input raster.

Raster
kernel
[kernel,...]

Specify the filtering method.

  • 0Enhance an image with a LINE_DETECTION_HORIZONTAL filter.
  • 1Enhance an image with a Line Detection Vertical filter.
  • 2Enhance an image with a Line Detection Left Diagonal filter.
  • 3Enhance an image with a Line Detection Right Diagonal filter.
  • 4Enhance an image with a Gradient North filter.
  • 5 Enhance an image with a Gradient West filter.
  • 6 Enhance an image with a Gradient East filter.
  • 7Enhance an image with a Gradient South filter.
  • 8 Enhance an image with a Gradient Northeast filter.
  • 9 Enhance an image with a Gradient Northwest filter.
  • 10 Enhance an image with a Smooth Arithmetic Mean filter.
  • 11 Enhance an image with a Smoothing_3X3 filter.
  • 12Enhance an image with a Smoothing_5X5 filter.
  • 13 Enhance an image with a Sharpening_3X3 filter.
  • 14 Enhance an image with a Sharpening_5X5 filter.
  • 15Enhance an image with a Laplacian_3X3 filter.
  • 16Enhance an image with a Laplacian_5X5 filter.
  • 17 Enhance an image with a Sobel Horizontal filter.
  • 18Enhance an image with a Sobel Vertical filter.
  • 19Enhance an image with a Sharpen filter.
  • 20Enhance an image with a Sharpen2 filter.
  • 21Enhance an image with a Point Spread filter.

(The default value is None)

String
Return Value
Data TypeExplanation
Raster

The output filtered image.

Code sample

Convolution example

Create an image with edges enhanced with a Laplacian 3X3 filter.

import arcpy

Convolution_raster = arcpy.ia.Convolution(imagePath1, 15)