ee.Algorithms.Image.Segmentation.GMeans
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
خوشه بندی G-Means را روی تصویر ورودی انجام می دهد. به طور مکرر k-means را به دنبال یک تست نرمال اعمال می کند تا به طور خودکار تعداد خوشه های مورد استفاده را تعیین کند. خروجی شامل یک باند «خوشهها» است که شامل شناسه عدد صحیح خوشهای است که هر پیکسل به آن تعلق دارد. این الگوریتم میتواند روی یک شبکه ثابت از سلولهای غیر همپوشانی (gridSize، که میتواند کوچکتر از یک کاشی باشد) یا روی کاشیهای دارای همپوشانی (neighborhoodSize) کار کند. پیش فرض استفاده از کاشی ها بدون همپوشانی است. خوشه ها در یک سلول یا کاشی با خوشه های دیگر ارتباطی ندارند. هر خوشه ای که از یک سلول یا مرز کاشی می گذرد ممکن است دو برچسب مختلف در دو نیمه دریافت کند. هر پیکسل ورودی با ماسک جزئی به طور کامل در خروجی پوشانده می شود. انتظار می رود این الگوریتم فقط برای تصاویری با محدوده دینامیکی باریک (یعنی بایت یا کوتاه) عملکرد خوبی داشته باشد.
نگاه کنید به: G. Hamerly و C. Elkan. "یادگیری k در k-means". 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 یا کوچکتر محدود شود. این گزینه به صورت متقابلا انحصاری با محله سایز است. |
uniqueLabels | بولی، پیش فرض: درست است | اگر درست باشد، به خوشهها شناسههای منحصربهفرد اختصاص داده میشود. در غیر این صورت، آنها در هر کاشی یا سلول شبکه تکرار می شوند. |
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی."],[[["\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. |"]]