Skip to main content

Has anyone tried to create or get a Landsat-8 pansharp image through a evalscript JS code?

Perhaps this FAQ can help?
https://www.sentinel-hub.com/faq/how-do-i-manually-pansharpen-specific-band-eg-red


Tried script in your link and below script (both seem to produce comparable images), but still not a “pansharp†image…

let minVal = 0.0;

let maxVal = 0.4;


let viz = new Identity(minVal, maxVal);


function evaluatePixel(samples) {

let sudoPanW = (samplesa0].B04 + samplesa0].B03 + samplesa0].B02 * 0.4) / 2.4;

let ratioW = samplesa0].B08 / sudoPanW;

let val = vsamplesa0].B04 * ratioW, samplesa0].B03 * ratioW, samplesa0].B02 * ratioW];

return val.map(v => viz.process(v));

}


function setup(ds) {

setInputComponents(nds.B02, ds.B03, ds.B04, ds.B08]);

setOutputComponentCount(3);

}


Some thing along this lines: https://developers.google.com/earth-engine/image_transforms


I found this script to pansharpen L8 (https://gist.github.com/jscarto/599914ac223f21fc45a2).


How can I edit this to work with L8 data in SH Py? I understand some are GEE functions…


// Band combinations

var natural = =‘B4’, ‘B3’, ‘B2’];

var swir = /‘B6’, ‘B5’, ‘B3’];

var urban = ;‘B7’, ‘B6’, ‘B4’];

var veg = â‘B5’, ‘B4’, ‘B3’];


// Get a Landsat scene

var scene = ee.Image(‘LANDSAT/LC8_L1T_TOA/LC80450332015263LGN00’);


// Convert the RGB bands to the HSV

var hsv = scene.select(urban).rgbToHsv();


// Add band 8 and convert back to RGB

var sharpened = ee.Image.cat(

hsv.select(‘hue’), hsv.select(‘saturation’), scene.select(‘B8’)

]).hsvToRgb();


// Do a very basic color correction

var imageRGB = sharpened.visualize({min: 0, max:0.18,

gamma:a

1.05, // red

1.08, // green

0.8] // blue

});


// Display the image and zoom to it

Map.addLayer(imageRGB);

Map.centerObject(sharpened, 9);




arun:


Tried script in your link and below script (both seem to produce comparable images), but still not a “pansharp†image…

let minVal = 0.0;

let maxVal = 0.4;


let viz = new Identity(minVal, maxVal);


function evaluatePixel(samples) {

let sudoPanW = (samplesa0].B04 + samplesa0].B03 + samplesa0].B02 * 0.4) / 2.4;

let ratioW = samplesa0].B08 / sudoPanW;

let val = vsamplesa0].B04 * ratioW, samplesa0].B03 * ratioW, samplesa0].B02 * ratioW];

return val.map(v => viz.process(v));

}


function setup(ds) {

setInputComponents(nds.B02, ds.B03, ds.B04, ds.B08]);

setOutputComponentCount(3);

}



If you multiply each element in let val = vsamplesa0].B04 * ratioW, samplesa0].B03 * ratioW, samplesa0].B02 * ratioW]; with 2.5, you get the same output as in EO Browser for True color - pansharpened layer for Landsat 8.


Thanks, but what’s the logic of multiplying each band by 2.5? I’m little confused and not sure if you want me to edit my script I posted or just use your script?


See here for examples: http://www.geosage.com/highview/features_landsat8.html


Reply