ee.Kernel.fixed
Creates a Kernel.
Usage | Returns | ee.Kernel.fixed(width, height, weights, x, y, normalize) | Kernel |
Argument | Type | Details | width | Integer, default: -1 | The width of the kernel in pixels. |
height | Integer, default: -1 | The height of the kernel in pixels. |
weights | List | A 2-D list of [height] x [width] values to use as the weights of the kernel. |
x | Integer, default: -1 | The location of the focus, as an offset from the left. |
y | Integer, default: -1 | The location of the focus, as an offset from the top. |
normalize | Boolean, default: false | Normalize the kernel values to sum to 1. |
Examples
Code Editor (JavaScript)
// Kernel weights.
var weights = [[4, 3, 2, 1, 2, 3, 4],
[4, 3, 2, 1, 2, 3, 4],
[4, 3, 2, 1, 2, 3, 4]];
print('A fixed kernel', ee.Kernel.fixed({weights: weights}));
/**
* Output weights matrix
*
* [4, 3, 2, 1, 2, 3, 4]
* [4, 3, 2, 1, 2, 3, 4]
* [4, 3, 2, 1, 2, 3, 4]
*/
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
Colab (Python)
from pprint import pprint
weights = [[4, 3, 2, 1, 2, 3, 4],
[4, 3, 2, 1, 2, 3, 4],
[4, 3, 2, 1, 2, 3, 4]]
print('A fixed kernel:')
pprint(ee.Kernel.fixed(**{'weights': weights}).getInfo())
# Output weights matrix
# [4, 3, 2, 1, 2, 3, 4]
# [4, 3, 2, 1, 2, 3, 4]
# [4, 3, 2, 1, 2, 3, 4]
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 kernel to be applied to an image, using a fixed set of weights provided in a 2-D list."],["The kernel can be customized with dimensions (width, height), weight values, and a central focus point (x, y)."],["Optionally, the kernel weights can be normalized to sum to 1."],["Examples in JavaScript, Python, and Colab are included to demonstrate how to create and use a fixed kernel."]]],[]]