问题:我的主要目标是从 glcm parameters(glcm_bands) 制作 主成分分分析pca。我怀疑是否使用第 16 或 18 行来制作 glcm。
同样不幸的是,主成分对象的方差不返回任何属性?
这里用到的函数:
toDictionary(properties)
Extract properties from a feature as a dictionary.
从一个字典中提取属性
Arguments:
this:element (Element):
The feature to extract the property from.
properties (List, default: null):
The list of properties to extract. Defaults to all non-system properties.
Returns: Dictionary
错误代码:
var dataset = ee.Image("users/ghadiri1979/Turky_L5/DATASET_L5_1990"),
roi = ee.FeatureCollection("users/ghadiri1979/Aras/Tutkiye/Turkiye38"),
geometry =
/* color: #d63000 */
/* shown: false */
ee.Geometry.Polygon(
[[[43.53403894203186, 39.54777593191963],
[43.59995691078186, 39.40361118214464],
[43.70982019203186, 39.293166047554664],
[44.07236902015686, 39.24213251104003],
[44.30308191078186, 39.26765392457906],
[44.46787683265686, 39.378139337522285],
[44.54478112953186, 39.62397745402726],
[44.64365808265686, 39.64089974420364],
[44.79746667640686, 39.539303923934014],
[44.91831628578186, 39.63243911654894],
[44.80845300453186, 39.75923983809085],
[44.64365808265686, 39.953214934801224],
[44.32505456703186, 40.10463891429906],
[43.84165612953186, 40.188618052818406],
[43.69883386390686, 40.339518770828455],
[43.74277917640686, 40.51514395758591],
[43.79771081703186, 40.70696888582695],
[43.73179284828186, 40.96464369880349],
[43.51206628578186, 41.1965208710284],
[43.19346277015686, 41.221316322150514],
[42.89683191078186, 41.05583586157205],
[42.62217370765686, 40.773561483185865],
[42.27061120765686, 40.54019582530807],
[41.83115808265686, 40.34789227251791],
[41.38071862953186, 40.18022481127478],
[41.12803308265686, 39.944792637108],
[41.10606042640686, 39.327167756641884],
[41.29282800453186, 39.24213251104003],
[41.58945886390686, 39.327167756641884],
[42.09482995765686, 39.49692837183376],
[42.19370691078186, 39.59012045643216],
[42.45737878578186, 39.809894886780505],
[43.17149011390686, 39.86894530191177],
[43.44614831703186, 39.65781789468061]]]);
//Map.addLayer(roi)
//Map.addLayer(geometry,{},'geometry')
//Create and rescale a grayscale image for GLCM
var gray = dataset.expression(
'(0.3 * NIR) + (0.59 * R) + (0.11 * G)', {
'NIR': dataset.select('SR_B4'),
'R': dataset.select('SR_B3'),
'G': dataset.select('SR_B2')
}).rename('gray');
// the glcmTexture size (in pixel) can be adjusted considering the spatial resolution and the object textural characteristics
// which one line 16 or 18 is correct ?
var glcm = gray.unitScale(0, 0.30).multiply(100).toInt().glcmTexture({
size: 2});
//var glcm2= gray.unitScale(0, 0.30).multiply(255).toByte().glcmTexture({size: 2});
print('glcm',glcm