MaskΒΆ
Methods:
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.
Public Functions
- Since
- 2.2.6
Public Static Functionsconst unsigned char * data()The pixels of the mask.
Pixels with the value of 255 represent areas of the image where a finger or part of a hand is in front of the quad. The rest of the mask has the value 0.
Leap::Mask leftMask = quad.masks()[0]; const unsigned char* maskPixels = leftMask.data();
- Since
- 2.2.6
int height()The height of the mask in Image pixels.
Leap::Mask leftMask = quad.masks()[0]; int height = leftMask.height();
- Since
- 2.2.6
int32_t id()An id indicating whether the mask goes with the left (0) or right (1) image.
Leap::Mask leftMask = quad.masks()[0]; int32_t id = leftMask.id();
- Since
- 2.2.6
bool isValid()Reports whether this is a valid Mask object.
- Since
- 2.2.6
Mask()Constructs a new Mask object.
Do not use. Get Mask objects from TrackedQuad.
Leap::Controller controller; Leap::TrackedQuad quad = controller.trackedQuad(); Leap::Mask leftMask = quad.masks()[0]; Leap::Mask rightMask = quad.masks()[1];Leap::Controller 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
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
bool operator!=(const Mask &)Compares two Mask objects for inequality.
- Since
- 2.2.6
bool operator==(const Mask &)Compares two Mask objects for equality.
- Since
- 2.2.6
int64_t 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]; int64_t 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