We present a demo on the morphological corner detector
developed by L.Alvarez, C.Cuenca and L.Mazorra

in the paper "Morphological Corner Detection. Application to Camera
Calibration". (PS file) (PDF
file) .

In this paper we study the application of the Affine Morphological Scale Space (AMSS) to corner detection with subpixel precision. Corner detection techniques are in general very sensitive to noise, so some kind of filtering is usually needed to remove noise before estimating the corner location, however, the filtering procedure changes the location of the corner, so the filtering introduce errors in the corner location. If we use the AMSS scale space as filtering, we can solve this problem because following the evolution of the
extrema of the curvature across the scales we can recover the original location of the corners with subpixel precision.
For more information about the AMSS scale space see the demo page Morphological
Multiscale Analysis DEMO page .

Figure 1. Illustration of the Morphological Corner detector.
On the left, the

original real image which corresponds to a rectangle of a calibration object.

In the center, the result at the scale t=6, of the evolution of the original
image

under the action of the affine invariant morphological multiscale analysis.
On

the right, the evolution of the local extrema of the curvature across the scales

(In white, the original location of the extrema of curvature, in red and green,

the location of the extrema of curvatures across the scales). If you click HERE

you will see a movie a movie where you can see the evolution of the curvature

extrema across the scales.

**Robust morphological corner detector algorithm.**

(1) We compute, using AMSS, the image at the scale t_{n}=t_{0}+ndt
where dt represents the discretization step for the scale and
t_{0} represents the initial scale that we use to begin to look for corners.

(2) We compute for the scale t_{0 }the location of the extrema of the curvature that we denote by
(x_{0}^{i},y_{0}^{i}),
these points represent the initial candidates to be corners. We follow across the scales the location
(x_{n}^{i},y_{n}^{i})
of the curvature extrema.

(3) For each sequence (x_{n}^{i},y_{n}^{i}), we compute in a robust way (using orthogonal regression and eliminating outliers) the best line which fit the sequence of points, this line corresponds to the bisector line of the corner. We compute also in a robust way the best line passing for the points
(t_{n}-t_{0},dist((x_{n}^{i},y_{n}^{i}),(x_{0}^{i},y_{0}^{i})))
The slope of such line, that we denote by (m^{i},
determines the angle of the corner. We also estimate, the direction of the bisector line
that we denote by (b_{x}^{i},b_{y}^{i}).

(4) Finally, we estimate the location (x^{i},y^{i})
of the corner in the original image as:

(x^{i},y^{i})
=(x_{0}^{i},y_{0}^{i})-m^{i}(t_{n_final}+t_{0})(b_{x}^{i},b_{y}^{i})

Figure 2. We illustrate the influence of the initial scale t_{0}
in order to remove the

spurious local extrema of curvature produces by the noise: On the left the
evolution

of extrema of curvature for t_{0}=0. On the right
the evolution of extrema of curvature for t_{0}=1.

Another advantage of the morphological corner detector is that you do not need to have a perfect corner given by the interception of 2 lines because you look for curvature extrema, in the next figure we show a corner detection illustration on a footbal.

Figure 3. Illustration of the Morphological Corner detector on
a footbal.

In blue, we have the recovered corners.

**C-Source Code **

You can test freely the morphological corner detector by your own with just 2 limitations:

1. You can not use it for commercial purposes.

2. You have to acknowledge to the authors in any publications where
you use the algorithm.

In order to get the C-source code you have to download the following files:

1. ami.h (some macros
that we use)

2. ami_calibracion (the library
where the main function are defined )

3. ami_morphological_corner_detector_test.c
(an example of application of the algorithm)

4. XMW_ami_morphological_corner_detector_test.c
(A graphic windows implementation of the algorithm in the XMegaWave Software.
You need to install XMegaWave to use this function see XMegaWave
Installation for more details.

5. XMW_ami_local_morphological_corner_detector_test.c
(A graphich window implementation of the morphological corner detector where we
improve the location of a number of initial corners provided by the user
by clicking on the image (tipically this tool is used for image calibration
purposes). You need to install XMegaWave to use this function see XMegaWave
Installation for more details.

> cc ami_morphological_corner_detector_test.c -o ami_morphological_corner_detector_test -lm

when you execute

> ami_morphological_corner_detector_test

you will obtain in a file the information about the corner location and some
corner quality parameters.