MaskΒΆ

Properties:

Methods:

class Leap::Mask

Note: This class is an experimental API for internal use only.

It may be removed without warning.

A bitmap mask defining areas of an image in which a finger or part of a hand is in front of the tracked quad. The mask is a subset of the camera image containing a the region including the quad. Pixels in the mask representing the hand have the value 255. Pixels in the rest of the mask have the value 0.

Two masks are provided for every Leap Motion frame. The mask with the id of 0 is for the left image. The right image has id 1.

The mask corresponds to the uncorrected image from the camera sensor. If you correct the image for distortion before displaying it, you should also correct the mask.

Since
2.2.6

Public Functions

bool Equals(Mask arg0)

Compares two Mask objects for equality.

Since
2.2.6

Mask()

Constructs a new Mask object.

Do not use. Get Mask objects from TrackedQuad.

Leap.Controller controller = new Leap.Controller();
Leap.TrackedQuad quad = controller.TrackedQuad;
Leap.Mask leftMask = quad.Masks[0];
Leap.Mask rightMask = quad.Masks[1];
Leap.Controller controller = new Leap.Controller();
Leap.Frame frame = controller.Frame();
Leap.TrackedQuad quad = frame.TrackedQuad;
Leap.Mask leftMask = quad.Masks[0];
Leap.Mask rightMask = quad.Masks[1];
Since
2.2.6

Property

byte[] Data

The mask data.

The mask data is a set of 8-bit intensity values. The buffer is mask.Width * mask.Height bytes long. Areas of the mask which contain part of a hand or finger covering the quad are assigned the value 255. The rest of the mask is assigned the value 0.

Leap.Mask leftMask = quad.Masks[0];
byte[] maskPixels = leftMask.Data;
Since
2.2.5

int Height

The height of the mask in Image pixels.

Leap.Mask leftMask = quad.Masks[0];
int height = leftMask.Height;
Since
2.2.6

int Id

An id indicating whether the mask goes with the left (0) or right (1) image.

Leap.Mask leftMask = quad.Masks[0];
float id = leftMask.Id;
Since
2.2.6

bool IsValid

Reports whether this is a valid Mask object.

Since
2.2.6

int OffsetX

The offset of the mask from the left edge of the Image in pixels.

Leap.Mask leftMask = quad.Masks[0];
int x = leftMask.OffsetX;
Since
2.2.6

int OffsetY

The offset of the mask from the top edge of the Image in pixels.

Leap.Mask leftMask = quad.Masks[0];
int y = leftMask.OffsetY;
Since
2.2.6

long SequenceId

An id value based on the sequence in which the mask is produced.

Corresponds to the Image sequence id.

Leap.Mask leftMask = quad.Masks[0];
float sequenceID = leftMask.SequenceId;
Since
2.2.6

int Width

The width of the mask in Image pixels.

Leap.Mask leftMask = quad.Masks[0];
int width = leftMask.Width;
Since
2.2.6

Public Static Functions

Mask Invalid()

An invalid Mask object.

Since
2.2.6