class Leap.Frame
The Frame class represents a set of hand and finger tracking data detected in a single frame.
The Leap detects hands, fingers and tools within the tracking area, reporting their positions, orientations and motions in frames at the Leap frame rate.
Access Frame objects using the Controller.frame() function.
Constructor Top
Frame () |
Static Properties & Enumerations Top
Leap.Frame | Invalid |
Properties Top
Leap.Pointable | fingers[] | ||
Leap.Gesture | gestures[] | ||
Leap.Hand | hands[] | ||
String | id | ||
Leap.Pointable | pointables[] | ||
Number | timestamp | ||
Leap.Pointable | tools[] | ||
Boolean | valid |
Methods Top
String | dump () | |
Leap.Pointable | finger (String id) | |
Leap.Hand | hand (String id) | |
Leap.Pointable | pointable (String id) | |
Number | rotationAngle (Leap.Frame sinceFrame, Leap.Vector axis) | |
Leap.Vector | rotationAxis (Leap.Frame sinceFrame) | |
Leap.Matrix | rotationMatrix (Leap.Frame sinceFrame) | |
Number | scaleFactor (Leap.Frame sinceFrame) | |
Leap.Pointable | tool (String id) | |
String | toString () | |
Leap.Vector | translation (Leap.Frame sinceFrame) |
Constructor details
Top
frame.js at line 8
Frame
()
Constructs a Frame object.
Frame instances created with this constructor are invalid.
Get valid Frame objects by calling the
Controller.frame() function.
Constructs a Frame object.
Frame instances created with this constructor are invalid. Get valid Frame objects by calling the Controller.frame() function.
Static Properties & Enumerations Detail Top
frame.js at line 427
An invalid Frame object.
You can use this invalid Frame in comparisons testing whether a given Frame instance is valid or invalid. (You can also check the Frame.valid property.)
Properties Detail Top
frame.js at line 94
The list of Finger objects detected in this frame, given in arbitrary order. The list can be empty if no fingers are detected.
frame.js at line 132
The list of Gesture objects detected in this frame, given in arbitrary order. The list can be empty if no gestures are detected.
Circle and swipe gestures are updated every frame. Tap gestures only appear in the list for a single frame.
frame.js at line 65
The list of Hand objects detected in this frame, given in arbitrary order. The list can be empty if no hands are detected.
frame.js at line 50
public
String
id
A unique ID for this Frame. Consecutive frames processed by the Leap have consecutive increasing values.
frame.js at line 75
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.
frame.js at line 58
public
Number
timestamp
The frame capture time in microseconds elapsed since the Leap started.
frame.js at line 85
The list of Tool objects detected in this frame, given in arbitrary order. The list can be empty if no tools are detected.
frame.js at line 27
public
Boolean
valid
Reports whether this Frame instance is valid.
A valid Frame is one generated by the 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 undefined object exception. The invalid Frame mechanism makes it more convenient to track individual data across the frame history. For example, you can invoke:
var finger = controller.frame(n).finger(fingerID);
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.)
Methods Detail Top
frame.js at line 396
public
String
dump
()
Returns a JSON-formatted string containing the hands, pointables and gestures in this frame.
frame.js at line 197
The finger with the specified ID in this frame.
Use the Frame finger() function to retrieve the finger 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 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 is lost and subsequently regained, the new Pointable object representing that physical finger may have a different ID than that representing the finger in an earlier frame.
frame.js at line 222
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.
frame.js at line 173
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.
frame.js at line 245
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 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.
frame.js at line 281
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 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.
frame.js at line 308
The transform matrix expressing the rotation derived from the overall rotational motion between the current frame and the specified frame.
The Leap 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.
frame.js at line 333
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 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.
frame.js at line 148
The tool with the specified ID in this frame.
Use the Frame tool() function to retrieve a tool from this frame using an ID value obtained from a previous frame. This function always returns a Pointable object, but if no 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 tool is lost and subsequently regained, the new Pointable object representing that tool may have a different ID than that representing the tool in an earlier frame.
frame.js at line 382
public
String
toString
()
A string containing a brief, human readable description of the Frame object.
frame.js at line 355
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 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.