Announcement: All noncommercial projects registered to use Earth Engine beforeApril 15, 2025 mustverify noncommercial eligibility to maintain access. If you have not verified by September 26, 2025, your access may be on hold.

ee.Kernel.sobel

  • ee.Kernel.sobel generates a 3x3 Sobel edge-detection kernel.

  • Themagnitude argument scales the kernel values.

  • Thenormalize argument normalizes the kernel values to sum to 1.

  • The default Sobel kernel has weights represented by the matrix[[-1, 0, 1], [-2, 0, 2], [-1, 0, 1]].

Generates a 3x3 Sobel edge-detection kernel.

UsageReturns
ee.Kernel.sobel(magnitude,normalize)Kernel
ArgumentTypeDetails
magnitudeFloat, default: 1Scale each value by this amount.
normalizeBoolean, default: falseNormalize the kernel values to sum to 1.

Examples

Code Editor (JavaScript)

print('A Sobel kernel',ee.Kernel.sobel());/** * Output weights matrix * * [-1, 0, 1] * [-2, 0, 2] * [-1, 0, 1] */

Python setup

See the Python Environment page for information on the Python API and usinggeemap for interactive development.

importeeimportgeemap.coreasgeemap

Colab (Python)

display('A Sobel kernel:',ee.Kernel.sobel())#  Output weights matrix#  [-1, 0, 1]#  [-2, 0, 2]#  [-1, 0, 1]

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2023-10-06 UTC.