Harris Corner Detection

by Daniel Pollithy

This is an interactive demo for the Harris Corner Detector running in your browser with tensorflow.js.

The goal is to find points in an image which are corners. These points have Hessians with large, similar eigenvalues. If only one of the eigenvalues would be large, then the point might be part of an edge but not a corner.

Instead of calculating the eigenvalues (which is by the way not straight forward to implement in tensorflow.js) the authors suggested to calculate a score which is easier to obtain from the Hessian. They named it the Harris-Cornerness-function f.

\[f = det(H) - kappa * trace^2 (H)\]

det(H) is equal to the product of the eigenvalues. And trace(H) is equal to the sum of the eigenvalues.

Combined in the f value we get an indication about how different and how large the eigenvalues are.

See for more details: Wikipedia

In the case you are wondering what this is good for: I am attending multiple computer vision courses this semester (video analysis, automotive vision, deep learning for computer vision) which have some overlaps. In order to practice matrix operations and get some visuals I decided to build a collection of demos with tensorflow.js that implement the classic cv algorithms.

Note: Instead of the Hessian H the structure matrix M is used most of the times. (dy and dy are the gradient in x and y direction):

\[\begin{pmatrix} dx^2 & dx \cdot dy \\ dy \cdot dx & dy^2 \end{pmatrix}\]

Harris Corner Settings: