Thursday, February 24, 2011

Hand tracking with k-means clustering

Today's video features a screen capture where I am tracking two hands using depth data gathered from the Kinect sensor.

Instead of applying the built-in hand tracking from OpenNI, I implemented a simple k-means clustering algorithm, which divides all points of a frame that are closer than 80 cm into one or two clusters.

The red dots are the centers of those clusters, the other colored points are the ones that are used to find the clusters. For performance gains, only every 25th point is measured.


video

4 comments:

  1. Out of curiosity, how did you get the kmeans algorithm to not split your single hand into two separate clusters?

    Don't you have to specify ahead of time how many clusters you're expecting with kmeans?

    ReplyDelete
  2. Hi Ben

    You're right, the algorithm does actually split the hand into two clusters when only one hand is visible.

    What I do then is to merge the clusters if their centers are closer than a certain distance.

    Ideal would be to look at the smallest distance between any points in the separate clusters. But that was too slow.

    Regards,
    Stefan

    ReplyDelete
  3. hey stefan
    Can u pls explain the algorithm in detail

    ReplyDelete
  4. Hi Anirban

    There exists currently no other documentation than what is on my blog and on the documentation page on CodePlex. I'll first have to write it, which might take some time. But I guess I can work on that next.

    Regards,
    Stefan

    ReplyDelete