ee.Algorithms.Image.Segmentation.SNIC

एसएनआईसी (सिंपल नॉन-इटरेटिव क्लस्टरिंग) पर आधारित सुपरपिक्सल क्लस्टरिंग. यह फ़ंक्शन, क्लस्टर आईडी का बैंड और इनपुट बैंड में मौजूद हर क्लस्टर के लिए औसत वैल्यू दिखाता है. अगर इनपुट के तौर पर 'seeds' इमेज नहीं दी जाती है, तो आउटपुट में 'seeds' बैंड शामिल होगा. इसमें जनरेट की गई सीड की जगहें शामिल होंगी. देखें: अचांता, राधाकृष्ण और ससट्रंक, सबीन, 'सुपरपिक्सल और पॉलीगॉन का इस्तेमाल करके, सामान्य नॉन-इटरेटिव क्लस्टरिंग', सीवीपीआर, 2017.

इस्तेमालरिटर्न
ee.Algorithms.Image.Segmentation.SNIC(image, size, compactness, connectivity, neighborhoodSize, seeds)इमेज
आर्ग्यूमेंटटाइपविवरण
imageइमेजक्लस्टरिंग के लिए इनपुट इमेज.
sizeपूर्णांक, डिफ़ॉल्ट: 5सुपरपिक्सेल सीड की जगह की दूरी, पिक्सल में. अगर 'सीड' इमेज दी जाती है, तो कोई ग्रिड नहीं बनाई जाती.
compactnessफ़्लोट, डिफ़ॉल्ट: 1कॉम्पैक्टनेस फ़ैक्टर. ज़्यादा बड़ी वैल्यू की वजह से क्लस्टर ज़्यादा कॉम्पैक्ट (स्क्वेयर) हो जाते हैं. इसे 0 पर सेट करने से, दूरी के हिसाब से वज़न तय करने की सुविधा बंद हो जाती है.
connectivityपूर्णांक, डिफ़ॉल्ट: 8कनेक्टिविटी पर टैप करें. यह वैल्यू 4 या 8 होनी चाहिए.
neighborhoodSizeपूर्णांक, डिफ़ॉल्ट: nullटाइल के आस-पास के पिक्सल का साइज़. इससे टाइल की सीमा पर दिखने वाली गड़बड़ियों से बचा जा सकता है. डिफ़ॉल्ट रूप से, यह वैल्यू 2 * साइज़ पर सेट होती है.
seedsइमेज, डिफ़ॉल्ट: nullअगर यह जानकारी दी जाती है, तो शून्य से ज़्यादा वैल्यू वाले पिक्सल का इस्तेमाल, सीड लोकेशन के तौर पर किया जाता है. 'कनेक्टिविटी' के हिसाब से, एक-दूसरे से जुड़े पिक्सल को एक ही क्लस्टर का हिस्सा माना जाता है.

उदाहरण

कोड एडिटर (JavaScript)

// Note that the compactness and size parameters can have a significant impact
// on the result. They must be adjusted to meet image-specific characteristics
// and patterns, typically through trial. Pixel scale (map zoom level) is also
// important to consider. When exploring interactively through map tile
// visualization, the segmentation result it dependent on zoom level. If you
// need to evaluate the result at a specific scale, call .reproject() on the
// result, but do so with caution because it overrides the default scaling
// behavior that makes tile computation fast and efficient.


// Load a NAIP image for a neighborhood in Las Vegas.
var naip = ee.Image('USDA/NAIP/DOQQ/m_3611554_sw_11_1_20170613');

// Apply the SNIC algorithm to the image.
var snic = ee.Algorithms.Image.Segmentation.SNIC({
  image: naip,
  size: 30,
  compactness: 0.1,
  connectivity: 8,
});

// Display the original NAIP image as RGB.
// Lock map zoom to maintain the desired scale of the segmentation computation.
Map.setLocked(false, 18, 18);
Map.setCenter(-115.32053, 36.182016, 18);
Map.addLayer(naip, null, 'NAIP RGB');

// Display the clusters.
Map.addLayer(snic.randomVisualizer(), null, 'Clusters');

// Display the RGB cluster means.
var visParams = {
  bands: ['R_mean', 'G_mean', 'B_mean'],
  min: 0,
  max: 255
};
Map.addLayer(snic, visParams, 'RGB cluster means');

Python सेटअप करना

Python API और इंटरैक्टिव डेवलपमेंट के लिए geemap का इस्तेमाल करने के बारे में जानकारी पाने के लिए, Python एनवायरमेंट पेज देखें.

import ee
import geemap.core as geemap

Colab (Python)

# Note that the compactness and size parameters can have a significant impact
# on the result. They must be adjusted to meet image-specific characteristics
# and patterns, typically through trial. Pixel scale (map zoom level) is also
# important to consider. When exploring interactively through map tile
# visualization, the segmentation result it dependent on zoom level. If you
# need to evaluate the result at a specific scale, call .reproject() on the
# result, but do so with caution because it overrides the default scaling
# behavior that makes tile computation fast and efficient.


# Load a NAIP image for a neighborhood in Las Vegas.
naip = ee.Image('USDA/NAIP/DOQQ/m_3611554_sw_11_1_20170613')

# Apply the SNIC algorithm to the image.
snic = ee.Algorithms.Image.Segmentation.SNIC(
    image=naip, size=30, compactness=0.1, connectivity=8
)

# Display the original NAIP image as RGB.
m = geemap.Map()
m.set_center(-115.32053, 36.182016, 18)
m.add_layer(naip, None, 'NAIP RGB')

# Display the clusters.
m.add_layer(snic.randomVisualizer(), None, 'Clusters')

# Display the RGB cluster means.
vis_params = {'bands': ['R_mean', 'G_mean', 'B_mean'], 'min': 0, 'max': 255}
m.add_layer(snic, vis_params, 'RGB cluster means')
m