إشعار: يجب
إثبات الأهلية للاستخدام غير التجاري لجميع المشاريع غير التجارية المسجّلة لاستخدام Earth Engine قبل
15 أبريل 2025 من أجل الحفاظ على إمكانية الوصول إليها. إذا لم يتم تأكيد حسابك بحلول 26 سبتمبر 2025، قد يتم تعليق إمكانية الوصول إليه.
ee.Algorithms.Image.Segmentation.SNIC
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
التجميع العنقودي للوحدات الفائقة استنادًا إلى SNIC (التجميع العنقودي البسيط غير التكراري): تعرض هذه الدالة نطاقًا من معرّفات المجموعات ومتوسطات كل مجموعة لكل نطاق من النطاقات المُدخَلة. في حال عدم توفير صورة "البذور" كمدخل، سيتضمّن الناتج نطاق "البذور" الذي يحتوي على مواقع البذور التي تم إنشاؤها. يمكنك الاطّلاع على: Achanta, Radhakrishna and Susstrunk, Sabine, 'Superpixels and Polygons using Simple Non-Iterative Clustering', CVPR, 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 للحصول على معلومات حول واجهة برمجة التطبيقات Python واستخدام
geemap للتطوير التفاعلي.
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
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)"],[],["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"]]