Spectral transformations

There are several spectral transformation methods in Earth Engine. These include instance methods on images such as normalizedDifference(), unmix(), rgbToHsv() and hsvToRgb(). The latter two methods are useful for pan sharpening. For example:

// Load a Landsat 8 top-of-atmosphere reflectance image.
var image = ee.Image('LANDSAT/LC8_L1T_TOA/LC80440342014077LGN00');
Map.addLayer(
    image,
    {bands: ['B4', 'B3', 'B2'], min: 0, max: 0.25, gamma: [1.1, 1.1, 1]},
    'rgb');

// Convert the RGB bands to the HSV color space.
var hsv = image.select(['B4', 'B3', 'B2']).rgbToHsv();

// Swap in the panchromatic band and convert back to RGB.
var sharpened = ee.Image.cat([
  hsv.select('hue'), hsv.select('saturation'), image.select('B8')
]).hsvToRgb();

// Display the pan-sharpened result.
Map.setCenter(-122.44829, 37.76664, 13);
Map.addLayer(sharpened,
             {min: 0, max: 0.25, gamma: [1.3, 1.3, 1.3]},
             'pan-sharpened');
    

Spectral unmixing is implemented in Earth Engine as the image.unmix() method. (For more flexible methods, see the Array Transformations page). The following is an example of unmixing Landsat 5 with predetermined urban, vegetation and water endmembers:

// Load a Landsat 5 image.
var image = ee.Image('LANDSAT/LT5_L1T/LT50440342008045EDC00');
Map.setCenter(-122.1899, 37.5010, 10); // San Francisco Bay
Map.addLayer(image, {bands: ['B4', 'B3', 'B2'], min: 0, max: 128}, 'image');

// Define spectral endmembers.
var urban = [88, 42, 48, 38, 86, 115, 59];
var veg = [50, 21, 20, 35, 50, 110, 23];
var water = [51, 20, 14, 9, 7, 116, 4];

// Unmix the image.
var fractions = image.unmix([urban, veg, water]);
Map.addLayer(fractions, {}, 'unmixed');
    

The unmixing result should look something like Figure 1.

unmixed_sf
Figure 1. Landsat 5 imagery unmixed to urban (red), vegetation (green) and water (blue) fractions. San Francisco bay area, California, USA.

Enviar comentarios sobre…

Google Earth Engine API