Skip to main content

Hand tracking and gesture recognition module

Project description

OpenLeap

Table of contents

General Info

OpenLeap is an open source project that allows you to add hand gesture control to your Python projects.

Technologies

Project was created with technologies:

  • Python
  • OpenCV
  • MediaPipe
  • SciKit Learn

Setup

OpenLeap can be installed using pip, as shown below.

$ pip install openleap

Simple Example

Test openleap controller with an example program. Code below will create an instance of opencv window with feed from the camera.

import openleap

controller = openleap.OpenLeap(screen_show=True, 
                               screeen_type='BLACK', 
                               show_data_on_image=True,
                               show_data_in_console=True,
                               gesture_model='sign_language')

controller.loop()

OpenLeap returns relative position of each hand, distance between thumb tip and index finger tip, rotation angle by wrist point and recognized gesture. There are two models for gesture recognition.

The first one can recognized wheter hand is opened or closed into fist, second model can recognized sign language alphabet as shown below.

OpenLeap object can be created with couple of options.

  • screen_show - if set to True, window with camera feed will be created.
  • screen_type - "CAM" or "BLACK" background.
  • show_data_on_image - descriptive
  • show_data_in_console - descriptive
  • gesture_model - chose gesture recognition model, "basic" or "sign_language"

Access Hand Information

Recognized gestures, hand position, tilt and so on are stored in a dictionary called 'data' that consists of two dataclass objects for right and left hand. Dataclass object is of given structure:

@dataclass
class Data:
    x : float = 0
    y : float = 0
    z : float = 0
    distance: float = 0.0
    angle: float = 0.0
    gesture: str = None

Dataclass containing all of the data above is continuously being updated in main() or loop() function depending on which one is being used.

Example

if controller.data['right'].gesture == 'open':
    print('Right hand is opened!')
elif controller.data['right'].gesture == 'fist':
    print('Right hand is closed!')

Another Example

if controller.data['right'].distance < 20:
    print('Click has been detected!')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openleap-0.5.6.tar.gz (1.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openleap-0.5.6-py3-none-any.whl (1.7 MB view details)

Uploaded Python 3

File details

Details for the file openleap-0.5.6.tar.gz.

File metadata

  • Download URL: openleap-0.5.6.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for openleap-0.5.6.tar.gz
Algorithm Hash digest
SHA256 5074ff08415e8c239f4421c57b6678a9b8718da06077c2074f43c49202485d54
MD5 41c9b19947dbabb35b0f04beeb3d9a4b
BLAKE2b-256 bd6b9a55dc6d2c2724205055282464ca90c195e52642521871fc8e216a0268a4

See more details on using hashes here.

File details

Details for the file openleap-0.5.6-py3-none-any.whl.

File metadata

  • Download URL: openleap-0.5.6-py3-none-any.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for openleap-0.5.6-py3-none-any.whl
Algorithm Hash digest
SHA256 2c6e2aabdb766bf56908c0cd64a221c5b15145604bc262568e73b514ff45ba98
MD5 87c17ded029b472101d4b7e538c60a03
BLAKE2b-256 88084b9832649a44dd9f81752b5f01a5bba5fe0a9a8cffc905f9645f6b9b2d98

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page