除了指定要执行归约的区域之外,还可以指定要应用归约器的邻域。要减少图像邻域,请使用 image.reduceNeighborhood()
。在这种情况下,缩小将发生在输入图像上的滑动窗口中,窗口大小和形状由 指定ee.Kernel
。的输出reduceNeighborhood()
将是另一幅图像,每个像素值代表输入图像中该像素周围邻域的减少输出。图 1 说明了这种类型的减少。可以简单的理解为kernel为一个内核,而reduceNeighborhood为一个邻域范围
图 1. 的图示reduceNeighborhood()
,其中在内核中应用了减速器。
案例:
必备函数:
reduceNeighborhood(reducer, kernel, inputWeight, skipMasked, optimization)
将给定的归约器应用于每个像素周围的邻域,由给定的内核确定。如果reducer只有一个输入,它将分别应用于集合的每个band;否则它必须具有与输入图像具有带区相同数量的输入。
Applies the given reducer to the neighborhood around each pixel, as determined by the given kernel. I