Anuncio: Todos los proyectos no comerciales registrados para usar Earth Engine antes del
15 de abril de 2025 deben
verificar su elegibilidad no comercial para mantener el acceso a Earth Engine.
ee.Algorithms.Image.Segmentation.GMeans
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Realiza el agrupamiento en clústeres de G-means en la imagen de entrada. Aplica de forma iterativa el algoritmo de k-means seguido de una prueba de normalidad para determinar automáticamente la cantidad de clústeres que se deben usar. El resultado contiene una banda de "clústeres" que incluye el ID de número entero del clúster al que pertenece cada píxel. El algoritmo puede funcionar en una cuadrícula fija de celdas que no se superponen (gridSize, que puede ser más pequeña que una segmentación) o en segmentaciones con superposición (neighborhoodSize). La opción predeterminada es usar mosaicos sin superposición. Los clústeres de una celda o un segmento no se relacionan con los de otro. Cualquier clúster que abarque el límite de una celda o un segmento puede recibir dos etiquetas diferentes en las dos mitades. Los píxeles de entrada con máscaras parciales se enmascaran por completo en el resultado. Se espera que este algoritmo solo funcione bien para imágenes con un rango dinámico estrecho (es decir, bytes o Shorts).
Consulta la letra G. Hamerly y C. Elkan. "Learning the k in k-means". NIPS, 2003.
Uso | Muestra |
---|
ee.Algorithms.Image.Segmentation.GMeans(image, numIterations, pValue, neighborhoodSize, gridSize, uniqueLabels) | Imagen |
Argumento | Tipo | Detalles |
---|
image | Imagen | Es la imagen de entrada para la agrupación en clústeres. |
numIterations | Número entero, valor predeterminado: 10 | Cantidad de iteraciones. El valor predeterminado es 10. |
pValue | Número de punto flotante, valor predeterminado: 50 | Es el nivel de significancia de la prueba de normalidad. |
neighborhoodSize | Número entero, valor predeterminado: 0 | Tamaño del vecindario. Cantidad en la que se extiende cada segmento (superposición) cuando se calculan los clústeres. Esta opción es mutuamente excluyente con gridSize. |
gridSize | Número entero, valor predeterminado: nulo | Es el tamaño de la celda de la cuadrícula. Si es mayor que 0, kMeans se ejecutará de forma independiente en celdas de este tamaño. Esto tiene el efecto de limitar el tamaño de cualquier clúster a gridSize o menos. Esta opción es mutuamente excluyente con neighborhoodSize. |
uniqueLabels | Booleano, valor predeterminado: verdadero | Si es verdadero, los clústeres tienen IDs únicos. De lo contrario, se repiten por celda de cuadrícula o tarjeta. |
Salvo que se indique lo contrario, el contenido de esta página está sujeto a la licencia Atribución 4.0 de Creative Commons, y los ejemplos de código están sujetos a la licencia Apache 2.0. Para obtener más información, consulta las políticas del sitio de Google Developers. Java es una marca registrada de Oracle o sus afiliados.
Última actualización: 2025-07-27 (UTC)
[null,null,["Última actualización: 2025-07-27 (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. |"]]