Git Product home page Git Product logo

nperceptual's Introduction

nperceptual

Finger points and gesture recognition library for Microsoft .NET Framework using Intel Perceptual SDK.

Dependencies (Managed via NuGet)

Usage

The main entry point of the library is the PerceptualManager class.

Sample code to display "perceptual cursor" using any WPF Shape/Component, with hand open-close ("grab") gesture detection, and Button.ClickEvent simulation.

private readonly PerceptualManager perceptualMgr;
private readonly PerceptualAdapter perceptualAdapter;

public MainWindow()
{
    InitializeComponent();
    perceptualMgr = new PerceptualManager();
    perceptualAdapter = new PerceptualAdapter(perceptualMgr, this);
    InitPerceptual();
}

private void InitPerceptual()
{
    perceptualMgr.Init();
    perceptualMgr.Start();
    perceptualAdapter.ExcludedControls.Add(hand);
    perceptualAdapter.Move = Perceptual_Move;
    perceptualAdapter.Close = Perceptual_Close;
    perceptualAdapter.Open = Perceptual_Open;
}

private void Perceptual_Open(object sender, RoutedEventArgs e)
{
    if (sender == this)
    {
        hand.Fill = new SolidColorBrush(Color.FromRgb(0x90, 0x90, 0x90));
    }
}

private void Perceptual_Close(object sender, RoutedEventArgs e)
{
    if (sender == this)
    {
        hand.Fill = new SolidColorBrush(Color.FromRgb(0xff, 0x33, 0));
    }
}

private void Perceptual_Move(object sender, HandMoveEventArgs e)
{
    if (sender == this)
    {
        hand.Margin = new Thickness(
            (-hand.ActualWidth / 2) + e.Location.X,
            (-hand.ActualHeight / 2) + e.Location.Y,
            0, 0);
    }
}

private void Window_Unloaded(object sender, RoutedEventArgs e)
{
    perceptualMgr.Dispose();
}

private void Window_Closed(object sender, EventArgs e)
{
    perceptualMgr.Dispose();
}

nperceptual's People

Contributors

ceefour avatar

Stargazers

 avatar

Watchers

 avatar  avatar  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.