ee.Kernel.fixed
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Erstellt einen Kernel.
Nutzung | Ausgabe |
---|
ee.Kernel.fixed(width, height, weights, x, y, normalize) | Kernel |
Argument | Typ | Details |
---|
width | Ganzzahl, Standard: -1 | Die Breite des Kernels in Pixeln. |
height | Ganzzahl, Standard: -1 | Die Höhe des Kernels in Pixeln. |
weights | Liste | Eine zweidimensionale Liste mit [Höhe] × [Breite]-Werten, die als Gewichte des Kernels verwendet werden sollen. |
x | Ganzzahl, Standard: -1 | Die Position des Fokus als Versatz vom linken Rand. |
y | Ganzzahl, Standard: -1 | Die Position des Fokus als Versatz vom oberen Rand. |
normalize | Boolescher Wert, Standard: „false“ | Normalisieren Sie die Kernelwerte so, dass sie sich auf 1 summieren. |
Beispiele
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 einrichten
Informationen zur Python API und zur Verwendung von geemap
für die interaktive Entwicklung finden Sie auf der Seite
Python-Umgebung.
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]
Sofern nicht anders angegeben, sind die Inhalte dieser Seite unter der Creative Commons Attribution 4.0 License und Codebeispiele unter der Apache 2.0 License lizenziert. Weitere Informationen finden Sie in den Websiterichtlinien von Google Developers. Java ist eine eingetragene Marke von Oracle und/oder seinen Partnern.
Zuletzt aktualisiert: 2025-07-26 (UTC).
[null,null,["Zuletzt aktualisiert: 2025-07-26 (UTC)."],[[["\u003cp\u003eCreates a kernel to be applied to an image, using a fixed set of weights provided in a 2-D list.\u003c/p\u003e\n"],["\u003cp\u003eThe kernel can be customized with dimensions (width, height), weight values, and a central focus point (x, y).\u003c/p\u003e\n"],["\u003cp\u003eOptionally, the kernel weights can be normalized to sum to 1.\u003c/p\u003e\n"],["\u003cp\u003eExamples in JavaScript, Python, and Colab are included to demonstrate how to create and use a fixed kernel.\u003c/p\u003e\n"]]],["The function `ee.Kernel.fixed` creates a kernel using specified parameters. Key actions involve defining the kernel's `width` and `height` in pixels and providing a 2-D list of `weights`. Users can specify the focus point using `x` and `y` offsets. An option to `normalize` the weights, ensuring they sum to 1, is available. The function then returns a `Kernel` object for use. Example `weights` data are shown.\n"],null,["# ee.Kernel.fixed\n\nCreates a Kernel.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|------------------------------------------------------------------------------------|---------|\n| `ee.Kernel.fixed(`*width* `, `*height* `, weights, `*x* `, `*y* `, `*normalize*`)` | Kernel |\n\n| Argument | Type | Details |\n|-------------|-------------------------|----------------------------------------------------------------------------------|\n| `width` | Integer, default: -1 | The width of the kernel in pixels. |\n| `height` | Integer, default: -1 | The height of the kernel in pixels. |\n| `weights` | List | A 2-D list of \\[height\\] x \\[width\\] values to use as the weights of the kernel. |\n| `x` | Integer, default: -1 | The location of the focus, as an offset from the left. |\n| `y` | Integer, default: -1 | The location of the focus, as an offset from the top. |\n| `normalize` | Boolean, default: false | Normalize the kernel values to sum to 1. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// Kernel weights.\nvar weights = [[4, 3, 2, 1, 2, 3, 4],\n [4, 3, 2, 1, 2, 3, 4],\n [4, 3, 2, 1, 2, 3, 4]];\n\nprint('A fixed kernel', ee.Kernel.fixed({weights: weights}));\n\n/**\n * Output weights matrix\n *\n * [4, 3, 2, 1, 2, 3, 4]\n * [4, 3, 2, 1, 2, 3, 4]\n * [4, 3, 2, 1, 2, 3, 4]\n */\n```\nPython setup\n\nSee the [Python Environment](/earth-engine/guides/python_install) page for information on the Python API and using\n`geemap` for interactive development. \n\n```python\nimport ee\nimport geemap.core as geemap\n```\n\n### Colab (Python)\n\n```python\nfrom pprint import pprint\n\nweights = [[4, 3, 2, 1, 2, 3, 4],\n [4, 3, 2, 1, 2, 3, 4],\n [4, 3, 2, 1, 2, 3, 4]]\n\nprint('A fixed kernel:')\npprint(ee.Kernel.fixed(**{'weights': weights}).getInfo())\n\n# Output weights matrix\n\n# [4, 3, 2, 1, 2, 3, 4]\n# [4, 3, 2, 1, 2, 3, 4]\n# [4, 3, 2, 1, 2, 3, 4]\n```"]]