Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP] Discrete Handwriting (Gesture) Recognition

Author
Message
Jess T
Retired Moderator
20
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 23rd Jun 2006 18:18 Edited at: 23rd Jun 2006 18:23
Hello

First up, What is Gesture Recognition?

Well, basically, it is a method whereby the computer can match one continuous user-inputed stroke with a pre-defined stroke and rate it on its accuracy (-1 to 1).

At any rate, here's everything:
Download (614kb)
Includes;
Source
Project File
Executable (for non-DBPers)
Sample Gestures Save file (yes, you can make your own)

And for those that don't want to download, here are the functions straight out of the box (non-compilable);




Basically, follow the isntructions in the app.
When viewing stored gestures, the bigger red square/circle is the starting point for drawing (if you do it backwards, it wont be recognized!).

It's not fool-proof, so if you have two gestures that are similar, it'll pick the best match (maybe not what you wanted, but mathmatically, its choice is correct).

There are accuracy settings available also.
pointsPerStroke - is how smooth the gesture has to be - Lower the value for better recognition, raising it will force the user to be more accurate.
scaleSize - because this is a prototype, and the final is intended for a system that has no FPU (can't handle Float's very well), I made it so that it stored the final gesture as a series of integers. The higher this value, the more accurate the final stored gesture is (not that it matters, since by putting it up to, say, 1000, you would only be gaining about 1px more of accuracy!)

The original is taken from an article by Oleg Dopertchouk - Recognition of Handwritten Gestures.


Enjoy!

Jess.

Team EOD :: All-Round Nice Guy
Want Better dbHelp Files?
http://jt0.org

Attachments

Login to view attachments
BealziBob
19
Years of Service
User Offline
Joined: 9th Jul 2004
Location: The Grim North (UK)
Posted: 24th Jun 2006 13:34 Edited at: 24th Jun 2006 13:58
Very clever indeed Jess, Arx Fatalis clones ahoy


Just a casual observer.
Baggers
19
Years of Service
User Offline
Joined: 31st May 2004
Location: Yonder over dem dere hills
Posted: 24th Jun 2006 14:31
Wow, great work, this is some code I'm going to have to study!

M.I.A is pending
Math89
20
Years of Service
User Offline
Joined: 23rd Jan 2004
Location: UK
Posted: 24th Jun 2006 15:09
Truely amazing .
Jess T
Retired Moderator
20
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 24th Jun 2006 17:01
Thanks guys, but I only ported the code over to DBP from the C++ base-code in the Article I linked to.

At any rate, it is definatly fun to see it pick up complex (and simple) gestures and know just exactly what you're doing

Again, have fun with it!

Team EOD :: All-Round Nice Guy
Want Better dbHelp Files?
http://jt0.org
David T
Retired Moderator
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 25th Jun 2006 13:40
Ooh, very clever and useful! I've been working with a similar gestures feature in my new third person shooter. Well done!

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 26th Jun 2006 01:11
array error if you try to save without anything drawn.

"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
Jess T
Retired Moderator
20
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 26th Jun 2006 11:18
David,
Nice, it'll be good to see more usage of this style of system in games - It's much better than the standard Click the Menu approach!

Phaelax,
Oh well, don't try to save when there's nothing drawn
It's by no means a full application, just a demonstration on what can be done.
The only reason saving/loading is in is so that I could show off some pre-defined gestures to get you started.

Team EOD :: All-Round Nice Guy
Want Better dbHelp Files?
http://jt0.org
NeX the Fairly Fast Ferret
19
Years of Service
User Offline
Joined: 10th Apr 2005
Location: The Fifth Plane of Oblivion
Posted: 7th Jul 2006 19:28
There is a bit of an error, it can't see the difference between a capital D and a capital B.

<OMG></OMG>
NeX, you cant be serious - CattleRustler.
Jess T
Retired Moderator
20
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 8th Jul 2006 15:49
Add the two characters to a save file, and post it up, and I'll have a look.

But like I said, it will be calculating it purely mathematically, so whatever you're drawing, it will be the mathematically closest.

If you can, try to make them different... For example, make the loops of the B quite obvious, whilst making the D a simple semi-circle.
Or, do an down-up-semicircle stroke for the D, and an up-curves stroke for the B.

Nintendo DS & Dominos :: DS Dominos
http://jt0.org
Lukas W
20
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 12th Jul 2006 12:23
this is very awesome, good job!

Login to post a reply

Server time is: 2024-04-28 03:49:22
Your offset time is: 2024-04-28 03:49:22