Hello!

Friends of the Leap Motion are that they leave. Yesterday they have released a new version of the SDK and the truth is that it brings quite a few interesting things. Among them there are 2 that are especially useful: Pitch and Grab. In the following video you can see how the action of Pitch gives a value between 0 and 1 when they come together the fingers of the hand. And Grab also gives a value between 0 and 1 for the action of seizing.

Another interesting fact is that we now have 2 properties that allow us to identify if the hand that is on the sensor is the left or right hand. The names are the most original IsLeftHand and IsRightHand.

As much as I do the code is not very complicated. In this case the controller of the Leap, analyzes in the event OnFrame() if there is any hand on it (line 15). Then on the first detected hand a series of events are released with the pitch, Grab and identification of left & right hand value.


using System;
using System.Threading.Tasks;
using Leap;
namespace ElBruno.LeapV2NewFeatures
{
public class MotionListener : Listener
{
public event Action<bool, bool> OnLeftOrRightHand;
public event Action<float, float> OnPitchAndGrab;
public override void OnFrame(Controller controller)
{
var frame = controller.Frame();
if (frame.Hands.IsEmpty) return;
var hand = frame.Hands[0];
Task.Factory.StartNew(() => OnLeftOrRightHand(hand.IsLeft, hand.IsRight));
Task.Factory.StartNew(() => OnPitchAndGrab(hand.PinchStrength, hand.GrabStrength));
}
}
}

 

The WPF app subscribes to these events and shows the value of them as seen in the video.

Source: https://developer.leapmotion.com/?utm_source=Leap+Motion+Developer+Newsletter & utm_campaign = 24e87d0847-Developer_Newsletter_63 & utm_medium = email & utm_term = 0_d7eaf93515-24e87d0847-63721789

Saludos @ La Finca

El Bruno

image image image Google

Leave a comment

Discover more from El Bruno

Subscribe now to keep reading and get access to the full archive.

Continue reading