Duyuru:
15 Nisan 2025'ten önce Earth Engine'i kullanmak için kaydedilen tüm ticari olmayan projelerin erişimlerini sürdürebilmeleri için
ticari olmayan uygunluklarını doğrulamaları gerekir. 26 Eylül 2025'e kadar doğrulama yapmazsanız erişiminiz bekletilebilir.
ee.Algorithms.Image.Segmentation.SNIC
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
SNIC (Simple Non-Iterative Clustering) tabanlı süper piksel kümeleme. Küme kimlikleri bandı ve giriş bantlarının her biri için küme başına ortalamaları verir. "Tohumlar" resmi giriş olarak sağlanmazsa çıkış, oluşturulan tohum konumlarını içeren bir "tohumlar" bandı içerir. Bkz: Achanta, Radhakrishna ve Susstrunk, Sabine, "Superpixels and Polygons using Simple Non-Iterative Clustering", CVPR, 2017.
| Kullanım | İadeler |
|---|
ee.Algorithms.Image.Segmentation.SNIC(image, size, compactness, connectivity, neighborhoodSize, seeds) | Resim |
| Bağımsız Değişken | Tür | Ayrıntılar |
|---|
image | Resim | Kümeleme için giriş resmi. |
size | Tamsayı, varsayılan: 5 | Süper piksel başlangıç konumunun piksel cinsinden aralığı. "Başlangıç" resmi sağlandığında ızgara oluşturulmaz. |
compactness | Ondalık sayı, varsayılan: 1 | Kompaktlık faktörü. Daha büyük değerler, kümelerin daha kompakt (kare) olmasına neden olur. Bu değeri 0 olarak ayarlamak, mekansal mesafe ağırlıklandırmasını devre dışı bırakır. |
connectivity | Tamsayı, varsayılan: 8 | Bağlantı'ya dokunun. 4 veya 8 olmalıdır. |
neighborhoodSize | Tam sayı, varsayılan: null | Karo sınırı artefaktlarını önlemek için karo komşuluğu boyutu. Varsayılan olarak 2 * boyut değerine ayarlanır. |
seeds | Resim, varsayılan: null | Sağlanırsa sıfır olmayan tüm piksel değerleri başlangıç konumları olarak kullanılır. Dokunan pikseller (bağlantı olarak belirtildiği şekilde) aynı kümeye ait kabul edilir. |
Örnekler
Kod Düzenleyici (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 kurulumu
Python API'si ve etkileşimli geliştirme için geemap kullanımı hakkında bilgi edinmek üzere
Python Ortamı sayfasına bakın.
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
Aksi belirtilmediği sürece bu sayfanın içeriği Creative Commons Atıf 4.0 Lisansı altında ve kod örnekleri Apache 2.0 Lisansı altında lisanslanmıştır. Ayrıntılı bilgi için Google Developers Site Politikaları'na göz atın. Java, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-07-26 UTC.
[null,null,["Son güncelleme tarihi: 2025-07-26 UTC."],[],["SNIC clustering segments an image into superpixels, outputting cluster IDs and per-cluster averages for each input band. Key parameters include `size` (seed spacing), `compactness` (cluster shape), and `connectivity`. A user can provide `seeds` to define seed locations; otherwise, they are generated. The output `Image` includes cluster IDs, band averages, and optionally generated seed locations. Adjusting `size` and `compactness` is crucial for optimal results, which are also affected by pixel scale.\n"]]