| 用法 | 返回 | 
|---|---|
| Kernel.add(kernel2, normalize) | 内核 | 
| 参数 | 类型 | 详细信息 | 
|---|---|---|
| 此: kernel1 | 内核 | 第一个内核。 | 
| kernel2 | 内核 | 第二个内核。 | 
| normalize | 布尔值,默认值:false | 对内核进行归一化处理。 | 
示例
代码编辑器 (JavaScript)
// Two kernels, they do not need to have the same dimensions. var kernelA = ee.Kernel.chebyshev({radius: 3}); var kernelB = ee.Kernel.square({radius: 1, normalize: false, magnitude: 100}); print(kernelA, kernelB); /** * Two kernel weights matrices * * [3, 3, 3, 3, 3, 3, 3] * [3, 2, 2, 2, 2, 2, 3] * [3, 2, 1, 1, 1, 2, 3] [100, 100, 100] * A [3, 2, 1, 0, 1, 2, 3] B [100, 100, 100] * [3, 2, 1, 1, 1, 2, 3] [100, 100, 100] * [3, 2, 2, 2, 2, 2, 3] * [3, 3, 3, 3, 3, 3, 3] */ print('Pointwise addition of two kernels', kernelA.add(kernelB)); /** * [3, 3, 3, 3, 3, 3, 3] * [3, 2, 2, 2, 2, 2, 3] * [3, 2, 101, 101, 101, 2, 3] * [3, 2, 101, 100, 101, 2, 3] * [3, 2, 101, 101, 101, 2, 3] * [3, 2, 2, 2, 2, 2, 3] * [3, 3, 3, 3, 3, 3, 3] */
import ee import geemap.core as geemap
Colab (Python)
# Two kernels, they do not need to have the same dimensions. kernel_a = ee.Kernel.chebyshev(**{'radius': ee.Number(3)}) kernel_b = ee.Kernel.square(**{ 'radius': 1, 'normalize': False, 'magnitude': 100 }) display('a:', kernel_a) display('b:', kernel_b) # Two kernel weights matrices # [3, 3, 3, 3, 3, 3, 3] # [3, 2, 2, 2, 2, 2, 3] # [3, 2, 1, 1, 1, 2, 3] [100, 100, 100] # A [3, 2, 1, 0, 1, 2, 3] B [100, 100, 100] # [3, 2, 1, 1, 1, 2, 3] [100, 100, 100] # [3, 2, 2, 2, 2, 2, 3] # [3, 3, 3, 3, 3, 3, 3] display('Pointwise addition of two kernels:', kernel_a.add(kernel_b)) # [3, 3, 3, 3, 3, 3, 3] # [3, 2, 2, 2, 2, 2, 3] # [3, 2, 101, 101, 101, 2, 3] # [3, 2, 101, 100, 101, 2, 3] # [3, 2, 101, 101, 101, 2, 3] # [3, 2, 2, 2, 2, 2, 3] # [3, 3, 3, 3, 3, 3, 3]