5,337
edits
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
These are a set of image features discovered by [[Wikipedia: Robert Haralick]]. | |||
==Algorithm== | |||
===Texture vs Tone=== | |||
Each image will have a tone and a texture: | |||
* Tone - average color in a patch | |||
* Texture - "variation of features of discrete gray tone" | |||
===Gray-Tone Spatial-Dependence matrices=== | |||
Today, these are known as Gray Level Co-occurrence Matrix (GLCM).<br> | |||
For a matrix with <math>N_g</math>, a Gray-Tone Spatial-Dependence matrix will be a <math>N_g \times N_g</math> symmetric matrix where entry <math>i,j</math> will contain the number of occurrences where a pixel with value <math>i</math> neighbors a pixel with value <math>j</math>.<br> | |||
In an image each pixel will have eight neighboring pixels, except at the edges: | |||
{| class="wikitable" style="margin:auto;text-align:center" | |||
|+ Nearest Neighbors to * | |||
|- | |||
| 135° || 90° || 45° | |||
|- | |||
| 0° || * || 0° | |||
|- | |||
| 45° || 90° || 135° | |||
|} | |||
Then <math>P(i,j,d,\alpha)</math> is the number of occurrences where a pixel with value <math>i</math> and a pixel with value <math>j</math> are distance <math>d</math> apart along angle <math>\alpha \in \{0^\circ, 45^\circ, 90^\circ, 135^\circ\}</math>. | |||
If we fix <code>d=1</code>, then we get four matrices of co-occurances along each direction: | |||
* <math>P_{H} = \{P(i,j,1, 0^\circ)\}</math> | |||
* <math>P_{V} = \{P(i,j,1, 90^\circ)\}</math> | |||
* <math>P_{LD} = \{P(i,j,1, 135^\circ)\}</math> | |||
* <math>P_{RD} = \{P(i,j,1, 45^\circ)\}</math> | |||
For horizontal and vertical directions with resolution N, each row or column will have 2(N-1) neighbors. Thus in total, there will be <math>R=2 N_x(N_y-1)</math> or <math>R=2 N_y(N_x-1)</math> neighbors.<br> | |||
For diagonal directions, there will be <math>R=2 (N_x - 1)(N_y-1)</math> neighbors.<br> | |||
Each co-occurance matrix <math>P</math> can be normalized by dividing each entry by R: <math> p= P/R</math>. | |||
===Features=== | |||
There are 14 values Haralick ''et al.'' compute per co-occurance matrix. The mean and range among the matrices are used to get 28 features. | |||
# Angular second moment: <math>f_1 = \sum_i \sum_j p(i,j)^2</math> | |||
# Contrast: | |||
# Correlation: | |||
# Sum of squares variance: | |||
# Inverse difference moment: | |||
# Sum Average: | |||
# Sum Entropy: | |||
# Entropy: | |||
# Difference Variance: | |||
# Difference Entropy: | |||
# Information Measures of Correlation 1: | |||
# Information Measures of Correlation 2: | |||
# Maximal Correlation Coefficient: | |||
==Resources== | ==Resources== | ||
* [https://ieeexplore.ieee.org/document/4309314 Textural Features for Image Classification (1973)] [https://www.researchgate.net/publication/302341151_Textural_Features_for_Image_Classification Researchgate Mirror] | * [https://ieeexplore.ieee.org/document/4309314 Textural Features for Image Classification (1973)] [https://www.researchgate.net/publication/302341151_Textural_Features_for_Image_Classification Researchgate Mirror] | ||
* [https://murphylab.web.cmu.edu/publications/boland/boland_node26.html Haralick texture features explanation] | |||
===Implementations=== | ===Implementations=== | ||
* [https://github.com/sentinel-hub/eo-learn/blob/master/features/eolearn/features/haralick.py eo-learn] | * [https://github.com/sentinel-hub/eo-learn/blob/master/features/eolearn/features/haralick.py eo-learn] | ||
* [https://github.com/DigitalSlideArchive/HistomicsTK/blob/master/histomicstk/features/compute_haralick_features.py HistomonicsTK] | * [https://github.com/DigitalSlideArchive/HistomicsTK/blob/master/histomicstk/features/compute_haralick_features.py HistomonicsTK] |