ee.Image.where
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Thực hiện việc thay thế có điều kiện các giá trị.
Đối với mỗi pixel trong mỗi dải của "input", nếu pixel tương ứng trong "test" khác 0, hãy xuất pixel tương ứng theo giá trị, nếu không, hãy xuất pixel đầu vào.
Nếu tại một pixel nhất định, cả giá trị hoặc kết quả kiểm thử đều bị che, thì giá trị đầu vào sẽ được sử dụng. Nếu đầu vào bị che, thì sẽ không có gì xảy ra.
Các dải đầu ra có cùng tên với các dải đầu vào. Loại đầu ra của mỗi dải tần là loại lớn hơn trong số các loại đầu vào và giá trị. Hình ảnh đầu ra giữ lại siêu dữ liệu và dấu vết của hình ảnh đầu vào.
Cách sử dụng | Giá trị trả về |
---|
Image.where(test, value) | Hình ảnh |
Đối số | Loại | Thông tin chi tiết |
---|
this: input | Hình ảnh | Hình ảnh đầu vào. |
test | Hình ảnh | Hình ảnh thử nghiệm. Các pixel của hình ảnh này xác định pixel đầu vào nào được trả về. Nếu đây là một dải tần duy nhất, thì dải tần này sẽ được dùng cho tất cả dải tần trong hình ảnh đầu vào. Đây có thể không phải là hình ảnh mảng. |
value | Hình ảnh | Giá trị đầu ra cần sử dụng khi điều kiện kiểm tra không phải là 0. Nếu đây là một dải tần duy nhất, thì dải tần này sẽ được dùng cho tất cả dải tần trong hình ảnh đầu vào. |
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-26 UTC.
[null,null,["Cập nhật lần gần đây nhất: 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. |"]]