The Frame class represents a set of hand and finger tracking data detected in a single frame. More...
Inherits IEquatable< Frame >.
Public Member Functions | |
void | Deserialize (byte[] arg) |
Decodes a byte string to replace the properties of this Frame. More... | |
bool | Equals (Frame other) |
Compare Frame object equality. More... | |
Frame () | |
Constructs a Frame object. More... | |
Frame (long id, long timestamp, float fps, InteractionBox interactionBox, List< Hand > hands) | |
Constructs a new Frame. More... | |
Hand | Hand (int id) |
The Hand object with the specified ID in this frame. More... | |
override string | ToString () |
A string containing a brief, human readable description of the Frame object. More... | |
Public Attributes | |
float | CurrentFramesPerSecond |
The instantaneous framerate. More... | |
List< Hand > | Hands |
The list of Hand objects detected in this frame, given in arbitrary order. More... | |
Vector | HeadPosition |
The position and orientation of the user's head. More... | |
long | Id |
A unique ID for this Frame. More... | |
InteractionBox | InteractionBox |
The current InteractionBox for the frame. More... | |
long | Timestamp |
The frame capture time in microseconds elapsed since an arbitrary point in time in the past. More... | |
Properties | |
byte[] | Serialize [get] |
Encodes this Frame object as a byte string. More... | |
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, gestures, 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.
Frame | ( | ) |
Constructs a Frame object.
Frame instances created with this constructor are invalid. Get valid Frame objects by calling the Controller::frame() function.
The only time you should use this constructor is before deserializing serialized frame data. Call Frame::deserialize(string)
to recreate a saved Frame.
Frame | ( | long | id, |
long | timestamp, | ||
float | fps, | ||
InteractionBox | interactionBox, | ||
List< Hand > | hands | ||
) |
Constructs a new Frame.
id | The id of this frame. |
timestamp | The creation time of this frame in microseconds. |
fps | The current data frame rate of the service when this frame was created. |
interactionBox | The InteractionBox object for this frame. |
void Deserialize | ( | byte[] | arg | ) |
Decodes a byte string to replace the properties of this Frame.
A Controller object must be instantiated for this function to succeed, but it does not need to be connected. To extract gestures from the deserialized frame, you must enable the appropriate gestures first.
Any existing data in the frame is destroyed. If you have references to child objects (hands, fingers, etc.), these are preserved as long as the references remain in scope.
Note: The behavior when calling functions which take another Frame object as a parameter is undefined when either frame has been deserialized. For example, calling Gestures(sinceFrame)
on a deserialized frame or with a deserialized frame as parameter (or both) does not necessarily return all gestures that occurred between the two frames. Motion functions, like ScaleFactor(startFrame)
, are more likely to return reasonable results, but could return anomalous values in some cases.
arg | A byte array containing the bytes of a serialized frame. |
bool Equals | ( | Frame | other | ) |
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. |
override string ToString | ( | ) |
float CurrentFramesPerSecond |
The instantaneous framerate.
The rate at which the Leap Motion software is providing frames of data (in frames per second). The framerate can fluctuate depending on available computing resources, activity within the device field of view, software tracking settings, and other factors.
List<Hand> Hands |
Vector HeadPosition |
The position and orientation of the user's head.
Positional tracking must be enabled.
long Id |
A unique ID for this Frame.
Consecutive frames processed by the Leap Motion software have consecutive increasing values. You can use the frame ID to avoid processing the same Frame object twice:
As well as to make sure that your application processes every frame:
The current InteractionBox for the frame.
See the InteractionBox class documentation for more details on how this class should be used.
long Timestamp |
The frame capture time in microseconds elapsed since an arbitrary point in time in the past.
Use Controller::now() to calculate the age of the frame.