Git Product home page Git Product logo

leapc-python-bindings's Introduction

Gemini LeapC Python Bindings

mail discord GitHub

Open-source Python bindings for the Gemini LeapC API. Allowing developers to use Ultraleaps Hand Tracking technology with Python. Including build instructions and some simple examples to get started with.

Getting Started:

To use this plugin you will need the following:

  1. The latest Gemini Ultraleap Hand Tracking Software. You can get this here.
  2. An Ultraleap Hand Tracking Camera - follow setup process here.
  3. Follow one of the Installation workflows listed below.

Installation:

This module makes use of a compiled module called leapc_cffi. We include some pre-compiled python objects with our Gemini installation from 5.17 onwards. Supported versions can be found here. If you have the matching python version and have installed Gemini into the default location you can follow the steps below:

# Create and activate a virtual environment
pip install -r requirements.txt
pip install -e leapc-python-api
python examples/tracking_event_example.py

Custom Install

This module assumes that you have the Leap SDK installed in the default location. If this is not the case for you, you can use an environment variable to define the installation location. Define the environment variable LEAPSDK_INSTALL_LOCATION to the path of the LeapSDK folder, if you have installed to a custom location or moved it somewhere else.

Example: export LEAPSDK_INSTALL_LOCATION="C:\Program Files\CustomDir\Ultraleap\LeapSDK"

By default, this path is the following for each operating system:

  • Windows: C:/Program Files/Ultraleap/LeapSDK
  • Linux x64: /usr/lib/ultraleap-hand-tracking-service
  • Linux ARM: /opt/ultraleap/LeapSDK
  • Darwin: /Applications/Ultraleap Hand Tracking.app/Contents/LeapSDK

Pre-Compiled Module Support

The included pre-compiled modules within our 5.17 release currently only support the following versions of python:

  • Windows: Python 3.8
  • Linux x64: Python 3.8
  • Darwin: Python 3.8
  • Linux ARM: Python 3.8, 3.9, 3.10, 3.11

Expanded pre-compiled support will be added soon. However, this does not restrict you to these versions, if you wish to use a different python version please follow the instructions below to compile your own module.

Missing Compiled Module?

You might not have the correct matching compiled leapc_cffi module for your system, this can cause issues when importing leap, such as: ModuleNotFoundError: No module named 'leapc_cffi._leapc_cffi' If you'd like to build your own compiled module, you will still require a Gemini install and a C compiler of your choice. Follow the steps below:

# Create and activate a virtual environment
pip install -r requirements.txt
python -m build leapc-cffi
pip install leapc-cffi/dist/leapc_cffi-0.0.1.tar.gz
pip install -e leapc-python-api
python examples/tracking_event_example.py

Contributing

Our vision is to make it as easy as possible to design the best user experience for hand tracking. We learn and are inspired by the creations from our open source community - any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch:
    git checkout -b feature/AmazingFeature
  3. Commit your Changes:
    git commit -m "Add some AmazingFeature"
  4. Push to the Branch:
    git push origin feature/AmazingFeature
  5. Open a Pull Request

License

Use of the LeapC Python Bindings is subject to the Apache V2 License Agreement.

Community Support

Our Discord Server, Github Discussions and Developer Forum are places where you are actively encouraged to share your questions, insights, ideas, feature requests and projects.

leapc-python-bindings's People

Contributors

alexgrayul avatar harrymills-ul avatar ul-capsmaldon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

leapc-python-bindings's Issues

clarification on the data types

Hi,

I wanted to use the leap motion controller to collect the ground truth for finger pose estimation project. What are the rotation values for each joint/bone data type? can I assume they are radian values? and from what frame of reference?

Raspberry Pi cannot run leapmotion with usb camera

I am unable to retrieve Leap Motion data when using it simultaneously with a USB camera on a Raspberry Pi. Upon inspecting the log of libtrack_server, it consistently displays the following message:

May 03 15:59:15 raspberrypi libtrack_server[1207]: [15:59:15.722380417] [1377] [console] read()#376: The gain has changed from 2 to 16778241, indicating that the Leap 2 was reopened.

I have verified that (1) the power supply is sufficient, (2) tracking events are being received through on_tracking_event, and (3) the hand count remains consistently at zero.

Interestingly, once I stop the camera, the tracking function returns to normal operation.

I utilize OpenCV's VideoCapture to retrieve frames from the USB camera.

Error running sample project

Traceback (most recent call last):
  File "/Users/thisas/Desktop/leapc-python-bindings/leapc-python-api/src/leap/__init__.py", line 74, in <module>
    from leapc_cffi import ffi, libleapc
  File "/Applications/Ultraleap Hand Tracking.app/Contents/LeapSDK/leapc_cffi/__init__.py", line 1, in <module>
    from ._leapc_cffi import ffi, lib as libleapc
ModuleNotFoundError: No module named 'leapc_cffi._leapc_cffi'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/thisas/Desktop/leapc-python-bindings/examples/tracking_event_example.py", line 7, in <module>
    import leap
  File "/Users/thisas/Desktop/leapc-python-bindings/leapc-python-api/src/leap/__init__.py", line 80, in <module>
    raise ImportError(
ImportError: Cannot import leapc_cffi: Unknown error, please consult readme for help. Attempting to find leapc_cffi within /Applications/Ultraleap Hand Tracking.app/Contents/LeapSDK. Caught ImportError: No module named 'leapc_cffi._leapc_cffi'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.