问题描述
我是使用GEE的新手。
我需要使用Sentinel 2图像进行分类,为此,我需要执行光谱可分离性分析,以选择要使用的最佳波段和植被指数。因此,我需要计算训练地点的均值和标准差。我尝试使用此代码,但结果没有用
// Get the Mean of the bands of the image for the polygons of the vegetation class
var MeanTraining = Image.reduceRegions({
collection: vegetation,// vegetation is a FeatureCollection of polygons
reducer: ee.reducer.mean(),scale:30
});
此代码计算在类植被中定界的每个多边形的均值和标准偏差,而不是该类的全局值。因此,运行此代码后,我得到了很多植被等级的平均值和标准差。有人知道如何获取ee.FeatureCollection
的均值和标准差吗?
预先感谢, 马可斯
解决方法
我在脚本中发现了错误
在定义矢量(植被)时,有必要使用 几何 而不是 collection 。所以下面是正确的脚本
// Get the Mean of the bands of the image for the polygons of the Vegetation class
var MeanTraining = Image.reduceRegions({
geometry: Vegetation,reducer: ee.Reducer.mean(),scale:30
});