ee.Kernel.fixed

创建内核。

用法返回
ee.Kernel.fixed(width, height, weights, x, y, normalize)内核
参数类型详细信息
width整数,默认值:-1内核的宽度(以像素为单位)。
height整数,默认值:-1内核的高度(以像素为单位)。
weights列表一个 [高度] x [宽度] 值的二维列表,用作内核的权重。
x整数,默认值:-1焦点的位置,以相对于左侧的偏移量表示。
y整数,默认值:-1焦点的位置,以相对于顶部的偏移量表示。
normalize布尔值,默认值:false将内核值归一化为总和为 1。

示例

代码编辑器 (JavaScript)

// Kernel weights.
var weights = [[4, 3, 2, 1, 2, 3, 4],
               [4, 3, 2, 1, 2, 3, 4],
               [4, 3, 2, 1, 2, 3, 4]];

print('A fixed kernel', ee.Kernel.fixed({weights: weights}));

/**
 * Output weights matrix
 *
 * [4, 3, 2, 1, 2, 3, 4]
 * [4, 3, 2, 1, 2, 3, 4]
 * [4, 3, 2, 1, 2, 3, 4]
 */

Python 设置

如需了解 Python API 和如何使用 geemap 进行交互式开发,请参阅 Python 环境页面。

import ee
import geemap.core as geemap

Colab (Python)

from pprint import pprint

weights = [[4, 3, 2, 1, 2, 3, 4],
           [4, 3, 2, 1, 2, 3, 4],
           [4, 3, 2, 1, 2, 3, 4]]

print('A fixed kernel:')
pprint(ee.Kernel.fixed(**{'weights': weights}).getInfo())

#  Output weights matrix

#  [4, 3, 2, 1, 2, 3, 4]
#  [4, 3, 2, 1, 2, 3, 4]
#  [4, 3, 2, 1, 2, 3, 4]