GEE学习笔记7:Image.glcmTexture: Only 32-bit or smaller integer types are currently supported

GEE中利用NDVI创建纹理特征时,报错:“Image.glcmTexture: Only 32-bit or smaller integer types are currently supported”

代码如下:

//Agregar bandas
 var addVI = function(image) {
 var ndvi = image.normalizedDifference(['B5', 'B4']).rename('NDVI');
   return image.addBands(ndvi);
 };
 var withVI = filteredCollection.map(addVI);
 print ("conBandas", withVI);


//COMPOSICIONES
//Composicion de imagenes 2014
var cverano2014 = withVI.filterDate('2013-12-01', '2014-03-31');
print ("Coleccion2014", cverano2014);
//Buscar Imagen Limpia 2014
var listImages = cverano2014.toList(cverano2014.size());
var il2014 = ee.Image(listImages.get(0)).clipToCollection(table);
Map.addLayer(il2014, trueColour, "ImagenLimpia2014");


// Get the NIR band.
var iv = il2014.select('NDVI');
// Define a neighborhood with a kernel.
var square = ee.Kernel.square({radius: 3});
// Compute entropy and display.
var entropy = iv.entropy(square);
print('entropy', entropy);
Map.addLayer(entropy,
             {min: 1, max: 5, palette: ['0000CC', 'CC0000']},
             'entropy');

// Compute the gray-level co-occurrence matrix (GLCM), get contrast.
var glcm = iv.glcmTexture({size: 3});
print(glcm)
var contrast = glcm.select('NDVI_contrast');
print('constrast', contrast);
Map.addLayer(contrast,
             {min: 0, max: 1500, palette: ['0000CC', 'CC0000']},
             'contrast');

解决办法:

// Get the NIR band.
var iv = il2014.select('NDVI').toUint32();//或者更小.toUint16()

 

你可能感兴趣的:(GEE,GEE,glcmTexture)