Following on from a previous question (NDVI reclassify with mean +1SD as threshold in Google Earth Engine) I have managed to show the pixels that have value higher than NDVI mean+1SD at the estuary area on the map, which also overlap with the vegetation area. But I do notice the coloured regions are not universally black, which means I failed to do NDVI reclassify. I meant to use NDVI mean +1SD as a minimum threshold for reclassification, above the threshold to value 1 reclassify as 1 and below the threshold to value -1 reclassify as 0. The purpose of doing ndvi reclassify is :1. test if the pixels above the threshold overlap with the estuary vegetation area (which I have achieved); 2. count total number of pixels above and below the threshold. The code I have used:
var mean = ee.Number(stats.get('nd_mean'))
var std = ee.Number(stats.get('nd_stdDev'))
var maskImage = ndvi.updateMask(ndvi.gt(mean.add(std)));
Map.addLayer(maskImage, {}, 'mask image');
//count number of pixels above the mean+1SD
var count1 = maskImage.reduceRegion({
reducer: ee.Reducer.count(),
geometry: table
});
print(count1);
//count number of pixels below mean+1SD
var unmaskImage = ndvi.updateMask(ndvi.lte(mean.add(std)));
var count2 = unmaskImage.reduceRegion({
reducer: ee.Reducer.count(),
geometry:table
});
print(count2);
//count total number of pixels
var count3 = ndvi.reduceRegion({
reducer: ee.Reducer.count(),
geometry:table
});
print(count3);
I have got number of pixels above the mean+1SD:4274; number of pixels below mean+1SD: 52773;total number of pixels: 57047. I have got the number of pixels in ArcGIS for the satellite image in the same day with the same shapefile for the estuary but the total number of pixel is 57060. Why the total number of pixels calculated by GEE and ArcGIS is different?