The NITE library (on top of OpenNI) has classes for detecting napkins and other gestures, but I personally had problems using both the OpenNI core libraries and NITE in C # (I continue to work in AccessViolationExceptions). If you are writing managed code, XnVNITE.net.dll is what the swipe detection has. It is found in the PrimeSense / NITE folder after installing NITE.
If you can do without skeleton and user recognition, there is also the ManagedNite.dll library, which is the redundant library that comes with the PrimeSense NITE installation. ManagedNite.dll also has hand / gesture recognition, but no skeleton / user detection.
Otherwise, you, of course, can define your own gestures based on time. You should be able to detect whether a series of hand points moves in a straight line with this function:
static bool DetectSwipe(Point3D[] points) { int LineSize = 10; // number of points in the array to look at int MinXDelta = 300; // required horizontal distance int MaxYDelta = 100; // max mount of vertical variation float x1 = points[0].X; float y1 = points[0].Y; float x2 = points[last].X; float y2 = points[last].Y; if (Math.Abs(x1 - x2) < MinXDelta) return false; if (y1 - y2 > MaxYDelta) return false; for (int i = 1; i < LineSize - 2; i++) { if (Math.Abs((points[i].Y - y1)) > MaxYDelta) return false; float result = (y1 - y1) * points[i].X + (x2 - x1) * points[i].Y + (x1 * y2 - x2 * y1); if (result > Math.Abs(result)) { return false; } } return true; }
You can reinforce this code to detect what is happening with the right or left wire. I also did not enable the calculation of time in my example above - you will need to look at the time of the first and last points and determine whether the scroll is completed within a certain period of time.
kindohm
source share