1r.texture(1)                GRASS GIS User's Manual               r.texture(1)
2
3
4

NAME

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

KEYWORDS

9       raster, algebra, statistics, texture
10

SYNOPSIS

12       r.texture
13       r.texture --help
14       r.texture   [-san]  input=name  output=basename   [size=value]    [dis‐
15       tance=value]   [method=string[,string,...]]    [--overwrite]   [--help]
16       [--verbose]  [--quiet]  [--ui]
17
18   Flags:
19       -s
20           Separate output for each angle (0, 45, 90, 135)
21           Angles  are  counterclockwise  from  east: 0 is East to West, 45 is
22           North-East to South-West
23
24       -a
25           Calculate all textural measurements
26
27       -n
28           Allow NULL cells in a moving window
29           This will also avoid cropping along edges of the current region
30
31       --overwrite
32           Allow output files to overwrite existing files
33
34       --help
35           Print usage summary
36
37       --verbose
38           Verbose module output
39
40       --quiet
41           Quiet module output
42
43       --ui
44           Force launching GUI dialog
45
46   Parameters:
47       input=name [required]
48           Name of input raster map
49
50       output=basename [required]
51           Name for output basename raster map(s)
52
53       size=value
54           The size of moving window (odd and >= 3)
55           Default: 3
56
57       distance=value
58           The distance between two samples (>= 1)
59           The distance must be smaller than the size of the moving window
60           Default: 1
61
62       method=string[,string,...]
63           Textural measurement method
64           Options: asm, contrast, corr, var, idm, sa, sv, se, entr,  dv,  de,
65           moc1, moc2
66

DESCRIPTION

68       r.texture creates raster maps with textural features from a user-speci‐
69       fied raster map layer. The module calculates textural features based on
70       spatial dependence matrices at 0, 45, 90, and 135 degrees.
71
72       In  order to take into account the scale of the texture to be measured,
73       r.texture allows the user to define the size of the moving  window  and
74       the  distance  at  which  to compare pixel grey values.  By default the
75       module averages the results over the 4 orientations, but the  user  can
76       also  request  output  of the texture variables in 4 different orienta‐
77       tions (flag -s). Please note that angles are defined in degrees of east
78       and  they  increase  counterclockwise,  so  0  is  East  -  West, 45 is
79       North-East - South-West, 90 is North  -  South,  135  is  North-West  -
80       South-East.
81
82       The  user  can  either chose one or several texture measures (see below
83       for their description) using the method parameter, or can  request  the
84       creating of maps for all available methods with the -a.
85
86       r.texture  assumes grey levels ranging from 0 to 255 as input.  The in‐
87       put is automatically rescaled to 0 to 255 if the  input  map  range  is
88       outside  of  this  range.   In  order to reduce noise in the input data
89       (thus generally reinforcing the textural features),  and  to  speed  up
90       processing,  it  is  recommended  that  the  user recode the data using
91       equal-probability quantization.  Quantization rules for r.recode can be
92       generated  with r.quantile -r using e.g 16 or 32 quantiles (see example
93       below).
94

NOTES

