dwww Home | Manual pages | Find package

r.texture(1grass)           GRASS GIS User's Manual          r.texture(1grass)

NAME
       r.texture  - Generate images with textural features from a raster map.

KEYWORDS
       raster, algebra, statistics, texture

SYNOPSIS
       r.texture
       r.texture --help
       r.texture   [-san]  input=name  output=basename   [size=value]    [dis-
       tance=value]   [method=string[,string,...]]    [--overwrite]   [--help]
       [--verbose]  [--quiet]  [--ui]

   Flags:
       -s
           Separate output for each angle (0, 45, 90, 135)
           Angles  are  counterclockwise  from  east: 0 is East to West, 45 is
           North-East to South-West

       -a
           Calculate all textural measurements

       -n
           Allow NULL cells in a moving window
           This will also avoid cropping along edges of the current region

       --overwrite
           Allow output files to overwrite existing files

       --help
           Print usage summary

       --verbose
           Verbose module output

       --quiet
           Quiet module output

       --ui
           Force launching GUI dialog

   Parameters:
       input=name [required]
           Name of input raster map

       output=basename [required]
           Name for output basename raster map(s)

       size=value
           The size of moving window (odd and >= 3)
           Default: 3

       distance=value
           The distance between two samples (>= 1)
           The distance must be smaller than the size of the moving window
           Default: 1

       method=string[,string,...]
           Textural measurement method
           Options: asm, contrast, corr, var, idm, sa, sv, se, entr,  dv,  de,
           moc1, moc2

DESCRIPTION
       r.texture creates raster maps with textural features from a user-speci-
       fied raster map layer. The module calculates textural features based on
       spatial dependence matrices at 0, 45, 90, and 135 degrees.

       In  order to take into account the scale of the texture to be measured,
       r.texture allows the user to define the size of the moving  window  and
       the  distance  at  which  to compare pixel grey values.  By default the
       module averages the results over the 4 orientations, but the  user  can
       also  request  output  of the texture variables in 4 different orienta-
       tions (flag -s). Please note that angles are defined in degrees of east
       and  they  increase  counterclockwise,  so  0  is  East  -  West, 45 is
       North-East - South-West, 90 is North  -  South,  135  is  North-West  -
       South-East.

       The  user  can  either chose one or several texture measures (see below
       for their description) using the method parameter, or can  request  the
       creating of maps for all available methods with the -a.

       r.texture  assumes grey levels ranging from 0 to 255 as input.  The in-
       put is automatically rescaled to 0 to 255 if the  input  map  range  is
       outside  of  this  range.   In  order to reduce noise in the input data
       (thus generally reinforcing the textural features),  and  to  speed  up
       processing,  it  is  recommended  that  the  user recode the data using
       equal-probability quantization.  Quantization rules for r.recode can be
       generated  with r.quantile -r using e.g 16 or 32 quantiles (see example
       below).

