ee.Image.reduceNeighborhood
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ใช้ตัวลดที่ระบุกับย่านใกล้เคียงแต่ละพิกเซลตามที่กำหนดโดยเคอร์เนลที่ระบุ หากตัวลดมีอินพุตเดียว ระบบจะใช้ตัวลดแยกกันกับแต่ละแบนด์ของคอลเล็กชัน มิฉะนั้นตัวลดต้องมีอินพุตจำนวนเท่ากับจำนวนแบนด์ของรูปภาพอินพุต
ชื่อเอาต์พุตของตัวลดจะกำหนดชื่อของแถบเอาต์พุต โดยตัวลดที่มีอินพุตหลายรายการจะใช้ชื่อเอาต์พุตโดยตรง ส่วนตัวลดที่มีอินพุตรายการเดียวจะนำหน้าชื่อเอาต์พุตด้วยชื่อแถบอินพุต (เช่น "10_mean", "20_mean")
ตัวลดที่มีอินพุตแบบถ่วงน้ำหนักจะมีน้ำหนักอินพุตตามมาสก์อินพุต ค่าเคอร์เนล หรือค่าที่น้อยกว่าของทั้ง 2 อย่าง
การใช้งาน | การคืนสินค้า |
---|
Image.reduceNeighborhood(reducer, kernel, inputWeight, skipMasked, optimization) | รูปภาพ |
อาร์กิวเมนต์ | ประเภท | รายละเอียด |
---|
ดังนี้ image | รูปภาพ | รูปภาพที่อินพุตเข้ามา |
reducer | ตัวลดตำแหน่ง | ตัวลดที่จะใช้กับพิกเซลภายในบริเวณใกล้เคียง |
kernel | เคอร์เนล | เคอร์เนลที่กำหนดเพื่อนบ้าน |
inputWeight | String, ค่าเริ่มต้น: "kernel" | โดยอาจเป็น "mask", "kernel" หรือ "min" |
skipMasked | บูลีน ค่าเริ่มต้น: จริง | มาสก์พิกเซลเอาต์พุตหากมาสก์พิกเซลอินพุตที่เกี่ยวข้อง |
optimization | สตริง ค่าเริ่มต้น: null | กลยุทธ์การเพิ่มประสิทธิภาพ ตัวเลือกคือ "boxcar" และ "window" วิธี "Boxcar" เป็นวิธีที่รวดเร็วในการคำนวณจำนวน ผลรวม หรือค่าเฉลี่ย โดยต้องใช้เคอร์เนลที่เป็นเนื้อเดียวกัน ตัวลดอินพุตเดียว และ MASK, KERNEL หรือไม่มีการถ่วงน้ำหนัก เมธอด "หน้าต่าง" ใช้หน้าต่างที่ทำงานอยู่และมีข้อกำหนดเดียวกันกับ "Boxcar" แต่สามารถใช้ตัวลดอินพุตเดียวใดก็ได้ ทั้ง 2 วิธีต้องใช้หน่วยความจำเพิ่มเติมจำนวนมาก |
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[[["\u003cp\u003eApplies a given reducer function to the neighborhood of each pixel, defined by a kernel.\u003c/p\u003e\n"],["\u003cp\u003eOutput band names are determined by the reducer's output names, prefixed with the input band name for single-input reducers.\u003c/p\u003e\n"],["\u003cp\u003eInput weight for reducers can be based on the mask, kernel value, or the minimum of the two.\u003c/p\u003e\n"],["\u003cp\u003eOffers optimization strategies like 'boxcar' and 'window' for specific reducer and kernel types to improve performance.\u003c/p\u003e\n"],["\u003cp\u003eAllows skipping computation on masked pixels for efficiency.\u003c/p\u003e\n"]]],["This operation applies a reducer to pixel neighborhoods defined by a kernel. The reducer can have single or multiple inputs, with output band names determined accordingly. Weighted inputs are supported based on the input mask, kernel value, or their minimum. Options are available to skip masked pixels and optimize the process. The `Image.reduceNeighborhood` function takes a reducer, kernel, input weight, skip masked option, and an optimization method, returning a new image.\n"],null,["# ee.Image.reduceNeighborhood\n\nApplies the given reducer to the neighborhood around each pixel, as determined by the given kernel. If the reducer has a single input, it will be applied separately to each band of the collection; otherwise it must have the same number of inputs as the input image has bands.\n\n\u003cbr /\u003e\n\nThe reducer output names determine the names of the output bands: reducers with multiple inputs will use the output names directly, while reducers with a single input will prefix the output name with the input band name (e.g., '10_mean', '20_mean').\n\nReducers with weighted inputs can have the input weight based on the input mask, the kernel value, or the smaller of those two.\n\n| Usage | Returns |\n|--------------------------------------------------------------------------------------------------|---------|\n| Image.reduceNeighborhood`(reducer, kernel, `*inputWeight* `, `*skipMasked* `, `*optimization*`)` | Image |\n\n| Argument | Type | Details |\n|----------------|---------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| this: `image` | Image | The input image. |\n| `reducer` | Reducer | The reducer to apply to pixels within the neighborhood. |\n| `kernel` | Kernel | The kernel defining the neighborhood. |\n| `inputWeight` | String, default: \"kernel\" | One of 'mask', 'kernel', or 'min'. |\n| `skipMasked` | Boolean, default: true | Mask output pixels if the corresponding input pixel is masked. |\n| `optimization` | String, default: null | Optimization strategy. Options are 'boxcar' and 'window'. The 'boxcar' method is a fast method for computing count, sum or mean. It requires a homogeneous kernel, a single-input reducer and either MASK, KERNEL or no weighting. The 'window' method uses a running window, and has the same requirements as 'boxcar', but can use any single input reducer. Both methods require considerable additional memory. |"]]