إشعار: يجب
إثبات أهلية جميع المشاريع غير التجارية المسجّلة لاستخدام Earth Engine قبل
15 أبريل 2025 من أجل الحفاظ على إمكانية الوصول إلى Earth Engine.
ee.Algorithms.Image.Segmentation.KMeans
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
تُجري هذه الدالة عملية تصنيفية على الصورة المُدخَلة. تعرض هذه الدالة صورة ذات نطاق واحد تحتوي على رقم تعريف المجموعة العنقودية التي ينتمي إليها كل بكسل. يمكن أن تعمل الخوارزمية إما على شبكة ثابتة من الخلايا غير المتداخلة (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 | إذا كانت القيمة صحيحة، سيتم عرض خطأ إذا لم يتم تحقيق التقارب قبل numIterations. |
uniqueLabels | قيمة منطقية، القيمة التلقائية: true | إذا كانت القيمة true، يتم تخصيص أرقام تعريف فريدة للمجموعات. بخلاف ذلك، تتكرّر هذه العناصر لكل مربّع أو خلية شبكة. |
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\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. |"]]