Git Product home page Git Product logo

geesharp's Introduction

geeSharp

Earth Engine Javascript Open in Code Editor

Pan-sharpen multispectral imagery in the Google Earth Engine Code Editor with one line of code:

var sharp = geeSharp.sharpen(img.select(["B4", "B3", "B2"]), img.select("B8");

Usage

Pan-sharpening

To pan-sharpen an image, separate the lower resolution multispectral bands and the higher resolution panchromatic band into two images and pass them to the geeSharp.sharpen function. For example:

// Import the geeSharp module
var geeSharp = require("users/aazuspan/geeSharp:geeSharp");

// Load an example Landsat 8 TOA image to sharpen
var img = ee.Image("LANDSAT/LC08/C01/T1_TOA/LC08_047027_20160819");

// Select the 30 m spectral bands to sharpen
var ms = img.select(["B4", "B3", "B2"]);
// Select the 15 m panchromatic band
var pan = img.select(["B8"]);

// Pan-sharpen!
var sharpened = geeSharp.sharpen(ms, pan);

By default, pansharpening in geeSharp uses the Smoothing Filter-based Intensity Modulation (SFIM) algorithm because it is fast and produces consistent, high-quality results. However, you may want to experiment with other methods. You can do that by passing an algorithm name to the sharpen function.

var method = "brovey";
var sharpened = geeSharp.sharpen(ms, pan, method);

Most sharpening functions just require the unsharpened multispectral bands and the high-resolution panchromatic band as inputs, but some algorithms (like Gram-Schmidt) may accept other parameters. You can add those parameters after the method name when calling sharpen.

// The Gram-Schmidt algorithm may require additional parameters depending on the size of your image.
var method = "GS";
var geom = ee.Geometry.Point([-122.41676185101713, 47.26851080476613]).buffer(1000);
var scale = 30;
var maxPixels = 1e13;

var sharpened = geeSharp.sharpen(ms, pan, method, geom, scale, maxPixels);

Print geeSharp.methods for a full list of supported algorithms, and see the documentation for descriptions.

Image quality assessment

Image quality metrics measure the distortion between a reference image and an image that has been modified, such as a pan-sharpened image.

// Choose a metric
var metric = "RMSE";
// Reproject the unsharpened image to the sharpened resolution
var reproj = unsharpened.resample("bicubic").reproject(sharpened.projection());
// Calculate the metric
var quality = geeSharp.quality(reproj, sharpened, metric);

Warning
Metrics are affected by spatial resolution, so when comparing unsharpened and pan-sharpened images, always resample and reproject the unsharpened image to high resolution first to ensure an accurate comparison!

Most quality metrics just require an unmodified and a modified image and return a dictionary mapping band names to metric values, but some metrics require other parameters (e.g. ERGAS requires the high and low spectral resolution) and some return a single image-wise value (e.g. RASE and ERGAS). Print geeSharp.metrics for a full list of supported metrics and see the documentation for descriptions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.