forked from sentinel-hub/custom-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
39 lines (33 loc) · 818 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//VERSION=3
// This script visualise the confidence of classifier
// Set up input and output settings
function setup() {
return {
input: [{
bands: [
"OCS_Confidence"
]
}],
output: {
bands: 4
}
}
}
// Create color map
const ramps = [
[1, 0x000000],
[100, 0x00c800 ],
];
// Create visualiser
const visualizer = new ColorRampVisualizer(ramps);
//EvaluatePixel function
function evaluatePixel(samples) {
let val = samples.OCS_Confidence;
let rgb_triplet = visualizer.process(val);
if (val == 0 || val > 100) {
rgb_triplet.push(0) // Masked data out of range
} else {
rgb_triplet.push(1) // Display visualiser for data within a valid range of confidence
}
return rgb_triplet;
}