How to get the positions in aka.leapmotion?

Jinseok's icon

hello.

I need to get the palm positions of both hands in aka.leapmotion at the same time.

But, when I put my hands above the leap motion, aka.leapmotion gives the list of only one hand position.

I think that aka.leapmotion does not give the list for each hand position at the same time.

How can I get the positions of both hands simultaneously?

John's icon

I wrote an external to do just that. Create two instances of the external and throw a 0 or 1 into the right inlet depending of if you're using your left or right hand for that instance (0 = left). The zip file also includes a M4L device that I made where you can map your palm position to any device parameter. Here it is. Let me know what you think.

John's icon

D'Oh! Just realized that didn't include the help file with the object. It's fairly straight forward: just set the hand flag on the right inlet (0 or 1) and bang the left inlet to get the X, Y, and Z coordinates for the specific hand. Here's the help patch.

Max Patch
Copy patch and select New From Clipboard in Max.

Jinseok's icon

It works well!
Thank you, John:D
This is definitely what I wanted.
The help patch is very helpful to understand your external.

I really want to know how the external works, because I'll extend it to get other positions of besides palms later.

The key is how to classify left and right hand. In your external, 0 inlet can detect left hand and 1 inlet can detect right hand, when both hands are above the leap motion. I'd like to know the main structure for classifying both hands in your external.

Thank you, again.

John's icon

I'd love to say that I worked out a complicated algorithm to check which hand is being used, but it's actually part of the LeapMotion API. All said, the aka.leapmotion is a better external and the author was kind enough to put his source code online; my stuff is really just an extension of that code that implements a few features that I needed from the Leap such as keeping hands independent and gesture recognition. I'm actually designing a set of externals for the Leap that I'll post as a project whenever I get the chance to finish and debug them. I'll post the source code with externals as well.

Jinseok's icon

That is a nice job, I think.
I really hope to see your externals soon.

I just wanted to know the simple introduction of your way to track the both hands at the same time:) because I failed to do it using aka.leapmotion without working with additional external.
(Actually, I'm not familiar with making external)
Now, your external is very helpful for me though.
I really appreciate it.
And thanks for your kind post, again.

jmmmp's icon

Hi,

may I ask, what is the best current solution to work with the leap motion on windows?

Thanks,

jmmmp

John's icon

I haven't written my externals for windows yet and last I checked, aka.leapmotion is also OSX only. In that case, you'll probably have to go the MIDI/OSC route (no pun intended). Doing a quick survey of the Leap Motion App Store, it looks like your best bets are going to be Geco MIDI and ManosOSC. In that case you'd just throw on one of those programs and use udp routing (possibly in combination with the CNMAT OSC externals) or normal MIDI routing to get data from the Leap.

Jinseok's icon

To JMMMP.

I found the window external for leapmotion on max object database:
You can see "sekd.leapmotion" that was built on java.
I have not used it yet, so I cannot tell you about difference with OSX externals.

Or, you can download it from what I attached.

semdd.leapmotion.zip
zip
jmmmp's icon

Thanks Kiske4, I'm trying it already. It does work on windows.

sglandry's icon

Will this object work for max 6.1?

ermumedia's icon

To JOHN
It's very nice
Thank you.

Stephane Morisse's icon

To the OP : I've installed V2 beta drivers for the Leap and it now detects both hands.

jesslp206's icon

Hi,

I'm really new to coding and using Leap Motion. I am able to get numbers/positions from my Leap Motion into Max, but how can you get Max to recognize gestures? If I want Max to recognize a pinch between my forefinger and thumb as a command, how do I get Max to interpret "if my finger and thumb start at these coordinates and then end on these other coordinates" that is a pinch? Any help is appreciated. :) Thanks!

gal n's icon

hey!
Any way to get john's patch nowadays? The link seems to be dead.
Searching for it all over the place:)
Cheerz