卫星原有影像:
HSV转换后的影像:
rgbToHsv()
Transforms the image from the RGB color space to the HSV color space. Expects a 3 band image in the range [0, 1], and produces three bands: hue, saturation and value with values in the range [0, 1].
Arguments:
this:image (Image):
The image to transform.
Returns: Image
hsvToRgb()
Transforms the image from the HSV color space to the RGB color space. Expects a 3 band image in the range [0, 1], and produces three bands: red, green and blue with values in the range [0, 1].
Arguments:
this:image (Image):
The image to transform.
Returns: Image
代码:
代码语言:javascript复制var image = ee.Image('LANDSAT/LC08/C01/T1_TOA/LC08_044034_20140318');
Map.addLayer(
image,
{bands: ['B4', 'B3', 'B2'], min: 0, max: 0.25, gamma: [1.1, 1.1, 1]},
'rgb');
//将 RGB 波段转换为 HSV 颜色空间。
var hsv = image.select(['B4', 'B3', 'B2']).rgbToHsv();
//交换全色波段并转换回 RGB。通过CAT将影像合并最后转化为RGB
var sharpened = ee.Image.cat([
hsv.select('hue'), hsv.select('saturation'), image.select('B8')
]).hsvToRgb();
Map.setCenter(-122.44829, 37.76664, 13);
Map.addLayer(sharpened,
{min: 0, max: 0.25, gamma: [1.3, 1.3, 1.3]},
'pan-sharpened');