AI-generated Key Takeaways
-
The
ee.Kernel.fixed()method creates a Kernel object. -
This method takes optional arguments for width, height, x and y focus locations, and a boolean to normalize the weights, but requires a 2-D list of weights.
-
The
weightsargument should be a 2-D list with dimensions matching the height and width of the kernel. -
Examples in JavaScript and Python demonstrate how to create a fixed kernel using a list of weights.
| 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] */
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]