96       Texture is a feature of specific land cover classes  in  satellite  im‐
97       agery.   It is particularly useful in situations where spectral differ‐
98       ences between classes are small, but  classes  are  distinguishable  by
99       their  organisation on the ground, often opposing natural to human-made
100       spaces: cultivated fields vs meadows or golf courses, palm tree planta‐
101       tions  vs  natural  rain forest, but texture can also be a natural phe‐
102       nomen: dune fields, different canopies due to different  tree  species.
103       The usefulness and use of texture is highly dependent on the resolution
104       of satellite imagery and on the scale of the human intervention or  the
105       phenomenon  that  created the texture (also see the discussion of scale
106       dependency below). The user should observe the phenomenon  visually  in
107       order to determine an adequat setting of the size parameter.
108
109       The output of r.texture can constitute very useful additional variables
110       as input for image classification or image segmentation (object  recog‐
111       nition).   It  can be used in supervised classification algorithms such
112       as i.maxlik or i.smap, or for the identification of objects  in  i.seg‐
113       ment,  and/or  for  the characterization of these objects and thus, for
114       example, as one of the raster inputs of the i.segment.stats addon.
115
116       In general, several variables constitute texture: differences  in  grey
117       level  values,  coarseness as scale of grey level differences, presence
118       or lack of directionality and regular patterns. A texture can be  char‐
119       acterized by tone (grey level intensity properties) and structure (spa‐
120       tial relationships). Since textures are highly scale dependent, hierar‐
121       chical textures may occur.
122
123       r.texture  uses  the  common  texture model based on the so-called grey
124       level co-occurrence matrix as described by Haralick et al (1973).  This
125       matrix is a two-dimensional histogram of grey levels for a pair of pix‐
126       els which are separated by a fixed spatial relationship. The matrix ap‐
127       proximates the joint probability distribution of a pair of pixels. Sev‐
128       eral texture measures are directly computed from the grey level  co-oc‐
129       currence matrix.
130
131       The following part offers brief explanations of the Haralick et al tex‐
132       ture measures (after Jensen 1996).
133
134   First-order statistics in the spatial domain
135           •   Sum Average (SA)
136
137           •   Entropy (ENT): This measure analyses the randomness. It is high
138               when the values of the moving window have similar values. It is
139               low when the values are close to either 0 or 1 (i.e.  when  the
140               pixels in the local window are uniform).
141
142           •   Difference Entropy (DE)
143
144           •   Sum Entropy (SE)
145
146           •   Variance (VAR): A measure of gray tone variance within the mov‐
147               ing window (second-order moment about the mean)
148
149           •   Difference Variance (DV)
150
151           •   Sum Variance (SV)
152       Note that measures "mean", "kurtosis", "range", "skewness", and  "stan‐
153       dard deviation" are available in r.neighbors.
154
155   Second-order statistics in the spatial domain
156       The  second-order  statistics  texture  model is based on the so-called
157       grey level co-occurrence matrices (GLCM; after Haralick 1979).
158
159           •   Angular Second Moment (ASM, also called Uniformity): This is  a
160               measure of local homogeneity and the opposite of Entropy.  High
161               values of ASM occur when the pixels in the  moving  window  are
162               very similar.
163               Note: The square root of the ASM is sometimes used as a texture
164               measure, and is called Energy.
165
166           •   Inverse Difference Moment (IDM, also called Homogeneity):  This
167               measure  relates inversely to the contrast measure. It is a di‐
168               rect measure of the local homogeneity of a digital  image.  Low
169               values are associated with low homogeneity and vice versa.
170
171           •   Contrast  (CON):  This measure analyses the image contrast (lo‐
172               cally gray-level variations) as the linear dependency  of  grey
173               levels of neighboring pixels (similarity). Typically high, when
174               the scale of local texture is larger than the distance.
175
176           •   Correlation (COR): This measure  analyses the linear dependency
177               of  grey levels of neighboring pixels. Typically high, when the
178               scale of local texture is larger than the distance.
179
180           •   Information Measures of Correlation (MOC)
181
182           •   Maximal Correlation Coefficient (MCC)
183
184       The computational region should be set to the input map  with  g.region
185       raster=<input   map>,  or  aligned  to  the  input  map  with  g.region
186       align=<input map> if only a subregion should be analyzed.
187
188       Note that the output of r.texture will always be smaller than the  cur‐
189       rent  region  as  only  cells for which there are no null cells and for
190       which all cells of the moving window are within the current region will
191       contain a value. The output will thus appear cropped at the margins.
192
193       Importantly, the input raster map cannot have more than 255 categories.
194

EXAMPLE

