An implementation of the Harris Corner Detector with Adaptive Non-Maximal Suppresion
git clone https://github.com/Zayne-sprague/HarrisCornerDetector_ANMS.git
Open the folder that was downloaded from git in matlab
Open main.m and run!
This is not an optimized algorithm by any means. I did this project to learn about the algorithm as well as implement it in a way that might help others answer some questions about the algorithm they had. It's very fun to implement and exciting to watch work! Though I would not use this in any professional setting.
A Harris Corner Detector is a way to evalute an image and find interest points that are easily traced and tracked across multiple images.
The main idea is that we want to find points on a picture that, if we rotated/scaled/moved the image, we could still easily recognize that point.
The intuition here is that corners are easier than other types of points in an image to easily find and reference when the image is transformed.
In this algorithm a corner is a pixel that has a large change in pixel intesities in either direction X or Y.
In order to find pixel intesities we use a filter on the image to find derivatives (or gradients) of the image. We find the X and Y derivatives and then create a Hessian Matrix of the gradients.
The Hessian at any given Pixel p will allow us to find some interesting properties about the eigenvalues of that pixels intensity. (How much the intensity has to change in one step in either direction). When these eigenvalues are similar and large this indicates a corner (hence a large step or change in intensity in any given direction).
I DIDN'T MAKE THIS IMAGE find source here along with good descriptions on more corner detection stuff!
This image gives a better intuition into how we could read the eigenvalues for the hessian at any given pixel. A Corner in a Harris Corner Detector is when BOTH eigenvalues are large.
Adaptive Non-Maximal Suppression is something that I had a hard time finding online. My implementation in this project is not optimal by far, but it gets the job done.
ANMS is a way to pick points from a matrix that have the local max in some window or neighbourhood and then you only pick the maximums of those local points.
What you end up with is usually an evenly distributed matrix of points that are the local max in the neighbourhood of pixels you took them from. This
allows us to reduce the noise the intensity functions we use to find corners create.
I separated how I did ANMS into a separate file so those interested in that specific algorithm they can check there.
- ANMS is not optimized at all, I don't plan on coming back and optimizing it any time soon, so if anyone is interested in proposing a more optimized version, totally go for it and let me know!
I am totally open to anyone wanting to improve or otherwise change this project. Let me know if you want to be a collaborator or otherwise wish to contribute :)
name: Zayne Sprague
email: zaynettft@gmail.com