# Pattern recognition of basic shapes in Rev

Randall Reetz randall at randallreetz.com
Thu Aug 19 11:05:12 CDT 2010

```Yes, my code always presents a ghost shape (what the code thinks the user is after) sub-imposed below the user's sketch.  A key stroke tells the code if the user has chosen the suggested shape.  And, of course it is also reasonable to present platonic geometric shapes that have been roughed up a bit to look hand drawn (they hold their target platonic shape in custom property... screen rendering is skin-specific).

-----Original Message-----
From: Bob Sneidar <bobs at twft.com>
Sent: Thursday, August 19, 2010 8:44 AM
To: How to use Revolution <use-revolution at lists.runrev.com>
Subject: Re: Pattern recognition of basic shapes in Rev

Given that computers are as dumb as a post and don't know anything about geometry to start with, I don't think the first example is so embarrassing after all. You have to tell the computer what each shape is before it gets smart enough to recognize it. The real difference lies in the purpose you are making the function for. If you are trying to give the user a way to hand draw standard shapes and then perfect them for him, the first method seems ideal. But if you are making a way for the user to draw complex objects with mixed curves and straight sides and what not, then the second method seems like the only way to go.

Maybe the recognition method is not granular enough. Maybe you should be thinking more like Illustrator does, with lines, curves and connection points. A subtle curve may be a shaky hand or exactly what the user wanted to draw. The difference between a perfect circle and a subtle oval would be indiscernible to a computer.  How does the computer know the difference? You would have to give the user a way to choose.

Just my 2¢
Bob

On Aug 17, 2010, at 11:30 AM, Randall Reetz wrote:

> I am working on two such filters.  The first is a brute force recognizer looking for matches to standard shapes (point, line, angle, triangle, rectangle, polygon, oval, conic and cylindric sections) and how closely a user drawing matches platonic forms of these (exp.  right and equilateral triangles, square, right rectangle, golden rectangle, parallelogram, circle) at any rotation.   The second filter is one I have been working on for 15 years and is a universal pattern engine which does the same as above but without a set of arbitrarily pre-defined target shapes.  From the self-evolving AI perspective from which I work, I consider the first filter set cheating and embarrassing (but hey, it is far easier to pull off).
>
> By the way, anyone can copy a code library or algorithm.  I am always interested in the ways different people go about solving problems like this.  The way I attack a problem is by collecting salient data.  What can I know about these user created polygons (number of points (or line segments), vertice angles between segments, relative segment lengths, relative distance of each vertices from the object's center of area, open or closed, etc.)?  Once this data is collected and stored for all user polygons, it can be compared with the same data collected from platonic shapes.
>
> How would you go about solving this problem?
>
>
> On Aug 17, 2010, at 1:38 AM, David Bovill wrote:
>
>> Thanks Mark - great paper!
>>
>> There does not seem to be a lot of code around - nearest I can find is
>> here<http://www.codeproject.com/KB/GDI-plus/blobby.aspx>.
>> I'd have thought it was something built into the touch screen OS's as it is
>> kind of essential for vector graphic drawing on touch screens?
>>
>>
>> On 17 August 2010 04:58, AcidJazz <mpezzo at gmail.com> wrote:
>>
>>>
>>> Here's a link to a technical article that discusses the fuzzy logic
>>> involved
>>> in pattern recognition of shapes.  It doesn't provide the exact algorithm,
>>> but should get you a little further down the road in your search.
>>>
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution

_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

```