我想檢查Leap Motion Frame中的手是否當前是拳頭。用Leap Motion SDK V2檢測拳頭
通常建議的方法是尋找值爲1的hand.grabStrength
。問題是,即使使用「爪狀手」或任何其他手指略微卷曲的值,該值也跳到1。
另一種方法是檢查每個手指是否爲extended
。但是這有一個類似的問題,如果手指完全直線,手指只能算作延伸。所以即使我檢查所有的手指都沒有伸展,也會出現與上面相同的問題(爪狀手被識別爲抓取)。
結合這兩種方法也不能解決這個問題,考慮到它們都遭受同樣的問題,這並不令人驚訝。
現在,我們確實擁有每個手指的所有骨骼,包括位置和一切。但我不知道從數學開始檢測手指是否捲曲。
基本上我有這個設置現在:
var controller = Leap.loop(function(frame){
if(frame.hands.length>0){
//we only look at the first available hand
var hand = frame.hands[0];
//we get the index finger only, but later on we should look at all 5 fingers.
var index = hands.fingers[1];
//after that we get the positions of the joints between the bones in a hand
//the position of the metacarpal bone (i.e. the base of your hand)
var carp = index.carpPosition;
//the position of the joint on the knuckle of your hand
var mcp = index.mcpPosition;
//the position of the following joint, between the proximal and the intermediate bones
var pip = index.pipPosition;
//the position of the distal bone (the very tip of your finger)
var dip = index.dipPosition;
//and now we need the angle between each of those positions, which is where i'm stuck
}
});
那麼,如何才能獲得其中的兩個位置之間的夾角(鯉魚MCP,MCP,以畫中畫,PIP沾)?有任何想法嗎?
這是否也會使手指在關節處斷裂,指向需要的角度方向相反的方向做一個拳頭(好像完全不受關節範圍的限制)? :d。 * cringe * – 2014-10-30 14:11:29
我想這會,但是這個數學對我來說有點太複雜。 :P – DodgerThud 2014-10-30 14:17:27
我發現一個很好的解決方案,使用每個手指和手掌之間的距離。計算這些距離的總和並檢查它是否低於某個閾值。 – whoabackoff 2015-04-27 19:14:37