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 Functionsbyte[] data()The mask data.
The mask data is a set of 8-bit intensity values. The buffer is image.width() * image.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.
Mask leftMask = quad.masks().get(0); byte[] maskPixels = leftMask.data();
- Since
- 2.2.5
boolean equals(Mask arg0)Compares two Mask objects for equality.
- Since
- 2.2.6
int height()int id()An id indicating whether the mask goes with the left (0) or right (1) image.
Mask leftMask = quad.masks().get(0); int id = leftMask.id();
- Since
- 2.2.6
boolean 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.
Controller controller = new Controller(); TrackedQuad quad = controller.trackedQuad(); Mask leftMask = quad.masks().get(0); Mask rightMask = quad.masks().get(1);Controller controller = new Controller(); Frame frame = controller.frame(); TrackedQuad quad = frame.trackedQuad(); Mask leftMask = quad.masks().get(0); Mask rightMask = quad.masks().get(1);
- Since
- 2.2.6
int offsetX()int offsetY()long sequenceId()int width()