Giter Club home page Giter Club logo

glgesturerecognizer's Introduction

GLGestureRecognizer

GLGestureRecognizer is an Objective-C implementation of the $1 Unistroke Recognizer, a simple gesture recognition algorithm (see Credits below). It is made available here in the form of an Objective-C class and iPhone demo application. It was implemented over the course of a couple evenings in late April 2009 by Adam Preble.

Using GLGestureRecognizer In Your Application

Simply copy GLGestureRecognizer.h and GLGestureRecognizer.m into your project and add them to your app target. If you wish to load template information (gesture descriptions) from JSON, you will also need GLGestureRecognizer+JSONTemplates.h and .m.

Demo Project

A demo iPhone project (GesturesDemo.xcodeproj) is provided; a UIView subclass (GestureView) receives touch events and sends them to the GLGestureRecognizer class while drawing the touched path in white. Once the gesture is completed, the resampled gesture is shown in green, its center at the red dot, along with the name of the best match, score (lower is better), and gesture orientation. A sample size of 16 points is used in the example, which seems to be adequate for very basic shapes.

Adding Gestures

Gestures are added to GLGestureRecognizer using the templates property; see JSONTemplates category method -loadTemplatesFromJsonData: implementation for an example of how that is done.

You can add more gestures to the demo application by drawing the new gesture in the demo application itself. The demo application will print the points to the console in JSON format, which you can then add to the Gestures.json file to expand the supported set of gestures. You will want to use a similar approach to add more gestures if you choose to use a different serialization method.

License

GLGestureRecognizer is available as open source, with the only requirement of using it being that you e-mail me and let me know what you're using it in.

Credits

The $1 Unistroke Recognizer algorithm used in GLGestureRecognizer is based on the JavaScript implementation at http://depts.washington.edu/aimgroup/proj/dollar/, which is described in the following UIST 2007 paper:

Wobbrock, J.O., Wilson, A.D. and Li, Y. (2007). Gestures without libraries, toolkits or training: A $1 recognizer for user interface prototypes. Proceedings of the ACM Symposium on User Interface Software and Technology (UIST '07). Newport, Rhode Island (October 7-10, 2007). New York: ACM Press, 159-168.

Implemented in Objective-C with iPhone demo project by Adam Preble of Giraffe Lab http://giraffelab.com/code/GLGestureRecognizer

Made available on GitHub: http://github.com/preble/GLGestureRecognizer/tree/master

glgesturerecognizer's People

Contributors

preble avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.