glcm
can calculate image textures from either a matrix or a Raster*
object
from the raster
package. First install the package if it is not yet
installed:
The below examples use an image included in the glcm
package, a
red/green/blue cutout of a Landsat 5 image from 1986 from a Tropical Ecology
Assessment and Monitoring (TEAM) Network site in Volcan Barva, Costa Rica. The
image is included in the glcm package as L5TSR_1986
:
To calculate GLCM textures from this image using the default settings, type:
where raster(L5TSR_1986, layer=3)
selects the third (red) layer. To see the
textures that have been calculated by default, type:
This shows the eight GLCM texture statistics that have been calculated by default. These can all be visualized in R: