image = | localHistogramModule2dImg (inImg,inHalfKnlSizeX,inHalfKnlSizeY) |
image = | localHistogramModule2dImg (inImg,inHalfKnlSizeX,inHalfKnlSizeY,inOptNbClasses) |
Lowitz local histogram module on a 2d image.
This algorithm computes for each pixel of the output image its associated local histogram module, as defined by Lowitz [1], on a rectangular neighbourhood.
This measure is the difference between the actual local histogram and the theoretical histogram
for which each bin has the same value. This difference is calculated by the Mahalanobis distance and can be expressed as :
Where is the number of classes in the histogram,
is the expected value of the
bin of the histogram
and
is its variance.
We define as the value of the normalized histogram :
, with
being the number of pixels in the neighbourhood.
Since this measure is based on Bernoulli distribution, the expected value of and its variance are :
Moreover the theoretical histogram has the following expected value (and hence probability) and variance for each bin :
With draws (1 per pixel in the neighbourhood), we can rewrite the Mahalanobis distance as follows :
The histogram is computed on the rectangular kernel, with the following parameters:
The number of classes is an optional parameter of the algorithm. Its default value equals to 16. If the number of classes specified by the user exceeds the maximum allowed number of classes given the input image data type and dynamic range, it is automatically adjusted. For instance:
The borders of the input image are handled by padding pixels with a mirror reflection of the border pixels in the input image (see Border policy for more details).
Here is an example of an output image computed from the LocalHistogramModule2dImg algorithm on a 8-bits grey level, with a kernel of size 3x3 pixels and 16 classes:
[1] G. Lowitz "Can a Local Histogram Really Map Texture Information?". Pattern Recognition, 16, 2, 1983, pp 141–147.