The $1 Unistroke Recognizer is a 2-D single-stroke recognizer designed for rapid prototyping of gesture-based user interfaces. In machine learning terms,$1 is an instance-based nearest-neighbor classifier with a 2-D Euclidean distance function, i.e., a geometric template matcher.

Original paper is here: http://depts.washington.edu/madlab/proj/dollar/index.html.

Pseudocode is here: http://depts.washington.edu/madlab/proj/dollar/dollar.pdf

I wrote Swift 5 version. I’ve also made some effort and created simple algorithm to recognize primitives. I assume that nobody reads this blog and nobody is interested in it. If it’s not true - let me know on Twitter @fewlinesofcode. This is not a nasty promo campaign. No need to share, like or retweet. The only thing I need is to be sure that somebody is reading. 1 person will be enough :)

You can check it at my github or the gist below: