Giter Site home page Giter Site logo

doitandbedone / unityhandtrackingwithmediapipe Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tesseraktzero/unityhandtrackingwithmediapipe

0.0 0.0 1.0 84.15 MB

Realtime hand tracking and finger tracking in Unity using Mediapipe

License: Apache License 2.0

ShaderLab 8.14% C# 91.86%

unityhandtrackingwithmediapipe's Introduction

Unity Hand Tracking with Mediapipe

This is a demo of realtime hand tracking and finger tracking in Unity using Mediapipe.

The tracking section is built on Android but a similar approach should also be applicable for desktop or IOS.

It works by first detecting the hand landmarks by Mediapipe in Android, and then sending the results to PC via adb and protobuf, and finally interpreting the results in PC Unity.

Hand Landmark Demo Model Demo

Prerequisites

  • Windows 10 PC recommended
  • Android mobile device (recommended with Android version 8.0 or above)
  • Unity with Android Build Support and Android SDK & NDK Tools (recommended with version 2019.4.6f1 or 2019.4.x)

Installation

  1. Enable Android Developer Mode and USB debugging in the mobile device. Connect the device with PC and allow permissions.

  2. Install the "UnityHandTracking.apk" to the device: drag and drop the apk into device and click the apk in the device's FileManager , or by command: adb install UnityHandTracking.apk. A built version of apk is included in release. The source code of the apk is available in mediapipe_multi_hands_tracking_aar_unity.

  3. Open the SampleScene in Unity project. In the scene, navigate to unitychan>HandLandmarkAndRigs>HandLandmarkSet. Update the Adb Path according to point to local adb which installed along with Unity Android Build Support. The path should have patterns similar to one of the belows:

    • C:\Unity\2019.4.6f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools\adb.exe

    • C:\Users\user\AppData\Local\Android\Sdk\platform-tools\adb.exe

  4. Start the SampleScene in Unity project. This should automatically start the Android app and receive data from it.

  5. Hold the device vertically and capture both hands for best tracking.

Customization

To apply hand tracking on your own avatar, follow the below steps:

  1. Setup Animtaion Rigging on the model:

    • Add Prefab HandLandmarkAndRigs as child of the model. Add component Rig Builder to the model. In the Rig Layers of Rig Builder, add the four rigs located under HandLandmarkAndRigs/Rigs (LeftHandRig, LeftFingerRig, RightHandRig, RightFingerRig).
    • In the four Hand Rigs, reassign the Root and Tip bones based on your model armature. Refer to the sample scene for details.
    • For each of the Hand Rigs, align their transform with the Tip transform. To do so, select that object and hold control select object assign in Tip. Then, navigate to menu: Animation Rigging -> Align Transform
  2. Adjust the position and rotation of the prefab HandLandmarkSet to fit with the model.

License

This project is under Apache License 2.0.

Third party assets used in this project are under their own licenses which can be found in corresponding asset folders.

unityhandtrackingwithmediapipe's People

Contributors

henryouly avatar tesseraktzero avatar

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.