官方doc有四个手势,最近尝试实现对握拳的识别,并能在我的程序界面上体现出来。
调试过程较为繁琐,幸好最终效果还差强人意! 首先看看我的效果图:
该图实时显示我握拳、松开的过程。
部分问题解决还是比较痛苦的。 我尝试了多种方式,但过程有时候比结果其实更重要,幸好LeapMotion的API 识别出的数据比较完善。
Tip One: 计算弯曲角度。
1. measure the distance between a fingers stabilized point and the palms stabilized point
2. use that distance to calculate the angle at one end of a triangle
3.you can use those angles and lengths to work out lots of other lengths..
Tip Two: 根据API判断手指是否弯曲。
Tip Three:根据API 提供的Hand 抓取力度判断。
float GrabStrength
The strength of a grab hand pose.
The strength is zero for an open hand, and blends to 1.0 when a grabbing hand pose is recognized.
float strength = hand.GrabStrength;
- Return
- A float value in the [0..1] range representing the holding strength of the pose.
- Since
- 2.0
- Tip Four:计算指尖与掌心的位置。
- ----- 该方式我尝试了,也实现了我需要的效果,只是误差概率较大。也有可能是我实现过程有问题。
- Tip :有一些给我提供了想法的链接:
https://stackoverflow.com/questions/26649941/detecting-a-fist-with-leap-motion-sdk-v2
https://developer-archive.leapmotion.com/gallery/finger-angle
https://developer-archive.leapmotion.com/gallery/finger-angle-signed
http://blog.csdn.net/qq_31411825/article/details/54773801