ee.Image.where
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
แทนที่ค่าตามเงื่อนไข
สำหรับแต่ละพิกเซลในแต่ละแบนด์ของ "input" หากพิกเซลที่สอดคล้องกันใน "test" ไม่ใช่ 0 ให้แสดงผลพิกเซลที่สอดคล้องกันในค่า มิฉะนั้นให้แสดงผลพิกเซลอินพุต
หากพิกเซลใดพิกเซลหนึ่งมีการมาสก์การทดสอบหรือค่า ระบบจะใช้ค่าอินพุต หากอินพุตถูกมาสก์ ระบบจะไม่ดำเนินการใดๆ
แถบเอาต์พุตมีชื่อเหมือนกับแถบอินพุต ประเภทเอาต์พุตของแต่ละแบนด์คือประเภทอินพุตและค่าที่ใหญ่กว่า รูปภาพเอาต์พุตจะยังคงมีข้อมูลเมตาและร่องรอยของรูปภาพอินพุต
การใช้งาน | การคืนสินค้า |
---|
Image.where(test, value) | รูปภาพ |
อาร์กิวเมนต์ | ประเภท | รายละเอียด |
---|
ดังนี้ input | รูปภาพ | รูปภาพที่อินพุตเข้ามา |
test | รูปภาพ | รูปภาพทดสอบ พิกเซลของรูปภาพนี้จะเป็นตัวกำหนดว่าพิกเซลอินพุตใดที่จะแสดง หากเป็นแถบเดียว ระบบจะใช้แถบนี้กับแถบทั้งหมดในรูปภาพอินพุต ซึ่งอาจไม่ใช่รูปภาพอาร์เรย์ |
value | รูปภาพ | ค่าเอาต์พุตที่จะใช้เมื่อการทดสอบไม่ใช่ 0 หากเป็นแถบเดียว ระบบจะใช้แถบนี้กับแถบทั้งหมดในรูปภาพอินพุต |
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[[["\u003cp\u003eReplaces input image pixel values with values from a secondary image based on a test image's pixel values.\u003c/p\u003e\n"],["\u003cp\u003eIf the test image pixel is non-zero, the corresponding pixel from the value image is used; otherwise, the original input pixel is retained.\u003c/p\u003e\n"],["\u003cp\u003eInput image metadata and footprint are preserved in the output image.\u003c/p\u003e\n"],["\u003cp\u003eOutput image band types are determined by the larger type between the input and value images.\u003c/p\u003e\n"],["\u003cp\u003eMasked pixels in either test or value images result in the original input pixel being used in the output.\u003c/p\u003e\n"]]],[],null,["# ee.Image.where\n\nPerforms conditional replacement of values.\n\n\u003cbr /\u003e\n\nFor each pixel in each band of 'input', if the corresponding pixel in 'test' is nonzero, output the corresponding pixel in value, otherwise output the input pixel.\n\nIf at a given pixel, either test or value is masked, the input value is used. If the input is masked, nothing is done.\n\nThe output bands have the same names as the input bands. The output type of each band is the larger of the input and value types. The output image retains the metadata and footprint of the input image.\n\n| Usage | Returns |\n|----------------------------|---------|\n| Image.where`(test, value)` | Image |\n\n| Argument | Type | Details |\n|---------------|-------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| this: `input` | Image | The input image. |\n| `test` | Image | The test image. The pixels of this image determines which of the input pixels is returned. If this is a single band, it is used for all bands in the input image. This may not be an array image. |\n| `value` | Image | The output value to use where test is not zero. If this is a single band, it is used for all bands in the input image. |"]]