NOTES
       Texture is a feature of specific land cover classes  in  satellite  im-
       agery.   It is particularly useful in situations where spectral differ-
       ences between classes are small, but  classes  are  distinguishable  by
       their  organisation on the ground, often opposing natural to human-made
       spaces: cultivated fields vs meadows or golf courses, palm tree planta-
       tions  vs  natural  rain forest, but texture can also be a natural phe-
       nomen: dune fields, different canopies due to different  tree  species.
       The usefulness and use of texture is highly dependent on the resolution
       of satellite imagery and on the scale of the human intervention or  the
       phenomenon  that  created the texture (also see the discussion of scale
       dependency below). The user should observe the phenomenon  visually  in
       order to determine an adequat setting of the size parameter.

       The output of r.texture can constitute very useful additional variables
       as input for image classification or image segmentation (object  recog-
       nition).   It  can be used in supervised classification algorithms such
       as i.maxlik or i.smap, or for the identification of objects  in  i.seg-
       ment,  and/or  for  the characterization of these objects and thus, for
       example, as one of the raster inputs of the i.segment.stats addon.

       In general, several variables constitute texture: differences  in  grey
       level  values,  coarseness as scale of grey level differences, presence
       or lack of directionality and regular patterns. A texture can be  char-
       acterized by tone (grey level intensity properties) and structure (spa-
       tial relationships). Since textures are highly scale dependent, hierar-
       chical textures may occur.

       r.texture  uses  the  common  texture model based on the so-called grey
       level co-occurrence matrix as described by Haralick et al (1973).  This
       matrix is a two-dimensional histogram of grey levels for a pair of pix-
       els which are separated by a fixed spatial relationship. The matrix ap-
       proximates the joint probability distribution of a pair of pixels. Sev-
       eral texture measures are directly computed from the grey level  co-oc-
       currence matrix.

       The following part offers brief explanations of the Haralick et al tex-
       ture measures (after Jensen 1996).

   First-order statistics in the spatial domain
           •   Sum Average (SA)

           •   Entropy (ENT): This measure analyses the randomness. It is high
               when the values of the moving window have similar values. It is
               low when the values are close to either 0 or 1 (i.e.  when  the
               pixels in the local window are uniform).

           •   Difference Entropy (DE)

           •   Sum Entropy (SE)

           •   Variance (VAR): A measure of gray tone variance within the mov-
               ing window (second-order moment about the mean)

           •   Difference Variance (DV)

           •   Sum Variance (SV)
       Note that measures "mean", "kurtosis", "range", "skewness", and  "stan-
       dard deviation" are available in r.neighbors.

   Second-order statistics in the spatial domain
       The  second-order  statistics  texture  model is based on the so-called
       grey level co-occurrence matrices (GLCM; after Haralick 1979).

           •   Angular Second Moment (ASM, also called Uniformity): This is  a
               measure of local homogeneity and the opposite of Entropy.  High
               values of ASM occur when the pixels in the  moving  window  are
               very similar.
               Note: The square root of the ASM is sometimes used as a texture
               measure, and is called Energy.

           •   Inverse Difference Moment (IDM, also called Homogeneity):  This
               measure  relates inversely to the contrast measure. It is a di-
               rect measure of the local homogeneity of a digital  image.  Low
               values are associated with low homogeneity and vice versa.

           •   Contrast  (CON):  This measure analyses the image contrast (lo-
               cally gray-level variations) as the linear dependency  of  grey
               levels of neighboring pixels (similarity). Typically high, when
               the scale of local texture is larger than the distance.

           •   Correlation (COR): This measure  analyses the linear dependency
               of  grey levels of neighboring pixels. Typically high, when the
               scale of local texture is larger than the distance.

           •   Information Measures of Correlation (MOC)

           •   Maximal Correlation Coefficient (MCC)

       The computational region should be set to the input map  with  g.region
       raster=<input   map>,  or  aligned  to  the  input  map  with  g.region
       align=<input map> if only a subregion should be analyzed.

       Note that the output of r.texture will always be smaller than the  cur-
       rent  region  as  only  cells for which there are no null cells and for
       which all cells of the moving window are within the current region will
       contain a value. The output will thus appear cropped at the margins.

       Importantly, the input raster map cannot have more than 255 categories.

