Fun with code (since 2006)

RGB Wheel Tracker

04.14.11 Posted in Actionscript 3 by

Hi dear readers, I've worked on a simple RGB recognition algorithm which is nicely accurate.

Let me show you a little demonstration :

RGB Wheel Tracker from didier.brun on Vimeo.


The algorithm is based on a paper I've read a few years a go, but I can not find the link. The idea is ready simple and require a simple pass on the image.

The first phase is to compare the proportional amount of red, green and blue from 3 relative points, and calculate a score for each pixel.

The second phase is then to blur the result, apply a threshold on the image.

The last phase is to find the blob with the biggest size.

This algorithm is applied for each orientation pattern according to this logic :

  • Iterate the marker searching on each orientation, one by frame rendered (top red, top blue, top green, top red, top blue, ...)
  • If a marker is found, keep the searching on the corresponding orientation only
  • When the marker is lost, iterate on the 3 orientation (point 1) until a marker is found

A sample image :

The algorithm

The result illustrated with "hot" zone :


The PDF marker :

Live demo :

Sources :

32 Responses to “RGB Wheel Tracker”

  1. WOW!!
    Its gorgeous!

  2. dgezeo says:

    Franchement, à part le motif de ton pull, ça défonce.
    Gorgeous indeed!

  3. Seraf_NSS says:

    excellent Didier

  4. JabbyPanda says:

    After this demo was shown to the public, Microsoft decided to decrease its price for hardware Kinect controllers :)

    Great inspirational stuff!

  5. Fardeen says:

    Excellent !

  6. stf says:

    Amazing ! Vraiment super.
    I worked with bitmapdatas for a school project in order to detect motion in flash. Your work will help to go forward !
    Thanks a lot !

  7. I just coloured in a piece of card with markers and it works fantastically.

    I imagine this is much more efficient and reliable than other types of tracking?

  8. Andre G says:


  9. thomas says:

    Vraiment cool !

    ça me fait penser a un vieux projet “Wiiless, la wiimote pour les pauvres” :

  10. karlitodelacasa says:

    super merci ! Ca me donne des idées…
    hier soir j’ai voulu imprimer le motif RGB mais mon imprimante n’avait plus d’encre verte… du coup l’APP ne marchait pas.
    J’ai vite fait une app iPhone avec l’image centrée et c’est top ! merci :D

  11. karlitodelacasa says:

    en fait j’aurais simplement pu charger le lien du PDF dans le safari iPhone, le problème c’était l’AUTO rotation…

  12. The accuracy is great, very nice job mate!

  13. Simon says:

    That works really, really well! Incredible accuracy and perfect performance.

  14. Simon says:

    I can recommend sticking a pencil in the middle and using it as a pointer :)

  15. Didier Brun says:

    Hello guys, thanks for your comments :)

    You can adjust these constants in the class :

    MARGIN : the size of the marker. Adjust this parameter according to the size of the marker (the distance from the camera)

    SENSIBILITY : sensibility factor.

    MIN_BLOB_SIZE : the minimum size to be interpreted as a real blob.

    THRESHOLD : the threshold level for the second phase of the algorithm.

    BLUR & BLUR_QUALITY : the blur filter is used to reduce the noise.

  16. Brian says:

    Amazing. again.

  17. [...] RGB Wheel Tracker [...]

  18. Francis says:

    Would it be possible to track the position of a single color marker?

  19. jloa says:

    is it just me or it’s the vimeo service that doesn’t work?
    All i get is a black screen dunno why

  20. [...] detail you can read at you can try download sample and sourcecode. This entry was posted in Uncategorized. Bookmark the [...]

  21. [...] 소스는 >원문에서 다운받을 수 있습니다. 이제 as source를 보면서 알고리즘을 [...]

  22. heart says:

    i try make easy game from your code

    please try it :P

  23. Bruno says:

    Wow! amazing!!
    great job!!

  24. radu says:

    This is like the Kinect

  25. alf says:

    Zip files and links to not work

  26. Thibault Imbert says:

    Hi alf,

    Sorry, links fixed!


  27. sikeda says:

    I am trying to apply this class to map project. I was able to track wheel.x and wheel.y, but it is not linked to mouse movement/clicks. How do I do that??

  28. Erik Eide says:

    [...] A last word on the technique of this object: it’s based on Didier Brun’s work for the “mouse” object, you can see his work here. [...]

  29. [...] of this object. It’s based, for the “mouse” part, on Didier Brun’s RGB Wheel Tracker. The musical part is based on the work of Soul Wire and his AS3 particle node sequencer. With a [...]

  30. Matt says:

    Is it possible to track two different wheels? Perhaps by using 3 different colors instead of RBG?

    BTW I really like the sweater you’re wearing :D

Leave a Reply

Open Sort Options

Sort comments by:
  • * Applied after refresh
Fun with code since 2006.