GEEHSV图像融合
2019-01-04 本文已影响0人
赤豆冰棍
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');
步骤分析
- 创建ee对象,获取LC08数据,筛选获取时间,包含的坐标点,按照云量排序,获得云量最少的一景影像
- 选择RGB三个波段(432),选择全色波段8
- 色彩空间转换,rgb到hsv空间
- 使用全色波段替换掉h分量
- 设置地图中心,缩放等级
- 添加图像融合图层
- 添加原始图像
主要方法
- 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]区间内。
- ee.Image.cat()
Concatenate the given images together into a single image.
Returns the combined image.
Arguments:var_args (VarArgs<Image>):The images to be combined.
Returns: Image
组合输入的影像为一个影像。返回组合数据。
- 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]区间内。