module #include "diplib/detection.h"
Corner detectors Corner detection algorithms
Contents
- Reference
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
where is the structure tensor, and 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 are large. But they considered eigenvalue computation too expensive, and therefore
proposed this cheaper alternative. dip::ShiTomasiCornerDetector
returns the smallest eigenvalue of .
The structure tensor 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
where the are the eigenvalues of , the structure tensor. Corners are locations in the image where both eigenvalues of are large.
The structure tensor 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
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
Here, is composed of the square of the second derivative of the image in the contour direction
( 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. 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 , 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 );