ee.Image.where
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Warunkowo zastępuje wartości.
Dla każdego piksela w każdym paśmie „input” (dane wejściowe): jeśli odpowiedni piksel w „test” ma wartość różną od zera, wygeneruj odpowiedni piksel w „value” (wartość), w przeciwnym razie wygeneruj piksel wejściowy.
Jeśli w danym pikselu test lub wartość są zamaskowane, używana jest wartość wejściowa. Jeśli dane wejściowe są zamaskowane, nic się nie dzieje.
Pasma wyjściowe mają takie same nazwy jak pasma wejściowe. Typ danych wyjściowych każdego pasma jest większy z typów danych wejściowych i wartości. Obraz wyjściowy zachowuje metadane i ślad obrazu wejściowego.
Wykorzystanie | Zwroty |
---|
Image.where(test, value) | Obraz |
Argument | Typ | Szczegóły |
---|
to: input | Obraz | Obraz wejściowy. |
test | Obraz | Obraz testowy. Piksele tego obrazu określają, które piksele wejściowe zostaną zwrócone. Jeśli jest to pojedyncze pasmo, jest ono używane dla wszystkich pasm na obrazie wejściowym. Może to nie być obraz tablicy. |
value | Obraz | Wartość wyjściowa do użycia, gdy test nie jest równy zero. Jeśli jest to pojedyncze pasmo, jest ono używane dla wszystkich pasm na obrazie wejściowym. |
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-26 UTC.
[null,null,["Ostatnia aktualizacja: 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. |"]]