EXAMPLE
       Calculation  of Angular Second Moment of B/W orthophoto (North Carolina
       data set):
       g.region raster=ortho_2001_t792_1m -p
       # set grey level color table 0% black 100% white
       r.colors ortho_2001_t792_1m color=grey
       # extract grey levels
       r.mapcalc "ortho_2001_t792_1m.greylevel = ortho_2001_t792_1m"
       # texture analysis
       r.texture ortho_2001_t792_1m.greylevel prefix=ortho_texture method=asm -s
       # display
       g.region n=221461 s=221094 w=638279 e=638694
       d.shade color=ortho_texture_ASM_0 shade=ortho_2001_t792_1m
       This calculates four maps (requested texture at four orientations): or-
       tho_texture_ASM_0,   ortho_texture_ASM_45,   ortho_texture_ASM_90,  or-
       tho_texture_ASM_135.  Reducing the number of gray levels  (equal-proba-
       bility quantizing):
       g.region -p raster=ortho_2001_t792_1m
       # enter as one line or with \
       r.quantile input=ortho_2001_t792_1m quantiles=16 -r | r.recode \
                  input=ortho_2001_t792_1m output=ortho_2001_t792_1m_q16 rules=-
       The  recoded  raster map can then be used as input for r.texture as be-
       fore.

       Second example: analysis of IDM (homogeneity) on a simple  raster  with
       North-South line pattern.
       # import raster
       r.in.ascii in=- output=lines << EOF
       north: 9
       south: 0
       east: 9
       west: 0
       rows: 9
       cols: 9
       0 0 0 1 0 0 0 1 0
       0 0 0 1 0 0 0 1 0
       0 0 0 1 0 0 0 1 0
       0 0 0 1 0 0 0 1 0
       0 0 0 1 0 0 0 1 0
       0 0 0 1 0 0 0 1 0
       0 0 0 1 0 0 0 1 0
       0 0 0 1 0 0 0 1 0
       0 0 0 1 0 0 0 1 0
       EOF
       # adjust region to raster
       g.region raster=lines
       # calculate IDM (homogeneity) in all directions
       r.texture -s lines method=idm output=text_lines

       The following image shows the original map, the result in East-West di-
       rection and the result in North-South direction,  showing  how  texture
       can  depend  on direction, with texture perfectly homogeneous (value=1)
       in the North-South direction, but quite heterogeneous in East-West  di-
       rection,  except for those areas where there are three columns of equal
       values (as size=3).  The overlaid grid highlights that the texture mea-
       sures output maps are cropped at the margins.
       IDM textures according to direction

KNOWN ISSUES
       The  program  can  run  incredibly slow for large raster maps and large
       moving windows (size option).

REFERENCES
       The algorithm was implemented after Haralick et al., 1973 and 1979.

       The original code was taken by permission from pgmtexture, part of PBM-
       PLUS  (Copyright  1991, Jef Poskanser and Texas Agricultural Experiment
       Station, employer for hire of James Darrell McCauley). Manual  page  of
       pgmtexture.   Over  the years, the source code of r.texture was further
       improved.

           •   Haralick, R.M., K. Shanmugam, and I. Dinstein (1973).  Textural
               features  for  image  classification. IEEE Transactions on Sys-
               tems, Man, and Cybernetics, SMC-3(6):610-621.

           •   Bouman, C. A., Shapiro, M. (1994). A  Multiscale  Random  Field
               Model  for  Bayesian  Image  Segmentation, IEEE Trans. on Image
               Processing, vol. 3, no. 2.

           •   Jensen, J.R. (1996).  Introductory  digital  image  processing.
               Prentice Hall.  ISBN 0-13-205840-5

           •   Haralick,  R. (May 1979). Statistical and structural approaches
               to texture, Proceedings of the IEEE, vol. 67, No.5, pp. 786-804

           •   Hall-Beyer, M. (2007). The GLCM Tutorial Home Page  (Grey-Level
               Co-occurrence  Matrix texture measurements). University of Cal-
               gary, Canada

SEE ALSO
         i.maxlik,  i.gensig,  i.smap,  i.gensigset,  i.segment.stats,  i.pca,
       r.neighbors, r.rescale

AUTHORS
       G.  Antoniol  -  RCOST  (Research Centre on Software Technology - Viale
       Traiano - 82100 Benevento)
       C. Basco -  RCOST (Research Centre on Software Technology - Viale  Tra-
       iano - 82100 Benevento)
       M. Ceccarelli - Facolta di Scienze, Universita del Sannio, Benevento
       Markus Metz (correction and optimization of the initial version)
       Moritz Lennert (documentation)

SOURCE CODE
       Available at: r.texture source code (history)

       Accessed: unknown

       Main  index  | Raster index | Topics index | Keywords index | Graphical
       index | Full index

       © 2003-2022 GRASS Development Team, GRASS GIS 7.8.7 Reference Manual

GRASS 7.8.7                                                  r.texture(1grass)

Generated by dwww version 1.14 on Fri Jan 24 09:46:16 CET 2025.