To detect the corners of objects in an image, one can start by detecting edges then determining where two edges meet. There are however other methods, among which:
the Moravec detector [Moravec 1980],
the Harris detector [Harris & Stephens 1988].
Moravec detector¶
The principle of this detector is to observe if a sub-image, moved around one pixel in all directions, changes significantly. If this is the case, then the considered pixel is a corner.

Figure 1:Principle of Moravec detector. From left to right : on a flat area, small shifts in the sub-image (in red) do not cause any change; on a contour, we observe changes in only one direction; around a corner there are significant changes in all directions.
Mathematically, the change is characterized in each pixel of the image by which represents the difference between the sub-images for an offset :
where:
and represent the offsets in the four directions: ,
is a rectangular window around pixel ,
is the difference between the sub-image and the offset patch ,
In each pixel , the minimum of in the four directions is kept and denoted . Finally, the detected corners correspond to the local maxima of , that is, at pixels where the smallest value of is large.
It turns out that Moravec detector has several limitations. First, is a binary window and therefore the detector considers all pixels in the window with the same weight. When the noise in the image is high, it can lead to false corner detections. Second, only four directions are considered. Third, the detector remains very sensitive to edges because only the minimum of is considered. For these reasons, Harris has proposed a detector to overcome these limitations.
Harris detector¶
To avoid a noisy response, the rectangular window of the Moravec detector is replaced by a Gaussian window in the expression of .
To extend the Moravec detector to all directions, not limited to the initial four directions, a Taylor series expansion is performed on the shifted sub-image :
Therefore :
This expression can be written in the following matrix form:
where
Finally, the last limit of the Moravec detector can be avoided by considering a new measure of the presence of a corner: more information about the intensity change in the window can be obtained by analyzing the eigenvalues and of the matrix (Figure 2). Indeed, the presence of a corner is attested if the derivatives of are very large, then has large coefficients, and its eigenvalues are also very large.

Figure 2:Decision to be taken in function of the eigenvalues.
The calculation of the eigenvalues of can be difficult, so an alternative is to calculate:
with .
Thus, the values of are low in a flat region, negative on an edge, and positive on a corner (Figure 3).

Figure 3:Decision to be taken in function of .
The Harris detector is illustrated on the example of Figure 4.
Figure 4:Harris detector. The binary images represent the negative (contours), weak (flat areas) and positive (corners) values of the coefficient .