![]() |
Leap Motion Java API Reference
0.8.0
|
The Frame class represents a set of hand and finger tracking data detected in a single frame. More...
Inherits com.leapmotion.leap.Interface.
Public Member Functions | |
boolean | equals (Frame arg0) |
Compare Frame object equality. | |
Finger | finger (int id) |
The Finger object with the specified ID in this frame. | |
FingerList | fingers () |
The list of Finger objects detected in this frame, given in arbitrary order. | |
Frame () | |
Constructs a Frame object. | |
Gesture | gesture (int id) |
The Gesture object with the specified ID in this frame. | |
GestureList | gestures () |
The gestures recognized or continuing in this frame. | |
GestureList | gestures (Frame sinceFrame) |
Returns a GestureList containing all gestures that have occured since the specified frame. | |
Hand | hand (int id) |
The Hand object with the specified ID in this frame. | |
HandList | hands () |
The list of Hand objects detected in this frame, given in arbitrary order. | |
long | id () |
A unique ID for this Frame. | |
InteractionBox | interactionBox () |
The current InteractionBox for the frame. | |
boolean | isValid () |
Reports whether this Frame instance is valid. | |
Pointable | pointable (int id) |
The Pointable object with the specified ID in this frame. | |
PointableList | pointables () |
The list of Pointable objects (fingers and tools) detected in this frame, given in arbitrary order. | |
float | rotationAngle (Frame sinceFrame) |
The angle of rotation around the rotation axis derived from the overall rotational motion between the current frame and the specified frame. | |
float | rotationAngle (Frame sinceFrame, Vector axis) |
The angle of rotation around the specified axis derived from the overall rotational motion between the current frame and the specified frame. | |
Vector | rotationAxis (Frame sinceFrame) |
The axis of rotation derived from the overall rotational motion between the current frame and the specified frame. | |
Matrix | rotationMatrix (Frame sinceFrame) |
The transform matrix expressing the rotation derived from the overall rotational motion between the current frame and the specified frame. | |
float | rotationProbability (Frame sinceFrame) |
The estimated probability that the overall motion between the current frame and the specified frame is intended to be a rotating motion. | |
float | scaleFactor (Frame sinceFrame) |
The scale factor derived from the overall motion between the current frame and the specified frame. | |
float | scaleProbability (Frame sinceFrame) |
The estimated probability that the overall motion between the current frame and the specified frame is intended to be a scaling motion. | |
long | timestamp () |
The frame capture time in microseconds elapsed since the Leap started. | |
Tool | tool (int id) |
The Tool object with the specified ID in this frame. | |
ToolList | tools () |
The list of Tool objects detected in this frame, given in arbitrary order. | |
String | toString () |
A string containing a brief, human readable description of the Frame object. | |
Vector | translation (Frame sinceFrame) |
The change of position derived from the overall linear motion between the current frame and the specified frame. | |
float | translationProbability (Frame sinceFrame) |
The estimated probability that the overall motion between the current frame and the specified frame is intended to be a translating motion. | |
Static Public Member Functions | |
static Frame | invalid () |
Returns an invalid Frame object. | |
The Frame class represents a set of hand and finger tracking data detected in a single frame.
The Leap Motion software detects hands, fingers and tools within the tracking area, reporting their positions, orientations and motions in frames at the Leap Motion frame rate.
Access Frame objects through an instance of the Controller class. Implement a Listener subclass to receive a callback event when a new Frame is available.
com.leapmotion.leap.Frame.Frame | ( | ) |
Constructs a Frame object.
Frame instances created with this constructor are invalid. Get valid Frame objects by calling the Controller::frame() function.
boolean com.leapmotion.leap.Frame.equals | ( | Frame | arg0 | ) |
Finger com.leapmotion.leap.Frame.finger | ( | int | id | ) |
The Finger object with the specified ID in this frame.
Use the Frame::finger() function to retrieve the Finger object from this frame using an ID value obtained from a previous frame. This function always returns a Finger object, but if no finger with the specified ID is present, an invalid Finger object is returned.
Note that ID values persist across frames, but only until tracking of a particular object is lost. If tracking of a finger is lost and subsequently regained, the new Finger object representing that physical finger may have a different ID than that representing the finger in an earlier frame.
id | The ID value of a Finger object from a previous frame. |
FingerList com.leapmotion.leap.Frame.fingers | ( | ) |
The list of Finger objects detected in this frame, given in arbitrary order.
The list can be empty if no fingers are detected.
Gesture com.leapmotion.leap.Frame.gesture | ( | int | id | ) |
The Gesture object with the specified ID in this frame.
Use the Frame::gesture() function to return a Gesture object in this frame using an ID obtained in an earlier frame. The function always returns a Gesture object, but if there was no update for the gesture in this frame, then an invalid Gesture object is returned.
All Gesture objects representing the same recognized movement share the same ID.
id | The ID of an Gesture object from a previous frame. |
GestureList com.leapmotion.leap.Frame.gestures | ( | ) |
The gestures recognized or continuing in this frame.
Circle and swipe gestures are updated every frame. Tap gestures only appear in the list for a single frame.
GestureList com.leapmotion.leap.Frame.gestures | ( | Frame | sinceFrame | ) |
Returns a GestureList containing all gestures that have occured since the specified frame.
sinceFrame | An earlier Frame object. The starting frame must still be in the frame history cache, which has a default length of 60 frames. |
Hand com.leapmotion.leap.Frame.hand | ( | int | id | ) |
The Hand object with the specified ID in this frame.
Use the Frame::hand() function to retrieve the Hand object from this frame using an ID value obtained from a previous frame. This function always returns a Hand object, but if no hand with the specified ID is present, an invalid Hand object is returned.
Note that ID values persist across frames, but only until tracking of a particular object is lost. If tracking of a hand is lost and subsequently regained, the new Hand object representing that physical hand may have a different ID than that representing the physical hand in an earlier frame.
id | The ID value of a Hand object from a previous frame. |
HandList com.leapmotion.leap.Frame.hands | ( | ) |
long com.leapmotion.leap.Frame.id | ( | ) |
A unique ID for this Frame.
Consecutive frames processed by the Leap Motion software have consecutive increasing values.
InteractionBox com.leapmotion.leap.Frame.interactionBox | ( | ) |
The current InteractionBox for the frame.
See the InteractionBox class documentation for more details on how this class should be used.
|
static |
Returns an invalid Frame object.
You can use the instance returned by this function in comparisons testing whether a given Frame instance is valid or invalid. (You can also use the Frame::isValid() function.)
boolean com.leapmotion.leap.Frame.isValid | ( | ) |
Reports whether this Frame instance is valid.
A valid Frame is one generated by the Leap::Controller object that contains tracking data for all detected entities. An invalid Frame contains no actual tracking data, but you can call its functions without risk of a null pointer exception. The invalid Frame mechanism makes it more convenient to track individual data across the frame history. For example, you can invoke:
for an arbitrary Frame history value, "n", without first checking whether frame(n) returned a null object. (You should still check that the returned Finger instance is valid.)
Pointable com.leapmotion.leap.Frame.pointable | ( | int | id | ) |
The Pointable object with the specified ID in this frame.
Use the Frame::pointable() function to retrieve the Pointable object from this frame using an ID value obtained from a previous frame. This function always returns a Pointable object, but if no finger or tool with the specified ID is present, an invalid Pointable object is returned.
Note that ID values persist across frames, but only until tracking of a particular object is lost. If tracking of a finger or tool is lost and subsequently regained, the new Pointable object representing that finger or tool may have a different ID than that representing the finger or tool in an earlier frame.
id | The ID value of a Pointable object from a previous frame. |
PointableList com.leapmotion.leap.Frame.pointables | ( | ) |
The list of Pointable objects (fingers and tools) detected in this frame, given in arbitrary order.
The list can be empty if no fingers or tools are detected.
float com.leapmotion.leap.Frame.rotationAngle | ( | Frame | sinceFrame | ) |
The angle of rotation around the rotation axis derived from the overall rotational motion between the current frame and the specified frame.
The returned angle is expressed in radians measured clockwise around the rotation axis (using the right-hand rule) between the start and end frames. The value is always between 0 and pi radians (0 and 180 degrees).
The Leap Motion software derives frame rotation from the relative change in position and orientation of all objects detected in the field of view.
If either this frame or sinceFrame is an invalid Frame object, then the angle of rotation is zero.
sinceFrame | The starting frame for computing the relative rotation. |
The angle of rotation around the specified axis derived from the overall rotational motion between the current frame and the specified frame.
The returned angle is expressed in radians measured clockwise around the rotation axis (using the right-hand rule) between the start and end frames. The value is always between -pi and pi radians (-180 and 180 degrees).
The Leap Motion software derives frame rotation from the relative change in position and orientation of all objects detected in the field of view.
If either this frame or sinceFrame is an invalid Frame object, then the angle of rotation is zero.
sinceFrame | The starting frame for computing the relative rotation. |
axis | The axis to measure rotation around. |
The axis of rotation derived from the overall rotational motion between the current frame and the specified frame.
The returned direction vector is normalized.
The Leap Motion software derives frame rotation from the relative change in position and orientation of all objects detected in the field of view.
If either this frame or sinceFrame is an invalid Frame object, or if no rotation is detected between the two frames, a zero vector is returned.
sinceFrame | The starting frame for computing the relative rotation. |
The transform matrix expressing the rotation derived from the overall rotational motion between the current frame and the specified frame.
The Leap Motion software derives frame rotation from the relative change in position and orientation of all objects detected in the field of view.
If either this frame or sinceFrame is an invalid Frame object, then this method returns an identity matrix.
sinceFrame | The starting frame for computing the relative rotation. |
float com.leapmotion.leap.Frame.rotationProbability | ( | Frame | sinceFrame | ) |
The estimated probability that the overall motion between the current frame and the specified frame is intended to be a rotating motion.
If either this frame or sinceFrame is an invalid Frame object, then this method returns zero.
sinceFrame | The starting frame for computing the relative rotation. |
float com.leapmotion.leap.Frame.scaleFactor | ( | Frame | sinceFrame | ) |
The scale factor derived from the overall motion between the current frame and the specified frame.
The scale factor is always positive. A value of 1.0 indicates no scaling took place. Values between 0.0 and 1.0 indicate contraction and values greater than 1.0 indicate expansion.
The Leap Motion software derives scaling from the relative inward or outward motion of all objects detected in the field of view (independent of translation and rotation).
If either this frame or sinceFrame is an invalid Frame object, then this method returns 1.0.
sinceFrame | The starting frame for computing the relative scaling. |
float com.leapmotion.leap.Frame.scaleProbability | ( | Frame | sinceFrame | ) |
The estimated probability that the overall motion between the current frame and the specified frame is intended to be a scaling motion.
If either this frame or sinceFrame is an invalid Frame object, then this method returns zero.
sinceFrame | The starting frame for computing the relative scaling. |
long com.leapmotion.leap.Frame.timestamp | ( | ) |
The frame capture time in microseconds elapsed since the Leap started.
Tool com.leapmotion.leap.Frame.tool | ( | int | id | ) |
The Tool object with the specified ID in this frame.
Use the Frame::tool() function to retrieve the Tool object from this frame using an ID value obtained from a previous frame. This function always returns a Tool object, but if no tool with the specified ID is present, an invalid Tool object is returned.
Note that ID values persist across frames, but only until tracking of a particular object is lost. If tracking of a tool is lost and subsequently regained, the new Tool object representing that tool may have a different ID than that representing the tool in an earlier frame.
id | The ID value of a Tool object from a previous frame. |
ToolList com.leapmotion.leap.Frame.tools | ( | ) |
String com.leapmotion.leap.Frame.toString | ( | ) |
The change of position derived from the overall linear motion between the current frame and the specified frame.
The returned translation vector provides the magnitude and direction of the movement in millimeters.
The Leap Motion software derives frame translation from the linear motion of all objects detected in the field of view.
If either this frame or sinceFrame is an invalid Frame object, then this method returns a zero vector.
sinceFrame | The starting frame for computing the relative translation. |
float com.leapmotion.leap.Frame.translationProbability | ( | Frame | sinceFrame | ) |
The estimated probability that the overall motion between the current frame and the specified frame is intended to be a translating motion.
If either this frame or sinceFrame is an invalid Frame object, then this method returns zero.
sinceFrame | The starting frame for computing the translation. |