TransWikia.com

Image.glcmTexture: Only 32-bit or smaller integer types are currently supported

Geographic Information Systems Asked by maxi peña on March 16, 2021

I´m using entropy and GLCM function of Google Earth Engine (https://developers.google.com/earth-engine/guides/image_texture). I want to use NDVI band, obtained from landsat 8 image band algebra:

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

Well, when I run the code, console show me:

Image (Error)
Image.glcmTexture: Only 32-bit or smaller integer types are currently supported.

How do I reduce bit of my bands, or transform band to type integer?

One Answer

The quickest way would be to just add a call to cast the iv image into 32-bit or smaller using the toInt() or .toUint() functions. The code below would cast your image to unsigned 32-bit integer prior to the entropy and glcm calculations.

// Get the NIR band.
var iv = il2014.select('NDVI').toUint32();

Answered by rpr_mt on March 16, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP