Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Skeltrack - Open Source Skeleton Tracking

Skeltrack - Open Source Skeleton Tracking

Presentation of Skeltrack -- the only Open Source library for skeleton tracking.


Joaquim Rocha

May 26, 2012

More Decks by Joaquim Rocha

Other Decks in Programming


  1. Skeltrack - Open Source Skeleton Tracking Joaquim Rocha, Igalia LinuxTag

    2012 - Wunderbare Berlin
  2. Guten Tag! ✩ I am a developer at Igalia ✩

    I like doing innovative stuff like OCRFeeder and SeriesFinale ✩ and today I am presenting my latest project: Skeltrack
  3. The Kinect

  4. Microsoft's Kinect was the first camera with a price affordable

    to the public
  5. The USB connection is open and thus hackable

  6. This originated Open Source projects like the libfreenect, a library

    to control the Kinect device and get its information
  7. We created a GLib wrapper for libfreenect called GFreenect

  8. GFreenect offers asynchronous functions (and some synchronous as well) and

    makes it easy to use with other GNOME technologies
  9. GObject Introspection = free bindings (Python, Javascript, Vala)

  10. Kinect has a structured light camera which gives depth information

  11. But that's raw information... values from 0-2048

  12. libfreenect/GFreenect can give those values in mm

  13. None
  14. Still...

  15. It does NOT tell you there is a person in

    the picture
  16. Or a cow

  17. Or an ampelmann

  18. Let alone a skeleton and where its joints are

  19. For this you need a skeleton tracking solution

  20. Three proprietary/closed solutions exist:

  21. Microsoft Kinect SDK: non-commercial only

  22. OpenNI: commercial compatible

  23. Kinect for Windows: commercial use allowed but incompatible with the

    XBox's Kinect
  24. None
  25. Conclusion: There were no Free solutions to perform skeleton tracking...

  26. So Igalia built one!

  27. Enter Skeltrack

  28. What we wanted: ✩ A shared library, no fancy SDK

    ✩ Device independent ✩ No pattern matching, no databases ✩ Easy to use (everybody wants that!)
  29. Not as easy as it sounds!

  30. After some investigation we found Andreas Baak's paper "A Data-Driven

    Approach for Real-Time Full Body Pose Reconstruction from a Depth Camera"
  31. However this paper uses a database of poses to get

    what the user is doing
  32. So we based only part of our work on it

  33. How does it work?

  34. First we need to find the extremas

  35. Make a graph whose nodes are the depth pixels

  36. Connect two nodes if the distance is less than a

    certain value
  37. Connect the different graph's components by using connected-component labeling

  38. Choose a starting point and calculate Dijkstra to each point

    of the graph; choose the furthest point. There you got your extrema!
  39. Then create an edge between the starting point and the

    current extrema point with 0 cost and repeat the same process now using the current extrema as a starting point.
  40. This comes from Baak's paper and the difference starts here:

    choosing the starting point
  41. Baak chooses a centroid as the starting point We choose

    the bottom-most point starting from the centroid (this showed better results for the upper body extremas)
  42. So we got ourselves some extremas! What to do with

  43. What extrema is a hand, a head, a shoulder?

  44. For that we use educated guesses...

  45. We calculate 3 extremas

  46. Then we check each of them hoping they are the

  47. How?

  48. For each extrema we look for the points in places

    where the shoulders should be, checking their distances between the extrema and between each other.
  49. If they obey those rules then we assume they are

    the head'n'shoulders (tm)
  50. With the remaining 2 extremas, we will try to see

    if they are elbows or hands
  51. How to do it?

  52. Calculate Dijkstra from the shoulders to each extrema

  53. The closest extrema to any of the shoulders is either

    a hand of an elbow of that shoulder
  54. How to check if it's a hand or an elbow?

  55. If the distance between the extrema and the shoulder is

    less than a predefined value, then it is an elbow. Otherwise it is a hand.
  56. If it is a hand, we find the elbow by

    choosing the first point (in the path we created with Dijkstra before) whose distance exceeds the elbow distance mentioned before
  57. None
  58. There is still some things missing...

  59. Future work

  60. Hands from elbows: If one of the extremas is an

    elbow, we need to infer where the hand is
  61. Smoothing: Smooth the jittering of the joints

  62. Robustness: Use restrictions to ignore objects that are not the

  63. Multi-user: Track more than one person at a time

  64. And of course, get the rest of the joints: hips,

    knees, etc.
  65. How to use it?

  66. Asynchronous API

  67. SkeltrackSkeleton *skeleton = SKELTRACK_SKELETON (skeltrack_skeleton_new ()); skeltrack_skeleton_track_joints (skeleton, depth_buffer, buffer_width,

    buffer_height, NULL, on_track_joints, NULL);
  68. None
  69. Synchronous API

  70. SkeltrackJointList list; list = skeltrack_skeleton_track_joints_sync (skeleton, depth_buffer, buffer_width, buffer_height, NULL,

  71. Skeleton Joint: ID: HEAD, LEFT_ELBOW, RIGHT_HAND, ... x: X coordinate

    in real world (in mm) y: Y coordinate in real world (in mm) screen_x: X coordinate in the screen (in pixels) screen_y: Y coordinate in the screen (in pixels)
  72. Code/Bugs: https://github.com/joaquimrocha/Skeltrack

  73. Nifty Tools for Development: GFreenect: https://github.com/elima/GFreenect GFreenect Utils: https://github.com/joaquimrocha/gfreenect-utils

  74. GFreenect Python Example

  75. Tool: record-depth-file

  76. Tool: depth-file-viewer

  77. Questions?

  78. Creative Commons pictures from flickr: Kinect: Auxo.co.kr Ampelmann: echiner1 Kid

    Playing: Rob Welsh Skeleton: Dark Botxy