Sunday, March 6, 2011

Hand Orientation Detection

On the way to implement finger tip point detection I thought it would be a good idea to first know the hand's orientation. Here is what I tried:

Step 1: Find the convex hull of the hand shape (with the Graham Scan algorithm). This is the almost invisible white line around the hand in the video.

Step 2: Use linear regression to find the line function that minimizes the sum of distances to the points in the hull. The second, yellow line is just a helper to show all 4 directions.

And here is the result:

For step 2 I will try the Rotating Calipers algorithm when I have time to implement it (I didn't find any free c# math library that would do this for me). This algorithm calculates the minimum area rectangle that contains all points of the hand shape.


  1. Hi ! Very great job !
    Do you have the source code to share ?


  2. Hi Tino

    Thanks for your comment! The code is still work in progress, it needs some polishing before I can publish it.

    Stay tuned :-)

  3. Hi !

    Thank you for your rapidity ^^
    I'll wait for it. I'm now trying to understand the different functionnalities of the library... not easy !

    Happy polishing, and I'm impatient !



  4. I feel the need to add a small remark here: Because this is only a private project of mine and I'm working full time, it might take some time before it's ready. It depends on how much time I'll find over the next days.

    Can you run the samples that are included in the OpenNI package?

  5. Hello !

    No problem, I understand.
    Yes, I can run some samples who are included in OpenNi.

    I'm now being working on the base of the project "Painting with Kinect, using OpenNi" (

    My goal is to detect both hands, and fingers, to be able to drag some objects, like in one of your project 'Finger Tip Detection Part 1', but I still not have well understanded the mechanism...

    I hope your piece of code will a little help me :-)

    Good afternoon !


    (sorry for my english)