Skip to content

Instantly share code, notes, and snippets.

@henrique
Last active January 4, 2020 12:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save henrique/3d1abf15e7b9636ae0615215e69c4483 to your computer and use it in GitHub Desktop.
Save henrique/3d1abf15e7b9636ae0615215e69c4483 to your computer and use it in GitHub Desktop.
// GMeans Segmentation
var seg = ee.Algorithms.Image.Segmentation.GMeans(smooth.gt(demand_threshold), 3, 50, 10);
Map.addLayer(seg.randomVisualizer(), {opacity:0.5}, 'GMeans Segmentation');
// SNIC Segmentation
var snic = ee.Algorithms.Image.Segmentation.SNIC(smooth.gt(demand_threshold), 30, 0, 8, 300);
Map.addLayer(snic.randomVisualizer(), {opacity:0.5}, 'SNIC Segmentation');
// Uniquely label the patches and visualize.
var patchid = smooth.gt(demand_threshold)
.connectedComponents(ee.Kernel.plus(1), 256);
Map.addLayer(patchid.randomVisualizer(), {opacity:0.5}, 'Connected Patches');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment