Skip to content

TangoChen/KinectV2MouseControl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kinect v2 Mouse Control

Updates:
  • v1.2.1
    May 4th, 2018: Lock control with first tracked person so as to avoid cursor being influenced by other people.

  • v1.2
    Apr 10th, 2018: Added two-hand controls:

    • Move + grip pressing.
    • Move + lift clicking.

    I personlly don't think these control functions are intuitive or good-looking gestures. But they kind of solve cursor jittering when doing a grip gesture, in a quick doable way. Still fine if you are okay with them for your scenarios.

  • v1.1
    Feb 21th, 2018: An update after 3 years since first created. On usages and the looking, the app doesn't seem very different. Features are nearly just the same, but with a big structure change on the code side using MVVM pattern.
    A small improvement on feature is, the cursor will keep following first tracked (lifting-forward) hand regardless of another hand lifting afterwards. Previously, it was set to only follow right hand when both hand are tracked.


Features

Control mode options

  • Disabled
  • Move only
  • Grip to press
  • Hover to click
  • Move + grip pressing *
  • Move + lift clicking *

* P.s. 2-hand control (One hand for moving cursor, another for mouse button control)

Adjustable parameters

  • Movement scale
  • Cursor smoothing
  • Hover-to-click range
  • Hover-to-click duration

Some more descriptions what some classes do:

KinectReader.cs

  • Turns on/off Kinect sensor.
  • Reads data from sensor.
  • Raises OnTrackedBody, OnLostTracking events.

CursorMapper.cs

  • Maps positions from input rect to output rect. Specifically in this case:

    • Input rect: Hand gesture moving area.
    • Output rect: Screen area.
  • Gets position for smoothed cursor movement.

  • Scale alignment available for deciding how movements are scaled from input to output rect with an adjusted proportion. So as to make desired and suitable cursor movements on specific area sizes. There's no visual settings on the current app. And it's set to LongerRange by default in code.

    e.g. If hand gesture moving area is (0, 0, 100, 100), screen area is (0, 0, 800, 600).

    • None. Scale: (1, 1)
    • Both. Scale: (8, 6)
    • Horizontal. Scale: (8, 8)
    • Vertical. Scale: (6, 6)
    • ShorterRange. Scale: (6, 6)
    • LongerRange. Scale: (8, 8)

MapperStructs.cs:

MRect and MVector2 included in MapperStructs.cs are custom Rect and Vector2 struct with an 'M' in the front just to make it more distinguishable from possibly existing namesake structs.

MRect has DeltaX, DeltaY, Width, Height, Center properties that can be used for calculating scale and offset for mapping.

About

A mouse control application for Kinect v2, including a couple of options for various uses.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages