Объявление : Все некоммерческие проекты, зарегистрированные для использования Earth Engine до
15 апреля 2025 года, должны
подтвердить некоммерческое право на сохранение доступа к Earth Engine.
ee.Algorithms.Image.Segmentation.GMeans
Оптимизируйте свои подборки
Сохраняйте и классифицируйте контент в соответствии со своими настройками.
Выполняет кластеризацию G-средних на входном изображении. Итеративно применяет k-средние, а затем проверяется на нормальность для автоматического определения количества используемых кластеров. Выходные данные содержат полосу «кластеров», содержащую целочисленный идентификатор кластера, к которому принадлежит каждый пиксель. Алгоритм может работать как с фиксированной сеткой неперекрывающихся ячеек (gridSize, который может быть меньше тайла), так и с тайлами с перекрытием (neighborhoodSize). По умолчанию используются тайлы без перекрытия. Кластеры в одной ячейке или тайле не связаны с кластерами в другом. Любой кластер, охватывающий границу ячейки или тайла, может получить две разные метки в двух половинах. Любые входные пиксели с частичными масками полностью маскируются на выходе. Ожидается, что этот алгоритм будет хорошо работать только для изображений с узким динамическим диапазоном (например, байтами или короткими).
См.: Г. Хамерли и К. Элкан. «Изучение k в методе k-средних». NIPS, 2003.
Использование | Возврат | ee.Algorithms.Image.Segmentation.GMeans(image, numIterations , pValue , neighborhoodSize , gridSize , uniqueLabels ) | Изображение |
Аргумент | Тип | Подробности | image | Изображение | Входное изображение для кластеризации. |
numIterations | Целое число, по умолчанию: 10 | Количество итераций. По умолчанию 10. |
pValue | Плавающий, по умолчанию: 50 | Уровень значимости для теста на нормальность. |
neighborhoodSize | Целое число, по умолчанию: 0 | Размер соседства. Величина расширения каждой плитки (перекрытия) при вычислении кластеров. Этот параметр взаимоисключающий с параметром gridSize. |
gridSize | Целое число, по умолчанию: null | Размер ячейки сетки. Если значение больше 0, kMeans будет применяться независимо к ячейкам этого размера. Это ограничивает размер любого кластера значением gridSize или меньше. Этот параметр взаимоисключающий с neighborhoodSize. |
uniqueLabels | Логическое значение, по умолчанию: true | Если значение равно true, кластерам присваиваются уникальные идентификаторы. В противном случае они повторяются для каждой плитки или ячейки сетки. |
Если не указано иное, контент на этой странице предоставляется по лицензии Creative Commons "С указанием авторства 4.0", а примеры кода – по лицензии Apache 2.0. Подробнее об этом написано в правилах сайта. Java – это зарегистрированный товарный знак корпорации Oracle и ее аффилированных лиц.
Последнее обновление: 2025-07-24 UTC.
[null,null,["Последнее обновление: 2025-07-24 UTC."],[[["\u003cp\u003eThe GMeans algorithm automatically determines the optimal number of clusters for image segmentation using iterative k-means and a normality test.\u003c/p\u003e\n"],["\u003cp\u003eIt outputs an image with a 'clusters' band, assigning each pixel an integer ID corresponding to its cluster.\u003c/p\u003e\n"],["\u003cp\u003eUsers can control segmentation granularity through \u003ccode\u003egridSize\u003c/code\u003e for non-overlapping cells or \u003ccode\u003eneighborhoodSize\u003c/code\u003e for overlapping tiles.\u003c/p\u003e\n"],["\u003cp\u003eClusters are independent within each cell or tile, potentially leading to different labels for the same cluster across boundaries.\u003c/p\u003e\n"],["\u003cp\u003eThe algorithm is best suited for images with a narrow dynamic range, like those with byte or short data types.\u003c/p\u003e\n"]]],["The G-Means algorithm performs image clustering by iteratively applying k-means and a normality test to determine the optimal number of clusters. It outputs an image with a 'clusters' band, assigning each pixel to a cluster. It can operate on a fixed grid (gridSize) or tiles with overlap (neighborhoodSize), with default being tiles without overlap. Input images should have a narrow dynamic range and pixels with partial mask will be fully masked in the output. Clusters can be assigned unique ID's or repeat per tile.\n"],null,["# ee.Algorithms.Image.Segmentation.GMeans\n\nPerforms G-Means clustering on the input image. Iteratively applies k-means followed by a normality test to automatically determine the number of clusters to use. The output contains a 'clusters' band containing the integer 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. This algorithm is only expected to perform well for images with a narrow dynamic range (i.e., bytes or shorts).\n\n\u003cbr /\u003e\n\nSee: G. Hamerly and C. Elkan. 'Learning the k in k-means'. NIPS, 2003.\n\n| Usage | Returns |\n|-------------------------------------------------------------------------------------------------------------------------------------------|---------|\n| `ee.Algorithms.Image.Segmentation.GMeans(image, `*numIterations* `, `*pValue* `, `*neighborhoodSize* `, `*gridSize* `, `*uniqueLabels*`)` | Image |\n\n| Argument | Type | Details |\n|--------------------|------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `image` | Image | The input image for clustering. |\n| `numIterations` | Integer, default: 10 | Number of iterations. Default 10. |\n| `pValue` | Float, default: 50 | Significance level for normality test. |\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| `uniqueLabels` | Boolean, default: true | If true, clusters are assigned unique IDs. Otherwise, they repeat per tile or grid cell. |"]]