אנחנו משיקים ב-Earth Engine
רמות מכסה לשימוש לא מסחרי כדי להגן על משאבי מחשוב משותפים ולהבטיח ביצועים אמינים לכולם. כל הפרויקטים הלא מסחריים יצטרכו לבחור רמת מכסת שימוש עד
27 באפריל 2026, אחרת הם ישתמשו ברמת הקהילה כברירת מחדל. המיכסות לפי רמה ייכנסו לתוקף בכל הפרויקטים (ללא קשר לתאריך הבחירה של הרמה) ב-
27 באפריל 2026.
מידע נוסף
ee.Algorithms.Image.Segmentation.SNIC
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
אשכולות של סופר-פיקסלים שמבוססים על SNIC (Simple Non-Iterative Clustering). הפונקציה מחזירה טווח של מזהי אשכולות ואת הממוצעים לכל אשכול עבור כל אחד מטווחי הקלט. אם לא מספקים את תמונת הזרעים כקלט, הפלט יכלול פס של זרעים שמכיל את מיקומי הזרעים שנוצרו.
ראו: 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 | מספר ממשי (float), ברירת מחדל: 1 | גורם הדחיסות. ערכים גדולים יותר גורמים לכך שהאשכולות יהיו קומפקטיים יותר (מרובעים). אם מגדירים את הערך הזה כ-0, השקלול של המרחק המרחבי מושבת. |
connectivity | מספר שלם, ברירת מחדל: 8 | קישוריות. 4 או 8. |
neighborhoodSize | מספר שלם, ברירת מחדל: null | גודל השכונה של המשבצת (כדי למנוע ארטיפקטים בגבולות המשבצת). ברירת המחדל היא 2 * גודל. |
seeds | תמונה, ברירת מחדל: null | אם מספקים ערך, כל הפיקסלים עם ערך שונה מאפס משמשים כמיקומי התחלה. פיקסלים שמשיקים (כפי שמצוין ב 'קישוריות') נחשבים כשייכים לאותו אשכול. |
דוגמאות
Code Editor (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 API ועל השימוש ב-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 ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2026-04-20 (שעון UTC).
[null,null,["עדכון אחרון: 2026-04-20 (שעון 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"]]