Marcos Landi
Marcos Landi

Reputation: 21

Spectral separability analysis Google Earth Engine

I need to carry out a classification using Sentinel 2 images, and for this, I need to perform a spectral separability analysis to select the best bands and vegetation indexes to use. So, I need to calculate the Mean and Standard deviation of the training sites. I tried using this code but the result is not useful

// 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
});

This code calculate the Mean and Standard deviation of each polygon delimited in the class vegetation, instead of a global value for the class. So after run this code I get many Means and SD for vegetation Class. Does anyone know how to get a the Mean and Standard deviation for a ee.FeatureCollection?

Upvotes: 1

Views: 455

Answers (1)

Marcos Landi
Marcos Landi

Reputation: 21

I have found the error in the Script

At the moment to define the vector (Vegetation) it is necessary to use geometry instead of collection. So following is the right Script

// 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
});

Upvotes: 0

Related Questions