Finger

Attributes:

Methods:

Constants:

class Leap.Finger

Extends Pointable.

The Finger class represents a tracked finger.

Fingers are Pointable objects that the Leap Motion software has classified as a finger. Get valid Finger objects from a Frame or a Hand object.

Fingers may be permanently associated to a hand. In this case the angular order of the finger IDs will be invariant. As fingers move in and out of view it is possible for the guessed ID of a finger to be incorrect. Consequently, it may be necessary for finger IDs to be exchanged. All tracked properties, such as velocity, will remain continuous in the API. However, quantities that are derived from the API output (such as a history of positions) will be discontinuous unless they have a corresponding ID exchange.

Note that Finger objects can be invalid, which means that they do not contain valid tracking data and do not correspond to a physical finger. Invalid Finger objects can be the result of asking for a Finger object using an ID from an earlier frame when no Finger objects with that ID exist in the current frame. A Finger object created from the Finger constructor is also invalid. Test for validity with the Pointable.is_valid() attribute.

New in version 1.0.

classmethod Finger([finger])

Constructs a Finger object.

finger = Finger(pointable)

Get valid Finger and Pointable objects from a Frame or a Hand object.

Parameters:finger (Pointable) – An object representing a finger. If no finger parameter is supplied, or the object does not represent a finger, an invalid Finger object is returned.
Return type:Finger

New in version 1.0.

type
Type:integer

The integer code representing the finger name.

  • 0 = TYPE_THUMB
  • 1 = TYPE_INDEX
  • 2 = TYPE_MIDDLE
  • 3 = TYPE_RING
  • 4 = TYPE_PINKY
finger_type = finger.type

Note: prior to API version 2.2.6, type was a method, not a property.

New in version 2.0.

bone(boneIndex)
Type:py:class:Bone

The object representing the specified bone on this finger.

bone = finger.bone(Bone.TYPE_PROXIMAL)
Parameters:boneIndex (integer) –

A code identifying the bone type:

  • 0 = TYPE_METACARPAL – The metacarpal bone.
  • 1 = TYPE_PROXIMAL – The proximal phalanx; the closest bone segment to the hand.
  • 2 = TYPE_INTERMEDIATE – The intermediate, or middle, phalanx.
  • 3 = TYPE_DISTAL – The distal phalanx; the bone segment furthest from the hand.
Returns:Bone – The Bone object representing the specified segment of the finger.

New in version 2.0.

joint_position(jointIx)

Deprecated. Use Finger.bone(boneIndex) instead.

The position of the specified joint on this finger in millimeters from the Leap Motion origin.

Arguments

jointIx (int) – A code identifying the finger joint:

  • 0 = JOINT_MCP – The metacarpophalangeal joint, or knuckle, of the finger.
  • 1 = JOINT_PIP – The proximal interphalangeal joint of the finger. This joint is the middle joint of a finger.
  • 2 = JOINT_DIP – The distal interphalangeal joint of the finger. This joint is closest to the tip.
  • 3 = JOINT_TIP – The tip of the finger.

Returns

The Vector containing the coordinates of the joint position.

New in version 2.0.

JOINT_DIP
Type:integer

The distal interphalangeal joint – the last joint before the finger tip.

New in version 2.0.

JOINT_MCP
Type:integer

The metacarpophalangeal joint – the knuckle.

New in version 2.0.

JOINT_PIP
Type:integer

The proximal interphalangeal joint – the joint between the proximal and intermediate phalanx bones.

New in version 2.0.

JOINT_TIP
Type:integer

The finger tip (not anatomically a joint, but included for convenience).

New in version 2.0.

TYPE_INDEX
Type:integer

The index finger.

New in version 2.0.

TYPE_MIDDLE
Type:integer

The middle finger.

New in version 2.0.

TYPE_PINKY
Type:integer

The little finger.

New in version 2.0.

TYPE_RING
Type:integer

The ring finger.

New in version 2.0.

TYPE_THUMB
Type:integer

The thumb.

New in version 2.0.

ZONE_HOVERING
Type:integer

The zone directly in front of the virtual touch plane.

New in version 2.0.

ZONE_NONE
Type:integer

The zone before reaching the hover zone.

New in version 2.0.

ZONE_TOUCHING
Type:integer

The zone touching or penetrating the virtual touch plane.

New in version 2.0.

invalid
Type:Finger

An invalid Finger object.

You can use this invalid object in comparisons testing whether a given Finger instance is valid or invalid. (You can also use the Pointable.is_valid attribute.)

New in version 1.0.