0

I want to make tower defence game for WP7.5, where you must draw symbol of tower which you want to build. So the idea is when user has drawn something, I check if it matches with my towers symbols.

Symbol looks like this:

https://i.stack.imgur.com/3pbIc.png

User drawn something like this:

enter image description here

But now, I don't know how to effectively compare if user's image matches my symbol image. First idea is to match pixel per pixel and if all black pixels of user's image match every black pixel of my symbol to return true, but I think that isn't best way to make it.

Can somebody help me with this solution?

EDIT: Now I get another idea - I save coordinates where user touches on display and then I check in symbol image only pixels on coordinates which I saved. It looks better than compare it pixel per pixel, yeah? :)

LarsTech
  • 80,625
  • 14
  • 153
  • 225
Honza Kovář
  • 704
  • 6
  • 9
  • 1
    This is not trivial. There are many solutions out there (rotation, moving, scaling, etc); I'm sure a google search would reveal them – Adrian Feb 13 '12 at 20:00

2 Answers2

0

Android has gesture recognition built in - might be a good starting point on the subject before looking into WP-specific solutions.

mbeckish
  • 10,485
  • 5
  • 30
  • 55
0

The most common way that I've seen this done is to 'score' the drawn image based on how closely it matches each one. This usually involves either analyzing the image to determine approximately where the curves/points are or comparing it with images in an empirical cache of images. For example, store 5-10 images that are similar to what users draw for a circle and the other towers/shapes, then rank them on how closely they match.

While the techniques are relatively new in the computer vision/artificial intelligence fields... there are some existing libraries that might help though: http://code.google.com/p/aforge/

However, it may be easier and more fun to just try to implement it yourself.

David
  • 89
  • 3
  • Here is a similar question - the answer is basically what you want to do: http://stackoverflow.com/questions/152028/are-there-any-ok-image-recognition-libraries-for-net – David Feb 13 '12 at 19:58
  • Thx that great, but implement it by myself is more fun, how u said. :) – Honza Kovář Feb 13 '12 at 20:49