GEEHSV图像融合

HSV图像融合

主要功能

对LC8影像,进行HSV图像融合

代码

// HSV-based Pan-Sharpening.

// Grab a sample L8 image and pull out the RGB and pan bands.
var image = ee.Image(ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA')
  .filterDate('2017-01-01', '2017-12-31')
  .filterBounds(ee.Geometry.Point(-122.0808, 37.3947))
  .sort('CLOUD_COVER')
  .first());

var rgb = image.select('B4', 'B3', 'B2');
var pan = image.select('B8');

// Convert to HSV, swap in the pan band, and convert back to RGB.
var huesat = rgb.rgbToHsv().select('hue', 'saturation');
var upres = ee.Image.cat(huesat, pan).hsvToRgb();

// There are many fine places to look; here is one.  Comment
// this out if you want to twiddle knobs while panning around.
Map.setCenter(-122.0808, 37.3947, 14);

// Display before and after layers using the same vis parameters.
Map.addLayer(rgb, {max: 0.3}, 'Original');
Map.addLayer(upres, {max: 0.3}, 'Pansharpened');

步骤分析

  1. 创建ee对象,获取LC08数据,筛选获取时间,包含的坐标点,按照云量排序,获得云量最少的一景影像
  2. 选择RGB三个波段(432),选择全色波段8
  3. 色彩空间转换,rgb到hsv空间
  4. 使用全色波段替换掉h分量
  5. 设置地图中心,缩放等级
  6. 添加图像融合图层
  7. 添加原始图像

主要方法

  1. ee.Image.rgbToHsv()
    Transforms the image from the RGB color space to the HSV color space. Produces three bands: hue, saturation and value, all floating point values in the range [0, 1].
    Arguments:this:image (Image):The image to transform.
    Returns: Image

将输入影像从RGB转换到HSV颜色空间。生成三个波段,h,s,v浮点型[0,1]区间内。

  1. ee.Image.cat()
    Concatenate the given images together into a single image.
    Returns the combined image.
    Arguments:var_args (VarArgs):The images to be combined.
    Returns: Image

组合输入的影像为一个影像。返回组合数据。

  1. ee.Image.hsvToRgb()
    Transforms the image from the HSV color space to the RGB color space. Produces three bands: red, green and blue, all floating point values in the range [0, 1].
    Arguments:this:image (Image):The image to transform.
    Returns: Image

将输入影像从HSV转换到RGB颜色空间,生成三个波段,RGB,浮点型[0,1]区间内。

你可能感兴趣的:(GEEHSV图像融合)