Skip to main content

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)

Parameter Explanation Data Type

raster

The input raster.

Raster

kernel

Specify the filtering method.

  • 0—Enhance an image with a LINE_DETECTION_HORIZONTAL filter.

  • 1—Enhance an image with a Line Detection Vertical filter.

  • 2—Enhance an image with a Line Detection Left Diagonal filter.

  • 3—Enhance an image with a Line Detection Right Diagonal filter.

  • 4—Enhance 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.

  • 7—Enhance 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.

  • 12—Enhance 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.

  • 15—Enhance an image with a Laplacian_3X3 filter.

  • 16—Enhance an image with a Laplacian_5X5 filter.

  • 17—Enhance an image with a Sobel Horizontal filter.

  • 18—Enhance an image with a Sobel Vertical filter.

  • 19—Enhance an image with a Sharpen filter.

  • 20—Enhance an image with a Sharpen2 filter.

  • 21—Enhance an image with a Point Spread filter.

The default value is None.

String

Return value

Data Type Explanation

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.sa.Convolution(imagePath1, 15)