HaralickTextureExtraction - Haralick Texture Extraction
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Computes Haralick textural features on the selected channel of the input image

Detailed description
--------------------

This application computes three sets of Haralick features [1][2].
  * simple: a set of 8 local Haralick features: Energy (texture uniformity) , Entropy (measure of randomness of intensity image), Correlation (how correlated a pixel is to its neighborhood), Inverse Difference Moment (measures the texture homogeneity), Inertia (intensity contrast between a pixel and its neighborhood), Cluster Shade, Cluster Prominence, Haralick Correlation;
  * advanced: a set of 10 advanced Haralick features : Mean, Variance (measures the texture heterogeneity), Dissimilarity, Sum Average, Sum Variance, Sum Entropy, Difference of Entropies, Difference of Variances, IC1, IC2;
  * higher: a set of 11 higher Haralick features : Short Run Emphasis (measures the texture sharpness), Long Run Emphasis (measures the texture roughness), Grey-Level Nonuniformity, Run Length Nonuniformity, Run Percentage (measures the texture sharpness homogeneity), Low Grey-Level Run Emphasis, High Grey-Level Run Emphasis, Short Run Low Grey-Level Emphasis, Short Run High Grey-Level Emphasis, Long Run Low Grey-Level Emphasis and Long Run High Grey-Level Emphasis.

Parameters
----------

This section describes in details the parameters available for this application. Table [#]_ presents a summary of these parameters and the parameters keys to be used in command-line and programming languages. Application key is *HaralickTextureExtraction* .

.. [#] Table: Parameters table for Haralick Texture Extraction.

+----------------+----------------------------------+--------------------------+
|Parameter Key   |Parameter Name                    |Parameter Type            |
+================+==================================+==========================+
|in              |Input Image                       |Input image               |
+----------------+----------------------------------+--------------------------+
|channel         |Selected Channel                  |Int                       |
+----------------+----------------------------------+--------------------------+
|step            |Computation step                  |Int                       |
+----------------+----------------------------------+--------------------------+
|ram             |Available RAM (Mb)                |Int                       |
+----------------+----------------------------------+--------------------------+
|parameters      |Texture feature parameters        |Group                     |
+----------------+----------------------------------+--------------------------+
|parameters.xrad |X Radius                          |Int                       |
+----------------+----------------------------------+--------------------------+
|parameters.yrad |Y Radius                          |Int                       |
+----------------+----------------------------------+--------------------------+
|parameters.xoff |X Offset                          |Int                       |
+----------------+----------------------------------+--------------------------+
|parameters.yoff |Y Offset                          |Int                       |
+----------------+----------------------------------+--------------------------+
|parameters.min  |Image Minimum                     |Float                     |
+----------------+----------------------------------+--------------------------+
|parameters.max  |Image Maximum                     |Float                     |
+----------------+----------------------------------+--------------------------+
|parameters.nbbin|Histogram number of bin           |Int                       |
+----------------+----------------------------------+--------------------------+
|texture         |Texture Set Selection             |Choices                   |
+----------------+----------------------------------+--------------------------+
|texture simple  |Simple Haralick Texture Features  | *Choice*                 |
+----------------+----------------------------------+--------------------------+
|texture advanced|Advanced Texture Features         | *Choice*                 |
+----------------+----------------------------------+--------------------------+
|texture higher  |Higher Order Texture Features     | *Choice*                 |
+----------------+----------------------------------+--------------------------+
|out             |Output Image                      |Output image              |
+----------------+----------------------------------+--------------------------+
|inxml           |Load otb application from xml file|XML input parameters file |
+----------------+----------------------------------+--------------------------+
|outxml          |Save otb application to xml file  |XML output parameters file|
+----------------+----------------------------------+--------------------------+

**Input Image**: The input image to compute the features on.

**Selected Channel**: The selected channel index.

**Computation step**: Step (in pixels) to compute output texture values. The first computed pixel position is shifted by (step-1)/2 in both directions.

**Available RAM (Mb)**: Available memory for processing (in MB).

**[Texture feature parameters]**: This group of parameters allows one to define texture parameters.

- **X Radius**: X Radius.
- **Y Radius**: Y Radius.
- **X Offset**: X Offset.
- **Y Offset**: Y Offset.
- **Image Minimum**: Image Minimum.
- **Image Maximum**: Image Maximum.
- **Histogram number of bin**: Histogram number of bin.

**Texture Set Selection**: Choice of The Texture Set. Available choices are: 

- **Simple Haralick Texture Features**: This group of parameters defines the 8 local Haralick texture feature output image. The image channels are: Energy, Entropy, Correlation, Inverse Difference Moment, Inertia, Cluster Shade, Cluster Prominence and Haralick Correlation.
- **Advanced Texture Features**: This group of parameters defines the 10 advanced texture feature output image. The image channels are: Mean, Variance, Dissimilarity, Sum Average, Sum Variance, Sum Entropy, Difference of Entropies, Difference of Variances, IC1 and IC2.
- **Higher Order Texture Features**: This group of parameters defines the 11 higher order texture feature output image. The image channels are: Short Run Emphasis, Long Run Emphasis, Grey-Level Nonuniformity, Run Length Nonuniformity, Run Percentage, Low Grey-Level Run Emphasis, High Grey-Level Run Emphasis, Short Run Low Grey-Level Emphasis, Short Run High Grey-Level Emphasis, Long Run Low Grey-Level Emphasis and Long Run High Grey-Level Emphasis.

**Output Image**: Output image containing the selected texture features.

**Load otb application from xml file**: Load otb application from xml file.

**Save otb application to xml file**: Save otb application to xml file.



Example
-------

To run this example in command-line, use the following: 
::

	otbcli_HaralickTextureExtraction -in qb_RoadExtract.tif -channel 2 -parameters.xrad 3 -parameters.yrad 3 -texture simple -out HaralickTextures.tif

To run this example from Python, use the following code snippet: 

::

	#!/usr/bin/python

	# Import the otb applications package
	import otbApplication

	# The following line creates an instance of the HaralickTextureExtraction application 
	HaralickTextureExtraction = otbApplication.Registry.CreateApplication("HaralickTextureExtraction")

	# The following lines set all the application parameters:
	HaralickTextureExtraction.SetParameterString("in", "qb_RoadExtract.tif")

	HaralickTextureExtraction.SetParameterInt("channel", 2)

	HaralickTextureExtraction.SetParameterInt("parameters.xrad", 3)

	HaralickTextureExtraction.SetParameterInt("parameters.yrad", 3)

	HaralickTextureExtraction.SetParameterString("texture","simple")

	HaralickTextureExtraction.SetParameterString("out", "HaralickTextures.tif")

	# The following line execute the application
	HaralickTextureExtraction.ExecuteAndWriteOutput()

Limitations
~~~~~~~~~~~

The computation of the features is based on a Gray Level Co-occurrence matrix (GLCM) from the quantized input image. Consequently the quantization parameters (min, max, nbbin) must be appropriate to the range of the pixel values.

Authors
~~~~~~~

This application has been written by OTB-Team.

See Also
~~~~~~~~

These additional resources can be useful for further information: 
  | [1] HARALICK, Robert M., SHANMUGAM, Karthikeyan, et al. Textural features for image classification. IEEE Transactions on systems, man, and cybernetics, 1973, no 6, p. 610-621.
  | [2] otbScalarImageToTexturesFilter, otbScalarImageToAdvancedTexturesFilter and otbScalarImageToHigherOrderTexturesFilter classes