196       Calculation  of Angular Second Moment of B/W orthophoto (North Carolina
197       data set):
198       g.region raster=ortho_2001_t792_1m -p
199       # set grey level color table 0% black 100% white
200       r.colors ortho_2001_t792_1m color=grey
201       # extract grey levels
202       r.mapcalc "ortho_2001_t792_1m.greylevel = ortho_2001_t792_1m"
203       # texture analysis
204       r.texture ortho_2001_t792_1m.greylevel prefix=ortho_texture method=asm -s
205       # display
206       g.region n=221461 s=221094 w=638279 e=638694
207       d.shade color=ortho_texture_ASM_0 shade=ortho_2001_t792_1m
208       This calculates four maps (requested texture at four orientations): or‐
209       tho_texture_ASM_0,   ortho_texture_ASM_45,   ortho_texture_ASM_90,  or‐
210       tho_texture_ASM_135.  Reducing the number of gray levels  (equal-proba‐
211       bility quantizing):
212       g.region -p raster=ortho_2001_t792_1m
213       # enter as one line or with \
214       r.quantile input=ortho_2001_t792_1m quantiles=16 -r | r.recode \
215                  input=ortho_2001_t792_1m output=ortho_2001_t792_1m_q16 rules=-
216       The  recoded  raster map can then be used as input for r.texture as be‐
217       fore.
218
219       Second example: analysis of IDM (homogeneity) on a simple  raster  with
220       North-South line pattern.
221       # import raster
222       r.in.ascii in=- output=lines << EOF
223       north: 9
224       south: 0
225       east: 9
226       west: 0
227       rows: 9
228       cols: 9
229       0 0 0 1 0 0 0 1 0
230       0 0 0 1 0 0 0 1 0
231       0 0 0 1 0 0 0 1 0
232       0 0 0 1 0 0 0 1 0
233       0 0 0 1 0 0 0 1 0
234       0 0 0 1 0 0 0 1 0
235       0 0 0 1 0 0 0 1 0
236       0 0 0 1 0 0 0 1 0
237       0 0 0 1 0 0 0 1 0
238       EOF
239       # adjust region to raster
240       g.region raster=lines
241       # calculate IDM (homogeneity) in all directions
242       r.texture -s lines method=idm output=text_lines
243
244       The following image shows the original map, the result in East-West di‐
245       rection and the result in North-South direction,  showing  how  texture
246       can  depend  on direction, with texture perfectly homogeneous (value=1)
247       in the North-South direction, but quite heterogeneous in East-West  di‐
248       rection,  except for those areas where there are three columns of equal
249       values (as size=3).  The overlaid grid highlights that the texture mea‐
250       sures output maps are cropped at the margins.
251       IDM textures according to direction
252

KNOWN ISSUES

254       The  program  can  run  incredibly slow for large raster maps and large
255       moving windows (size option).
256

REFERENCES

258       The algorithm was implemented after Haralick et al., 1973 and 1979.
259
260       The original code was taken by permission from pgmtexture, part of PBM‐
261       PLUS  (Copyright  1991, Jef Poskanser and Texas Agricultural Experiment
262       Station, employer for hire of James Darrell McCauley). Manual  page  of
263       pgmtexture.   Over  the years, the source code of r.texture was further
264       improved.
265
266           •   Haralick, R.M., K. Shanmugam, and I. Dinstein (1973).  Textural
267               features  for  image  classification. IEEE Transactions on Sys‐
268               tems, Man, and Cybernetics, SMC-3(6):610-621.
269
270           •   Bouman, C. A., Shapiro, M. (1994). A  Multiscale  Random  Field
271               Model  for  Bayesian  Image  Segmentation, IEEE Trans. on Image
272               Processing, vol. 3, no. 2.
273
274           •   Jensen, J.R. (1996).  Introductory  digital  image  processing.
275               Prentice Hall.  ISBN 0-13-205840-5
276
277           •   Haralick,  R. (May 1979). Statistical and structural approaches
278               to texture, Proceedings of the IEEE, vol. 67, No.5, pp. 786-804
279
280           •   Hall-Beyer, M. (2007). The GLCM Tutorial Home Page  (Grey-Level
281               Co-occurrence  Matrix texture measurements). University of Cal‐
282               gary, Canada
283

SEE ALSO

285         i.maxlik,  i.gensig,  i.smap,  i.gensigset,  i.segment.stats,  i.pca,
286       r.neighbors, r.rescale
287

AUTHORS

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

SOURCE CODE

298       Available at: r.texture source code (history)
299
300       Accessed: Mon Jun 20 16:46:33 2022
301
302       Main  index  | Raster index | Topics index | Keywords index | Graphical
303       index | Full index
304
305       © 2003-2022 GRASS Development Team, GRASS GIS 8.2.0 Reference Manual
306
307
308
309GRASS 8.2.0                                                       r.texture(1)
Impressum