Landsat 8 Pansharpened True Color
//VERSION=3
let minVal = 0.0;
let maxVal = 0.4;
let viz = new DefaultVisualizer(minVal, maxVal);
function evaluatePixel(samples) {
let sudoPanW = (samples.B04 + samples.B03 + samples.B02 * 0.4) / 2.4;
let ratioW = samples.B08 / sudoPanW;
let val = [samples.B04 * ratioW, samples.B03 * ratioW, samples.B02 * ratioW];
val = viz.processList(val);
val.push(samples.dataMask);
return val;
}
function setup() {
return {
input: [{
bands: [
"B02",
"B03",
"B04",
"B08",
"dataMask"
]
}],
output: {
bands: 4
}
}
}
Evaluate and visualize
Description
The true color product maps Landsat 8 band values B04, B03, and B02, which roughly correspond to red, green, and blue part of the electromagnetic spectrum, respectively, to R, G, and B components. The RGB bands with spectral resolution of 30 meters were pansharpened using the PAN band with spectral resolution of 15 meters. The result is a true color image with the resolution of 15 meters. The script can only be used with Landsat 8 Level 1, as Level 2 collection does not have a panchromatic band.
Description of representative images
Pansharpened true color image of Rome. Acquired on 2020-07-30, processed by Sentinel Hub.