views:

1094

answers:

3

Hi

I have a set of Strokes (from ink) and would like to find those strokes that participate in a geometric shape like line,square, circle, triangle... and identify them.

Until now i have seen many algorithms that work on bitmaps.

My problem is easier since i have already the good array of point. But still need to find the closest geometric shape. thanks John

A: 

You could try machine learning techniques to train your code on what the shapes you're interested in. This is similar to what a lot of people do for the wii remote to recognize gestures. Here's an example:

http://mm-werkstatt.informatik.uni-augsburg.de/project_details.php?id=46

Joel Martinez
+1  A: 

Have a look at the Hough transform.

Daniel Brückner
Why <del> your answer?
David Wolever
Because the Hough transform is for bitmap data while the question asks for identifying shapes in vector graphics.
Daniel Brückner
+3  A: 

Hi,

convert the strokes to vectors (e.g. angles). e.g.: 272, 93, 42, 179 Now compare these angles to a table of stored angles to be recognized:

e.g. shapes: { {0,90,180,270}, {270, 90, 45, 180} }

for every table entry do the following: for every angle do the following take the absolute difference between the two angles, and add them a running total store the running total

the runningtotal which is the least, is the shape it resembles the most.

beware of finding the difference between two angles by the way. There is the issue of the wraparound. the angle: 359 and 1 are very close apart... but if you simply subtract them, they appear 358 degrees apart.

Hope this was understandable

Toad
If the direction of the strokes doesn't matter, don't forget to wrap all the angles at 180 degrees. (so angle %= 180). This way a stroke up or down is the same
Toad