NOTE: A fork of this project using the newer Leap SDK can be found at https://github.com/tomh4/matleap.
This MATLAB mex-file will allow you to get data from a Leap Motion Controller device.
In order to build the mex-file, you need to have a C++ compiler installed, and you need to setup Matlab for building mex-files.
For more information on setting up Matlab for building mex-files, see the Matlab documentation.
$ ln -s ~/Software/Leap_Developer_Kit/LeapSDK/ ~/matleap/LeapSDK
>> build
>> test_matleap
>> matleap_version
ans =
0 4
>> f=matleap_frame
f =
id: 263725
timestamp: 8.1430e+09
pointables: [1x5 struct]
>> f.pointables(1).position
ans =
8.9769 220.3197 -5.8013
>> f.pointables(1).velocity
ans =
-6.7446 -4.2978 -13.0157
>> f.pointables(1).direction
ans =
0.2089 0.3257 -0.9221
>> test_matleap
matleap version 0.4
frame id 309984
frame timestamp 8767122812
frame pointables 5
pointable 1
id 6
position -18.529303 279.245270 -9.088086
velocity -19.887272 -16.154881 -2.646765
direction 0.098189 0.300899 -0.948588
pointable 2
id 7
...
pointable 5
id 10
position 34.367825 264.370300 41.408348
velocity -3.097427 13.046532 9.727820
direction 0.558435 0.059477 -0.827414
89 frames
1.000254 seconds
88.977400 fps
Frames are returned with invalid frame data: This happens when the motion controller driver is not installed.
Motion controller has slow framerate: The driver will go into standby mode if no movement is detected for a long period of time.
$ cp '/Applications/Leap Motion.app/Contents/MacOS/libLeap.dylib' path_to_matleap
# ln -s /usr/lib/Leap/libLeap.so /usr/lib/