views:

319

answers:

3

I've been trying to come up with an interest point detection algorithm and this is what I came up with:

You go through the X and the Y axises 3n pixels at a time creating 3n x 3n squares.

For the the n x n square in the middle of the 3n x 3n square (let's call it square Z), the R, G, and B values are averaged and rounded to preset values to limit the number of colors, and that is the color that square will be treated as.

The same is done for the 8 surrounding n x n squares.

After that, the color of square Z is compared to the surrounding squares, if it matches x out of the 8 surrounding squares where x <= 3 or x => 5 then that is an interest point (a corner is detected).

And so on till all the image is covered.

The bigger n is, the faster the image will be scanned and the the less accurate the detection is, and vice versa.

This, supposedly, detects "literal corners", that is corners you can actually SEE on the image.

What do you guys think of this algorithm? Is it efficient? Can it be used on a live video stream (say from the camera) on a hand-held device?

PS: This is the first "serious" algorithm I design (that is, outside an algorithm contest). And it's also the first time I try to explain how an algorithm works like this so if it's not clear, just ask :)

Thank you, God bless :)

+1  A: 

Why not try it and see if it works the way you expect? It sounds like it should. How does the performance compare with other methods? What is the complexity of the algorithm? Is it efficient compared to others? Where can it be improved? What kind of false-positives and false negatives are expected? Are they within reason based on the data I plan to use this on? What threshold should be used to compare surrounding squares? ....

this is stuff you should be doing, not us.

nlucaroni
+7  A: 

I'm sorry to say that I don't think this is likely to be very good. Your algorithm looks a bit like a simplistic version of Moravec's algorithm, which is itself one of the simplest corner detection algorithms. The hardcoded limits you test against effectively make your edge test a stepped function, unlike an approach such as summed square differences. This will almost certainly give you discontinuities in your detection function (corners that don't match when they should have), for some values.

You also have the same problem as Moravec, namely that if the edge lies at an angle to the direction of neighbours being considered, then it won't be detected.

Developing algorithms is fun, and if this isn't a business-critical project, then by all means, carry on tinkering and experimenting (and don't be put off by my comments!). But the fact is, for almost any practical problem, a better algorithm for the task you want to solve almost certainly already exists. The real challenge is identifying how you can best model your problem in such a way that you can solve it using an existing, well-understood approach, designed by experts.

In particular, robust identification and analysis of edge-cases and worst-case runtimes is a tricky business; unless you are a professional algorist, you are likely to find the going difficult. But I certainly encourage you to discover this for yourself by trying. nlucaroni mentions some excellent questions to use as starting points for your analysis.

ire_and_curses
Thank you so much :)It is for a marker-less augmented reality system I wanna make.I've looked a lot for a library I can use but all the good ones are not free. I tried SIFT and SURF but they were both slow so I decided to make my own.I opened up a picture of a sop sign (one of the things I'll be detecting), i put dots on the "interesting points" and they turned out to be the corners. I tried to come up with an algorithm to detect them and this is what I got.If you know any algorithm that's suitable for this purpose please let me know :)Thanks again :)
Leo Jweda
Sounds fun. I'd suggest the wikipedia page linked in the answer, and also this one, as good starting points:http://en.wikipedia.org/wiki/Edge_detection. Your code runs a little 3x3 kernel over the image. You can do quite a few image processing tricks with such an approach as the basic framework. Good luck!
ire_and_curses
Just for the records, I tried it in C#.. I can't say I'm satisfied with it but I sure am happy I could write an interest point detection algorithm, a crappy one, that is.It takes almost 1 second to detect all the points in a 400x600 picture.It was a good learning experience, nonetheless.Thank you ire_and_curses, I'll take a look at that page.God bless :)
Leo Jweda
Nice to see a high-quality technical answer that keeps some perspective! +1.
j_random_hacker
+1  A: 

I would suggest you look at the SIFT algorithm. Its the defacto standard for points of interest in an image. Unfortunately, its also patented, because its so good.

If you are interested in a real time version of SIFT you can get it to run on a GPU, but its highly experimental at this point. Note if you are developing a commercial application you'd have to first purchase a license for using SIFT or get approval from David Lowe.

ldog
OP has already tried SIFT - see comments on my answer.
ire_and_curses
Yea, thanks for the pointer. His major complaint about SIFT was it was too slow, you can actually get it to run faster with enough blood and sweat thrown at it to run it on a GPU or FPGA.
ldog
Thanks for the answer but I don't think running it on a GPU is an option, it's kinda my bad 'cause I didn't mention this but the ultimate goal is to run this on an Android.
Leo Jweda