I wish to extract summary statistics on the texture of a set of RGB satellite images within Google Earth Engine (GEE) using a gray-level co-occurrence matrix (GLCM). GEE has a built in image.glcm() function to do this, however the example code from this page (https://developers.google.com/earth-engine/image_texture) suggests it requires a single band as input:
// Load a high-resolution NAIP image.
var image = ee.Image('USDA/NAIP/DOQQ/m_3712213_sw_10_1_20140613');
// Get the NIR band.
var nir = image.select('N');
// Compute the gray-level co-occurrence matrix (GLCM), get contrast.
var glcm = nir.glcmTexture({size: 4});
var contrast = glcm.select('N_contrast');
Map.addLayer(contrast,
{min: 0, max: 1500, palette: ['0000CC', 'CC0000']},
'contrast');
Is there a way to convert an RGB image into a single band grayscale image within GEE?
I am using the Python API, so answers in Python would be ideal, but any advice would be much appreciated!