ee.Algorithms.Image.Segmentation.GMeans
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ทำการจัดกลุ่ม G-Means ในรูปภาพอินพุต ใช้ k-means ซ้ำๆ ตามด้วยการทดสอบความเป็นปกติเพื่อกำหนดจำนวนคลัสเตอร์ที่จะใช้โดยอัตโนมัติ เอาต์พุตมีแถบ "คลัสเตอร์" ที่มีรหัสจำนวนเต็มของคลัสเตอร์ที่แต่ละพิกเซลเป็นของ อัลกอริทึมสามารถทำงานได้ทั้งในตารางกริดแบบคงที่ของเซลล์ที่ไม่ทับซ้อนกัน (gridSize ซึ่งอาจเล็กกว่าไทล์) หรือในไทล์ที่มีการทับซ้อนกัน (neighborhoodSize) ค่าเริ่มต้นคือใช้ไทล์โดยไม่ทับซ้อนกัน คลัสเตอร์ในเซลล์หรือไทล์หนึ่งๆ จะไม่เกี่ยวข้องกับคลัสเตอร์ในเซลล์หรือไทล์อื่น คลัสเตอร์ที่ครอบคลุมขอบเขตของเซลล์หรือไทล์อาจได้รับป้ายกำกับที่แตกต่างกัน 2 ป้ายใน 2 ครึ่ง พิกเซลอินพุตที่มีมาสก์บางส่วนจะถูกมาสก์ทั้งหมดในเอาต์พุต อัลกอริทึมนี้คาดว่าจะทํางานได้ดีกับรูปภาพที่มีช่วงไดนามิกแคบ (เช่น ไบต์หรือช็อต) เท่านั้น
ดูที่ 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 ตัวเลือกนี้ใช้ร่วมกับ neighborhoodSize ไม่ได้ |
uniqueLabels | บูลีน ค่าเริ่มต้น: จริง | หากเป็นจริง ระบบจะกำหนดรหัสที่ไม่ซ้ำกันให้กับคลัสเตอร์ ไม่เช่นนั้น ระบบจะทำซ้ำต่อไทล์หรือตารางกริด |
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-27 UTC
[null,null,["อัปเดตล่าสุด 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. |"]]