お知らせ :
2025 年 4 月 15 日 より前に Earth Engine の使用を登録したすべての非商用プロジェクトは、アクセスを維持するために
非商用目的での利用資格を確認 する必要があります。2025 年 9 月 26 日までに確認が完了していない場合、アクセスが保留されることがあります。
フィードバックを送信
ee.Algorithms.Image.Segmentation.SNIC
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
SNIC(Simple Non-Iterative Clustering)に基づくスーパーピクセル クラスタリング。クラスタ ID の帯域と、入力帯域ごとのクラスタごとの平均値を出力します。「シード」画像が入力として提供されていない場合、出力には生成されたシード位置を含む「シード」バンドが含まれます。Achanta, Radhakrishna、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 * size です。 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
フィードバックを送信
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンス により使用許諾されます。コードサンプルは Apache 2.0 ライセンス により使用許諾されます。詳しくは、Google Developers サイトのポリシー をご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-26 UTC。
ご意見をお聞かせください
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 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"]]