ImageDev

Pattern Recognition

This group provides a package of pattern recognition functions based on standard correlations.
Some tools facilitating the exploitation of correlation results can be found in the Image Statistics section.

Image Correlation

The correlation filters allow the detection of rectangular pattern inside an input image in accordance with a matching criterion.

CrossCorrelation2d, CorrelationByDifference2d or CorrelationBySignChange2d can be used for grayscale image correlation and BinaryCorrelation2d for binary image correlation.

The grayscale correlation algorithms propose local luminosity and/or contrast normalization adjustments. There are 4 different correlation types (see CorrelationMode parameter): When performing a correlation between a $gx\times gy$ input image $I$, and a $kx \times ky$ kernel, $K$, the output image $O$ is an $gx\times gy$ floating point image. The correlation coefficient at location $(i, j)$ is given by a local calculation between the model and a pattern extraction from the input image, $P$. The pattern location is $(i-kx/2, j-ky/2)$ and its dimension is $(kx, ky)$.
The actual calculation depends on the image type: It also depends on the correlation normalization type as shown below. When a part of the pattern lies beyond the edge of the image the correlation is not performed on the image border.
Correlation algorithms provide a step parameter (OffsetMode parameter, except for CrossCorrelation2d). which speeds up the operation by calculating 1 value out of each step, as shown in Figure 1.
<b> Figure 1.</b> Standard Correlation
Figure 1. Standard Correlation

All uncomputed values (white pixels in Figure 1) are set to $-1 \times 10^{10}$ in the output image.

Luminosity and Contrast normalization

The luminosity and contrast normalization is controlled by one of the 4 correlation types: where $S$ is the correlation metric (or Similarity), related to the selected algorithm, $\mu$ is the mean operator and $\sigma^2$ the variance.

Output Image Normalization

During the correlation the minimum and the maximum values are calculated $(min, max)$. At the end of the filtering process, the correlation image is normalized between -1 and 1. The normalization depends on the following algorithm: $$ \Delta = \frac{max-min}{2} $$ $$ \mu = \frac{max+min}{2} $$ $$ \begin{array}{ll} O'(i, j) = \frac{O(i, j)-\mu}{\Delta} & \mbox{by default} \\ O'(i, j) = -1 \times \frac{O(i, j)-\mu}{\Delta} & \mbox{for correlation by difference} \end{array} $$ where $O'$ is the normalized image of the correlation image $O$.

Position of the Correlation Coefficients

If the pattern dimensions are odd, the position of the correlation coefficient is centered in the pattern and corresponds to a pixel position.
<b> Figure 2.</b> Correlation coefficient for odd dimensions
Figure 2. Correlation coefficient for odd dimensions

If the pattern dimensions are even, the position of the correlation coefficient is the closest pixel position to the top and the left.
<b> Figure 3.</b> Correlation coefficient for even dimensions
Figure 3. Correlation coefficient for even dimensions

Output Data

The correlation filters return a floating point correlation image. At the end of the process, this correlation image is converted between -1 and 1 (worst and best matching detected). The non-calculated points are set to -1E10.

These algorithms also return an output object CorrelationMsr which contains: