Detection » Corner detectors module

Corner detection algorithms

Contents

Functions

void dip::HarrisCornerDetector(dip::Image const& in, dip::Image& out, dip::dfloat kappa = 0.04, dip::FloatArray const& sigmas = {2.0}, dip::StringArray const& boundaryCondition = {})
Harris corner detector
void dip::ShiTomasiCornerDetector(dip::Image const& in, dip::Image& out, dip::FloatArray const& sigmas = {2.0}, dip::StringArray const& boundaryCondition = {})
Shi-Tomasi corner detector
void dip::NobleCornerDetector(dip::Image const& in, dip::Image& out, dip::FloatArray const& sigmas = {2.0}, dip::StringArray const& boundaryCondition = {})
Noble’s corner detector
void dip::WangBradyCornerDetector(dip::Image const& in, dip::Image& out, dip::dfloat threshold = 0.1, dip::FloatArray const& sigmas = {2.0}, dip::StringArray const& boundaryCondition = {})
Wang-Brady corner detector

Function documentation

void dip::HarrisCornerDetector(dip::Image const& in, dip::Image& out, dip::dfloat kappa = 0.04, dip::FloatArray const& sigmas = {2.0}, dip::StringArray const& boundaryCondition = {})

Harris corner detector

The Harris corner detector is defined as

\[ \text{Det}(M) - \kappa \text{Tr}(M)^2 \; , \]

where \(M\) is the structure tensor, and \(\kappa\) is a constant typically set to 0.04, in this function controlled by parameter kappa. Harris and Stephens noted in their paper that corners are locations in the image where both eigenvalues of \(M\) are large. But they considered eigenvalue computation too expensive, and therefore proposed this cheaper alternative. dip::ShiTomasiCornerDetector returns the smallest eigenvalue of \(M\) .

The structure tensor \(M\) is computed using dip::StructureTensor, with gradientSigmas equal to 1.0 and tensorSigmas set through this function’s sigmas parameter.

This function generalizes the corner measure above to any number of dimensions. in must be scalar and real-valued.

This function is equivalent to:

dip::Image M = StructureTensor( in, {}, { 1.0 }, sigmas, S::BEST, boundaryCondition );
Image out = dip::Determinant( M ) - k * dip::Square( dip::Trace( M ));
dip::ClipLow( out, out, 0 );

void dip::ShiTomasiCornerDetector(dip::Image const& in, dip::Image& out, dip::FloatArray const& sigmas = {2.0}, dip::StringArray const& boundaryCondition = {})

Shi-Tomasi corner detector

The Shi-Tomasi corner detector is defined as

\[ \text{min}(\lambda_1, \lambda_2) \; , \]

where the \(\lambda\) are the eigenvalues of \(M\) , the structure tensor. Corners are locations in the image where both eigenvalues of \(M\) are large.

The structure tensor \(M\) is computed using dip::StructureTensor, with gradientSigmas equal to 1.0 and tensorSigmas set through this function’s sigmas parameter.

This function generalizes the corner measure above to any number of dimensions. in must be scalar and real-valued.

This function is equivalent to:

dip::Image M = StructureTensor( in, {}, { 1.0 }, sigmas, S::BEST, boundaryCondition );
out = dip::SmallestEigenvalue( M );

void dip::NobleCornerDetector(dip::Image const& in, dip::Image& out, dip::FloatArray const& sigmas = {2.0}, dip::StringArray const& boundaryCondition = {})

Noble’s corner detector

Noble defined a corner detector as

\[ \text{Det}(M) / \text{Tr}(M) \; , \]

This is similar to the Harris corner detector (see dip::HarrisCornerDetector), except it has no parameter to tune. The ratio of the determinant to the trace is equivalent to the harmonic mean of the eigenvalues.

This function generalizes the corner measure above to any number of dimensions. in must be scalar and real-valued.

This function is equivalent to:

dip::Image M = StructureTensor( in, {}, { 1.0 }, sigmas, S::BEST, boundaryCondition );
Image out = dip::SafeDivide( dip::Determinant( M ), dip::Trace( M ));

void dip::WangBradyCornerDetector(dip::Image const& in, dip::Image& out, dip::dfloat threshold = 0.1, dip::FloatArray const& sigmas = {2.0}, dip::StringArray const& boundaryCondition = {})

Wang-Brady corner detector

Wang and Brady (1995) define a corner operator as

\[ \begin{cases} \Gamma = \left( \frac{\delta^2 F}{\delta \bf{t}^2} \right)^2 - s|\nabla F|^2 = \text{maximum} \\ \frac{\delta^2 F}{\delta \bf{n}^2} = 0 \\ |\nabla F|^2 > T_1 , \Gamma > T_2 \end{cases} \]

Here, \(\Gamma\) is composed of the square of the second derivative of the image \(F\) in the contour direction ( \(\bf{t}\) is the unit vector perpendicular to the gradient), and the square norm of the gradient. The first term is a measure for curvature, the second term is a measure for edgeness. \(s\) is a threshold (in this function defined through threshold) that determines how much larger the curvature must be compared to the edgeness. Typical values are in the range 0.0 to 0.5, the default is 0.1.

The second equation indicates that the second derivative in the gradient direction must be zero (the zero crossing of the second derivative indicates the exact sub-pixel location of the edge). The third equation indicates two thresholds that must be satisfied. This function computes only \(\Gamma\) , the thresholding must be applied separately.

This function generalizes the corner measure above to any number of dimensions. in must be scalar and real-valued.

Gradients are computed using Gaussian derivatives, with the sigmas parameter. This function is equivalent to:

Image out = dip::Square( dip::LaplaceMinusDgg( in, sigmas ))
          - threshold * dip::SquareNorm( dip::Gradient( in, sigmas ));
dip::ClipLow( out, out, 0 );