공지사항:
2025년 4월 15일 전에 Earth Engine 사용을 위해 등록된 모든 비상업용 프로젝트는 Earth Engine 액세스를 유지하기 위해
비상업용 자격 요건을 인증해야 합니다.
ee.Algorithms.Image.Segmentation.KMeans
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
입력 이미지에 K-평균 클러스터링을 실행합니다. 각 픽셀이 속한 클러스터의 ID를 포함하는 1밴드 이미지를 출력합니다. 이 알고리즘은 겹치지 않는 고정된 셀 그리드 (gridSize, 타일보다 작을 수 있음) 또는 겹치는 타일 (neighborhoodSize)에서 작동할 수 있습니다. 기본값은 겹치지 않는 타일을 사용하는 것입니다. 한 셀 또는 타일의 클러스터는 다른 셀의 클러스터와 관련이 없습니다. 셀 또는 타일 경계에 걸쳐 있는 클러스터는 두 절반에서 서로 다른 라벨을 받을 수 있습니다. 부분 마스크가 있는 입력 픽셀은 출력에서 완전히 마스크됩니다.
사용 | 반환 값 |
---|
ee.Algorithms.Image.Segmentation.KMeans(image, numClusters, numIterations, neighborhoodSize, gridSize, forceConvergence, uniqueLabels) | 이미지 |
인수 | 유형 | 세부정보 |
---|
image | 이미지 | 클러스터링할 입력 이미지입니다. |
numClusters | 정수, 기본값: 8 | 클러스터 수입니다. |
numIterations | 정수, 기본값: 20 | 반복 횟수입니다. |
neighborhoodSize | 정수, 기본값: 0 | 이웃 크기입니다. 클러스터를 계산할 때 각 타일을 확장할 양 (중복)입니다. 이 옵션은 gridSize와 상호 배타적입니다. |
gridSize | 정수, 기본값: null | 그리드 셀 크기입니다. 0보다 큰 경우 kMeans가 이 크기의 셀에서 독립적으로 실행됩니다. 이렇게 하면 클러스터의 크기가 gridSize 이하로 제한됩니다. 이 옵션은 neighborhoodSize와 상호 배타적입니다. |
forceConvergence | 불리언, 기본값: false | true인 경우 numIterations 전에 수렴이 달성되지 않으면 오류가 발생합니다. |
uniqueLabels | 불리언, 기본값: true | true인 경우 클러스터에 고유 ID가 할당됩니다. 그렇지 않으면 타일 또는 그리드 셀마다 반복됩니다. |
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-26(UTC)
[null,null,["최종 업데이트: 2025-07-26(UTC)"],[[["\u003cp\u003ePerforms K-Means clustering on an input image, assigning each pixel to a cluster and outputting a single-band image with cluster IDs.\u003c/p\u003e\n"],["\u003cp\u003eOffers flexibility to control clustering with parameters like \u003ccode\u003enumClusters\u003c/code\u003e, \u003ccode\u003enumIterations\u003c/code\u003e, neighborhood size, and grid size.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eneighborhoodSize\u003c/code\u003e dictates the tile overlap for cluster computation, while \u003ccode\u003egridSize\u003c/code\u003e allows independent clustering within fixed-size cells.\u003c/p\u003e\n"],["\u003cp\u003eSetting \u003ccode\u003euniqueLabels\u003c/code\u003e to true ensures distinct cluster IDs across the entire image, while false results in repeated IDs per tile or grid cell.\u003c/p\u003e\n"],["\u003cp\u003eBy default, uses tiles without overlap for clustering and assigns unique labels to clusters.\u003c/p\u003e\n"]]],["K-Means clustering is applied to an input image, generating a single-band output image where each pixel is assigned a cluster ID. Clustering can occur within a fixed grid (`gridSize`) or within overlapping tiles (`neighborhoodSize`). By default, tiles have no overlap. Clusters are independent per cell/tile, potentially resulting in different labels for clusters crossing boundaries. Parameters include the number of clusters and iterations. Convergence can be enforced and the ID labels be unique or repeat depending on the specified parameter.\n"],null,["# ee.Algorithms.Image.Segmentation.KMeans\n\nPerforms K-Means clustering on the input image. Outputs a 1-band image containing the ID of the cluster that each pixel belongs to. The algorithm can work either on a fixed grid of non-overlapping cells (gridSize, which can be smaller than a tile) or on tiles with overlap (neighborhoodSize). The default is to use tiles with no overlap. Clusters in one cell or tile are unrelated to clusters in another. Any cluster that spans a cell or tile boundary may receive two different labels in the two halves. Any input pixels with partial masks are fully masked in the output.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|\n| `ee.Algorithms.Image.Segmentation.KMeans(image, `*numClusters* `, `*numIterations* `, `*neighborhoodSize* `, `*gridSize* `, `*forceConvergence* `, `*uniqueLabels*`)` | Image |\n\n| Argument | Type | Details |\n|--------------------|-------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `image` | Image | The input image for clustering. |\n| `numClusters` | Integer, default: 8 | Number of clusters. |\n| `numIterations` | Integer, default: 20 | Number of iterations. |\n| `neighborhoodSize` | Integer, default: 0 | Neighborhood size. The amount to extend each tile (overlap) when computing the clusters. This option is mutually exclusive with gridSize. |\n| `gridSize` | Integer, default: null | Grid cell-size. If greater than 0, kMeans will be run independently on cells of this size. This has the effect of limiting the size of any cluster to be gridSize or smaller. This option is mutually exclusive with neighborhoodSize. |\n| `forceConvergence` | Boolean, default: false | If true, an error is thrown if convergence is not achieved before numIterations. |\n| `uniqueLabels` | Boolean, default: true | If true, clusters are assigned unique IDs. Otherwise, they repeat per tile or grid cell. |"]]