A naive algorithm to find corners on a image.
When I was still studying the basics of digital image processing I came up with this "algorithm" to detect corners on a image.
Well, as the name suggests, this is a very naive approach.
Given any image we will look at it a window of 3 by 3 at a time. (We could resize the image to speed up the process, but who's in a hurry?)
We will then just count how many colored pixels we have at that window. If there's 4 colored pixels, it must be a corner. In order to be considerated a valid neighbour, the color should be between some threshold. That would take care of anti-aliased borders.
Anything else, is not a corner.
Harris Corner Detection (OpenCV)
Harris Corner Detection is without a doubt faster and more efficient, it also works better than mine. Those are some reasons why I called mine naive.
Run by calling
python corner.py img/mess.png
I also used this algorithm to process corners on a real time webcam video.