r.texture.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. <h2>DESCRIPTION</h2>
  2. <em>r.texture</em> creates raster maps with textural features from a
  3. user-specified raster map layer. The module calculates textural features
  4. based on spatial dependence matrices at 0, 45, 90, and 135
  5. degrees.
  6. <p>
  7. In order to take into account the scale of the texture to be measured,
  8. <em>r.texture</em> allows the user to define the <em>size</em> of the moving
  9. window and the <em>distance</em> at which to compare pixel grey values. By
  10. default the module averages the results over the 4 orientations, but the user
  11. can also request output of the texture variables in 4 different orientations
  12. (flag <em>-s</em>). Please note that angles are defined in degrees of east and
  13. they increase counterclockwise, so 0 is East - West, 45 is North-East -
  14. South-West, 90 is North - South, 135 is North-West - South-East.
  15. <p>
  16. The user can either chose one or several texture measures (see below for their
  17. description) using the <em>method</em> parameter, or can request the creating
  18. of maps for all available methods with the <em>-a</em>.
  19. <p>
  20. <em>r.texture</em> assumes grey levels ranging from 0 to 255 as input. The
  21. input is automatically rescaled to 0 to 255 if the input map range is outside of
  22. this range. In order to reduce noise in the input data (thus generally
  23. reinforcing the textural features), and to speed up processing, it is
  24. recommended that the user recode the data using equal-probability quantization.
  25. Quantization rules for <em>r.recode</em> can be generated with <em>r.quantile
  26. -r</em> using e.g 16 or 32 quantiles (see example below).
  27. <h2>NOTES</h2>
  28. <p>
  29. Texture is a feature of specific land cover classes in satellite imagery.
  30. It is particularly useful in situations where spectral differences between
  31. classes are small, but classes are distinguishable by their organisation on the
  32. ground, often opposing natural to human-made spaces: cultivated fields vs meadows
  33. or golf courses, palm tree plantations vs natural rain forest, but texture can
  34. also be a natural phenomen: dune fields, different canopies due to different
  35. tree species. The usefulness and use of texture is highly dependent on the
  36. resolution of satellite imagery and on the scale of the human intervention or
  37. the phenomenon that created the texture (also see the discussion of scale
  38. dependency below). The user should observe the phenomenon visually in order to
  39. determine an adequat setting of the <em>size</em> parameter.
  40. <p>
  41. The output of <em>r.texture</em> can constitute very useful additional variables
  42. as input for image classification or image segmentation (object recognition).
  43. It can be used in supervised classification algorithms such as
  44. <a href="i.maxlik.html">i.maxlik</a> or <a href="i.smap.html">i.smap</a>,
  45. or for the identification of objects in <a href="i.segment.html">i.segment</a>,
  46. and/or for the characterization of these objects and thus, for example, as one
  47. of the raster inputs of the
  48. <a href="https://grass.osgeo.org/grass7/manuals/addons/i.segment.stats.html">
  49. i.segment.stats</a> addon.
  50. <p>
  51. In general, several variables constitute texture: differences in grey level values,
  52. coarseness as scale of grey level differences, presence or lack of directionality
  53. and regular patterns. A texture can be characterized by tone (grey level intensity
  54. properties) and structure (spatial relationships). Since textures are highly scale
  55. dependent, hierarchical textures may occur.
  56. <p>
  57. <em>r.texture</em> uses the common texture model based on the so-called grey
  58. level co-occurrence matrix as described by Haralick et al (1973). This matrix
  59. is a two-dimensional histogram of grey levels for a pair of pixels which are
  60. separated by a fixed spatial relationship. The matrix approximates the joint
  61. probability distribution of a pair of pixels. Several texture measures are
  62. directly computed from the grey level co-occurrence matrix.
  63. <p>
  64. The following part offers brief explanations of the Haralick et al texture
  65. measures (after Jensen 1996).
  66. <h3>First-order statistics in the spatial domain</h3>
  67. <ul>
  68. <li> Sum Average (SA)</li>
  69. <li> Entropy (ENT):
  70. This measure analyses the randomness. It is high when the values of the
  71. moving window have similar values. It is low when the values are close
  72. to either 0 or 1 (i.e. when the pixels in the local window are uniform).</li>
  73. <li> Difference Entropy (DE)</li>
  74. <li> Sum Entropy (SE)</li>
  75. <li> Variance (VAR):
  76. A measure of gray tone variance within the moving window (second-order
  77. moment about the mean)</li>
  78. <li> Difference Variance (DV)</li>
  79. <li> Sum Variance (SV)</li>
  80. </ul>
  81. Note that measures "mean", "kurtosis", "range", "skewness", and "standard
  82. deviation" are available in <em>r.neighbors</em>.
  83. <h3>Second-order statistics in the spatial domain</h3>
  84. The second-order statistics texture model is based on the so-called grey
  85. level co-occurrence matrices (GLCM; after Haralick 1979).
  86. <ul>
  87. <li> Angular Second Moment (ASM, also called Uniformity):
  88. This is a measure of local homogeneity and the opposite of Entropy.
  89. High values of ASM occur when the pixels in the moving window are
  90. very similar.
  91. <br>
  92. Note: The square root of the ASM is sometimes used as a texture measure,
  93. and is called Energy.</li>
  94. <li> Inverse Difference Moment (IDM, also called Homogeneity):
  95. This measure relates inversely to the contrast measure. It is a direct measure of the
  96. local homogeneity of a digital image. Low values are associated with low homogeneity
  97. and vice versa.</li>
  98. <li> Contrast (CON):
  99. This measure analyses the image contrast (locally gray-level variations) as
  100. the linear dependency of grey levels of neighboring pixels (similarity). Typically high,
  101. when the scale of local texture is larger than the <em>distance</em>.</li>
  102. <li> Correlation (COR):
  103. This measure analyses the linear dependency of grey levels of neighboring
  104. pixels. Typically high, when the scale of local texture is larger than the
  105. <em>distance</em>.</li>
  106. <li> Information Measures of Correlation (MOC)</li>
  107. <li> Maximal Correlation Coefficient (MCC)</li>
  108. </ul>
  109. <p>
  110. The computational region should be set to the input map with
  111. <b>g.region raster=&lt;input map&gt;</b>, or aligned to the input map
  112. with <b>g.region align=&lt;input map&gt;</b> if only a subregion
  113. should be analyzed.
  114. <p>
  115. Note that the output of <em>r.texture</em> will always be smaller than
  116. the current region as only cells for which there are no null cells and
  117. for which all cells of the moving window are within the current region
  118. will contain a value. The output will thus appear cropped at the margins.
  119. <p>
  120. Importantly, the input raster map cannot have more than 255 categories.
  121. <h2>EXAMPLE</h2>
  122. Calculation of Angular Second Moment of B/W orthophoto (North Carolina data set):
  123. <div class="code"><pre>
  124. g.region raster=ortho_2001_t792_1m -p
  125. # set grey level color table 0% black 100% white
  126. r.colors ortho_2001_t792_1m color=grey
  127. # extract grey levels
  128. r.mapcalc "ortho_2001_t792_1m.greylevel = ortho_2001_t792_1m"
  129. # texture analysis
  130. r.texture ortho_2001_t792_1m.greylevel prefix=ortho_texture method=asm -s
  131. # display
  132. g.region n=221461 s=221094 w=638279 e=638694
  133. d.shade color=ortho_texture_ASM_0 shade=ortho_2001_t792_1m
  134. </pre></div>
  135. This calculates four maps (requested texture at four orientations):
  136. ortho_texture_ASM_0, ortho_texture_ASM_45, ortho_texture_ASM_90, ortho_texture_ASM_135.
  137. Reducing the number of gray levels (equal-probability quantizing):
  138. <div class="code"><pre>
  139. g.region -p raster=ortho_2001_t792_1m
  140. # enter as one line or with \
  141. r.quantile input=ortho_2001_t792_1m quantiles=16 -r | r.recode \
  142. input=ortho_2001_t792_1m output=ortho_2001_t792_1m_q16 rules=-
  143. </pre></div>
  144. The recoded raster map can then be used as input for <em>r.texture</em> as before.
  145. <p>
  146. Second example: analysis of IDM (homogeneity) on a simple raster with
  147. North-South line pattern.
  148. <div class="code"><pre>
  149. # import raster
  150. r.in.ascii in=- output=lines &lt;&lt; EOF
  151. north: 9
  152. south: 0
  153. east: 9
  154. west: 0
  155. rows: 9
  156. cols: 9
  157. 0 0 0 1 0 0 0 1 0
  158. 0 0 0 1 0 0 0 1 0
  159. 0 0 0 1 0 0 0 1 0
  160. 0 0 0 1 0 0 0 1 0
  161. 0 0 0 1 0 0 0 1 0
  162. 0 0 0 1 0 0 0 1 0
  163. 0 0 0 1 0 0 0 1 0
  164. 0 0 0 1 0 0 0 1 0
  165. 0 0 0 1 0 0 0 1 0
  166. EOF
  167. # adjust region to raster
  168. g.region raster=lines
  169. # calculate IDM (homogeneity) in all directions
  170. r.texture -s lines method=idm output=text_lines
  171. </pre></div>
  172. <p>
  173. The following image shows the original map, the result in East-West direction
  174. and the result in North-South direction, showing how texture can depend on
  175. direction, with texture perfectly homogeneous (value=1) in the North-South
  176. direction, but quite heterogeneous in East-West direction, except for those
  177. areas where there are three columns of equal values (as size=3).
  178. The overlaid grid highlights that the texture measures output maps
  179. are cropped at the margins.
  180. <center>
  181. <img src="r_texture_directions_example.png" border=1><br>
  182. <i>IDM textures according to direction</i>
  183. </center>
  184. <h2>KNOWN ISSUES</h2>
  185. The program can run incredibly slow for large raster maps and large
  186. moving windows (<em>size</em> option).
  187. <h2>REFERENCES</h2>
  188. The algorithm was implemented after Haralick et al., 1973 and 1979.
  189. <p>
  190. The original code was taken by permission from <em>pgmtexture</em>, part of
  191. PBMPLUS (Copyright 1991, Jef Poskanser and Texas Agricultural Experiment
  192. Station, employer for hire of James Darrell McCauley). Manual page
  193. of <a href="http://netpbm.sourceforge.net/doc/pgmtexture.html">pgmtexture</a>.
  194. Over the years, the source code of <em>r.texture</em> was further improved.
  195. <ul>
  196. <li>Haralick, R.M., K. Shanmugam, and I. Dinstein (1973). Textural features for
  197. image classification. <em>IEEE Transactions on Systems, Man, and
  198. Cybernetics</em>, SMC-3(6):610-621.</li>
  199. <li>Bouman, C. A., Shapiro, M. (1994). A Multiscale Random Field Model for
  200. Bayesian Image Segmentation, IEEE Trans. on Image Processing, vol. 3, no. 2.</li>
  201. <li>Jensen, J.R. (1996). Introductory digital image processing. Prentice Hall.
  202. ISBN 0-13-205840-5 </li>
  203. <li>Haralick, R. (May 1979). <i>Statistical and structural approaches to texture</i>,
  204. Proceedings of the IEEE, vol. 67, No.5, pp. 786-804</li>
  205. <li>Hall-Beyer, M. (2007). <a href="http://www.fp.ucalgary.ca/mhallbey/tutorial.htm">The GLCM Tutorial Home Page</a>
  206. (Grey-Level Co-occurrence Matrix texture measurements). University of Calgary, Canada
  207. </ul>
  208. <h2>SEE ALSO</h2>
  209. <em>
  210. <a href="i.maxlik.html">i.maxlik</a>,
  211. <a href="i.gensig.html">i.gensig</a>,
  212. <a href="i.smap.html">i.smap</a>,
  213. <a href="i.gensigset.html">i.gensigset</a>,
  214. <a href="https://grass.osgeo.org/grass7/manuals/addons/i.segment.stats.html">
  215. i.segment.stats</a>,
  216. <a href="i.pca.html">i.pca</a>,
  217. <a href="r.neighbors.html">r.neighbors</a>,
  218. <a href="r.rescale.html">r.rescale</a>
  219. </em>
  220. <h2>AUTHORS</h2>
  221. <a href="mailto:antoniol@ieee.org">G. Antoniol</a> - RCOST (Research Centre on Software Technology - Viale Traiano - 82100 Benevento)<br>
  222. C. Basco - RCOST (Research Centre on Software Technology - Viale Traiano - 82100 Benevento)<br>
  223. M. Ceccarelli - Facolta di Scienze, Universita del Sannio, Benevento<br>
  224. Markus Metz (correction and optimization of the initial version)<br>
  225. Moritz Lennert (documentation)
  226. <p><i>Last changed: $Date$</i>