glcm R包相关度量值超出-1到+1的范围

时间:2018-04-02 18:05:07

标签: r raster glcm

我一直在使用R中的glcm包来计算栅格数据集的各种纹理度量;但是,我一直在得到相关度量的奇数值,它应该被限制在-1到+1之间。虽然大多数值都在这个范围内,但是一些像素被分配了-Inf或Inf,而一些像素被分配了大于1的实数。我已经搜索但是没有找到关于这个问题的任何内容,并且想知道是否有人知道会导致什么这和如何解释它。下面是一个使用R的火山数据集的可重复的小例子:

library(raster)
library(glcm)

rast<- raster(volcano)
textures<- glcm(rast)

hist(textures$glcm_correlation) #Most values in valid range (-1 to +1)
cellStats(textures$glcm_correlation, max) #Maximum Value is Inf
#[1] Inf
cellStats(textures$glcm_correlation, min) #Minimum Value is -Inf
#[1] -Inf

head(sort(unique(textures$glcm_correlation@data@values), decreasing = TRUE)) #There are real number values >1
#[1]      Inf 5.839971 1.000000 1.000000 1.000000 1.000000
head(sort(unique(textures$glcm_correlation@data@values), decreasing = FALSE)) #-Inf is <0 but there are no real number values <0
#[1]       -Inf -0.5735393 -0.5000000 -0.5000000 -0.4588315 -0.4335550

0 个答案:

没有答案