ee.Kernel.sobel
Generates a 3x3 Sobel edge-detection kernel.
Usage | Returns |
---|
ee.Kernel.sobel(magnitude, normalize) | Kernel |
Argument | Type | Details |
---|
magnitude | Float, default: 1 | Scale each value by this amount. |
normalize | Boolean, default: false | Normalize the kernel values to sum to 1. |
Examples
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 using
geemap
for interactive development.
import ee
import geemap.core as geemap
from pprint import pprint
print('A Sobel kernel:')
pprint(ee.Kernel.sobel().getInfo())
# Output weights matrix
# [-1, 0, 1]
# [-2, 0, 2]
# [-1, 0, 1]
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[[["Generates a 3x3 Sobel kernel for edge detection in images."],["The kernel can be scaled using the `magnitude` argument."],["Optionally, the kernel values can be normalized to sum to 1 using the `normalize` argument."],["Usage examples are provided in JavaScript, Python, and Colab environments."]]],["The `ee.Kernel.sobel()` function creates a 3x3 Sobel edge-detection kernel. It accepts two arguments: `magnitude`, which scales the kernel values (default is 1), and `normalize`, which normalizes the kernel to sum to 1 (default is false). The function returns a Kernel object with the weights matrix: `[-1, 0, 1]`, `[-2, 0, 2]`, `[-1, 0, 1]`. The kernel can be used in both Javascript and Python coding environments.\n"]]