ee.Kernel.prewitt
Generates a 3x3 Prewitt edge-detection kernel.
Usage | Returns |
---|
ee.Kernel.prewitt(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 Prewitt kernel', ee.Kernel.prewitt());
/**
* Output weights matrix
*
* [1, 0, -1]
* [1, 0, -1]
* [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 Prewitt kernel:')
pprint(ee.Kernel.prewitt().getInfo())
# Output weights matrix
# [1, 0, -1]
# [1, 0, -1]
# [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."],[[["Creates a 3x3 Prewitt kernel for edge detection in images."],["Allows for scaling of kernel values using the `magnitude` argument."],["Offers kernel normalization with the `normalize` argument, ensuring values sum to 1."],["Provides examples in JavaScript, Python, and Colab for utilizing the kernel."]]],["The `ee.Kernel.prewitt()` function generates a 3x3 Prewitt edge-detection kernel. It accepts two optional arguments: `magnitude`, which scales the kernel values (defaulting to 1), and `normalize`, which normalizes the values to sum to 1 (defaulting to false). The function returns the kernel. Without arguments, it produces a kernel with weights: [[1, 0, -1], [1, 0, -1], [1, 0, -1]].\n"]]