Ankündigung: Alle nicht kommerziellen Projekte, die vor dem 15. April 2025 für die Nutzung der Earth Engine registriert wurden, müssen die Berechtigung zur nicht kommerziellen Nutzung bestätigen, um weiterhin auf die Earth Engine zugreifen zu können.
In Earth Engine gibt es mehrere Methoden zur Spektraltransformation. Dazu gehören Methoden für Instanzen von Bildern wie normalizedDifference(), unmix(), rgbToHsv() und hsvToRgb().
Schärfen von Bildern
Durch die Pan-Aufhellung wird die Auflösung eines Mehrbandbilds durch die Verbesserung eines entsprechenden panchromatischen Bilds mit höherer Auflösung verbessert.
Die Methoden rgbToHsv() und hsvToRgb() sind nützlich für die Schärfung bei Schwenkbewegungen.
Die spektrale Auftrennung ist in der Earth Engine als image.unmix()-Methode implementiert.
Flexiblere Methoden finden Sie auf der Seite Arraytransformationen. Das folgende Beispiel zeigt die Auftrennung von Landsat 5-Daten mit vordefinierten Endmitgliedern für Städte, Vegetation und Wasser:
[null,null,["Zuletzt aktualisiert: 2025-07-25 (UTC)."],[[["\u003cp\u003eEarth Engine provides spectral transformation methods like \u003ccode\u003enormalizedDifference()\u003c/code\u003e, \u003ccode\u003eunmix()\u003c/code\u003e, \u003ccode\u003ergbToHsv()\u003c/code\u003e, and \u003ccode\u003ehsvToRgb()\u003c/code\u003e for image manipulation.\u003c/p\u003e\n"],["\u003cp\u003ePan sharpening enhances image resolution by integrating a panchromatic band, often achieved using \u003ccode\u003ergbToHsv()\u003c/code\u003e and \u003ccode\u003ehsvToRgb()\u003c/code\u003e for color space conversion.\u003c/p\u003e\n"],["\u003cp\u003eSpectral unmixing, facilitated by \u003ccode\u003eimage.unmix()\u003c/code\u003e, decomposes image pixels into fractions of predetermined spectral endmembers (e.g., urban, vegetation, water).\u003c/p\u003e\n"],["\u003cp\u003eCode examples demonstrate pan-sharpening with Landsat 8 and spectral unmixing with Landsat 5 using both JavaScript and Python APIs in Earth Engine.\u003c/p\u003e\n"]]],[],null,["# Spectral transformations\n\n|---------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------|\n| [Run in Google Colab](https://colab.research.google.com/github/google/earthengine-community/blob/master/guides/linked/generated/image_transforms.ipynb) | [View source on GitHub](https://github.com/google/earthengine-community/blob/master/guides/linked/generated/image_transforms.ipynb) |\n\nThere are several spectral transformation methods in Earth Engine. These include instance\nmethods on images such as `normalizedDifference()`, `unmix()`,\n`rgbToHsv()` and `hsvToRgb()`.\n\nPan sharpening\n--------------\n\nPan sharpening improves the resolution of a multiband image through\nenhancement provided by a corresponding panchromatic image with finer resolution.\nThe `rgbToHsv()` and `hsvToRgb()` methods are useful for pan\nsharpening.\n\n### Code Editor (JavaScript)\n\n```javascript\n// Load a Landsat 8 top-of-atmosphere reflectance image.\nvar image = ee.Image('LANDSAT/LC08/C02/T1_TOA/LC08_044034_20140318');\nMap.addLayer(\n image,\n {bands: ['B4', 'B3', 'B2'], min: 0, max: 0.25, gamma: [1.1, 1.1, 1]},\n 'rgb');\n\n// Convert the RGB bands to the HSV color space.\nvar hsv = image.select(['B4', 'B3', 'B2']).rgbToHsv();\n\n// Swap in the panchromatic band and convert back to RGB.\nvar sharpened = ee.Image.cat([\n hsv.select('hue'), hsv.select('saturation'), image.select('B8')\n]).hsvToRgb();\n\n// Display the pan-sharpened result.\nMap.setCenter(-122.44829, 37.76664, 13);\nMap.addLayer(sharpened,\n {min: 0, max: 0.25, gamma: [1.3, 1.3, 1.3]},\n 'pan-sharpened');\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\n# Load a Landsat 8 top-of-atmosphere reflectance image.\nimage = ee.Image('LANDSAT/LC08/C02/T1_TOA/LC08_044034_20140318')\n\n# Convert the RGB bands to the HSV color space.\nhsv = image.select(['B4', 'B3', 'B2']).rgbToHsv()\n\n# Swap in the panchromatic band and convert back to RGB.\nsharpened = ee.Image.cat(\n [hsv.select('hue'), hsv.select('saturation'), image.select('B8')]\n).hsvToRgb()\n\n# Define a map centered on San Francisco, California.\nmap_sharpened = geemap.Map(center=[37.76664, -122.44829], zoom=13)\n\n# Add the image layers to the map and display it.\nmap_sharpened.add_layer(\n image,\n {\n 'bands': ['B4', 'B3', 'B2'],\n 'min': 0,\n 'max': 0.25,\n 'gamma': [1.1, 1.1, 1],\n },\n 'rgb',\n)\nmap_sharpened.add_layer(\n sharpened,\n {'min': 0, 'max': 0.25, 'gamma': [1.3, 1.3, 1.3]},\n 'pan-sharpened',\n)\ndisplay(map_sharpened)\n```\n\nSpectral unmixing\n-----------------\n\nSpectral unmixing is implemented in Earth Engine as the `image.unmix()` method.\n(For more flexible methods, see the [Array Transformations\npage](/earth-engine/guides/arrays_transformations)). The following is an example of unmixing Landsat 5 with predetermined urban,\nvegetation and water endmembers:\n\n### Code Editor (JavaScript)\n\n```javascript\n// Load a Landsat 5 image and select the bands we want to unmix.\nvar bands = ['B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'B7'];\nvar image = ee.Image('LANDSAT/LT05/C02/T1/LT05_044034_20080214')\n .select(bands);\nMap.setCenter(-122.1899, 37.5010, 10); // San Francisco Bay\nMap.addLayer(image, {bands: ['B4', 'B3', 'B2'], min: 0, max: 128}, 'image');\n\n// Define spectral endmembers.\nvar urban = [88, 42, 48, 38, 86, 115, 59];\nvar veg = [50, 21, 20, 35, 50, 110, 23];\nvar water = [51, 20, 14, 9, 7, 116, 4];\n\n// Unmix the image.\nvar fractions = image.unmix([urban, veg, water]);\nMap.addLayer(fractions, {}, 'unmixed');\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\n# Load a Landsat 5 image and select the bands we want to unmix.\nbands = ['B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'B7']\nimage = ee.Image('LANDSAT/LT05/C02/T1/LT05_044034_20080214').select(bands)\n\n# Define spectral endmembers.\nurban = [88, 42, 48, 38, 86, 115, 59]\nveg = [50, 21, 20, 35, 50, 110, 23]\nwater = [51, 20, 14, 9, 7, 116, 4]\n\n# Unmix the image.\nfractions = image.unmix([urban, veg, water])\n\n# Define a map centered on San Francisco Bay.\nmap_fractions = geemap.Map(center=[37.5010, -122.1899], zoom=10)\n\n# Add the image layers to the map and display it.\nmap_fractions.add_layer(\n image, {'bands': ['B4', 'B3', 'B2'], 'min': 0, 'max': 128}, 'image'\n)\nmap_fractions.add_layer(fractions, None, 'unmixed')\ndisplay(map_fractions)\n```\nFigure 1. Landsat 5 imagery unmixed to urban (red), vegetation (green) and water (blue) fractions. San Francisco bay area, California, USA."]]