RGB Wheel Tracker

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 :  http://www.bytearray.org/wp-content/projects/wheeltracker/rgb_wheel_model.pdf

Live demo : http://www.bytearray.org/wp-content/projects/wheeltracker/wheel_track_demo.swf

Sources : http://www.bytearray.org/wp-content/projects/wheeltracker/sources.zip

Comments (26)

  1. WOW!!
    Its gorgeous!

    Thursday, April 14, 2011 at 7:53 pm #
  2. dgezeo wrote:

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

    Thursday, April 14, 2011 at 7:56 pm #
  3. Seraf_NSS wrote:

    excellent Didier

    Thursday, April 14, 2011 at 8:05 pm #
  4. JabbyPanda wrote:

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

    Great inspirational stuff!

    Thursday, April 14, 2011 at 10:19 pm #
  5. Fardeen wrote:

    Excellent !

    Friday, April 15, 2011 at 1:54 am #
  6. stf wrote:

    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 !

    Friday, April 15, 2011 at 3:21 am #
  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?

    Friday, April 15, 2011 at 6:05 am #
  8. Andre G wrote:


    Friday, April 15, 2011 at 6:59 am #
  9. thomas wrote:

    Vraiment cool !

    ça me fait penser a un vieux projet “Wiiless, la wiimote pour les pauvres” : http://code.google.com/p/wiiless/wiki/First_Demos

    Friday, April 15, 2011 at 9:48 am #
  10. karlitodelacasa wrote:

    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

    Friday, April 15, 2011 at 10:58 am #
  11. karlitodelacasa wrote:

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

    Friday, April 15, 2011 at 11:08 am #
  12. The accuracy is great, very nice job mate!

    Friday, April 15, 2011 at 11:32 am #
  13. Simon wrote:

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

    Friday, April 15, 2011 at 4:50 pm #
  14. Simon wrote:

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

    Friday, April 15, 2011 at 4:56 pm #
  15. Hello guys, thanks for your comments :)

    You can adjust these constants in the RGBWheelTracker.as 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.

    Friday, April 15, 2011 at 7:38 pm #
  16. Brian wrote:

    Amazing. again.

    Friday, April 15, 2011 at 8:13 pm #
  17. Francis wrote:

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

    Friday, April 15, 2011 at 9:09 pm #
  18. jloa wrote:

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

    Saturday, April 16, 2011 at 2:38 pm #
  19. heart wrote:

    i try make easy game from your code


    please try it :P

    Monday, April 18, 2011 at 7:39 pm #
  20. Bruno wrote:

    Wow! amazing!!
    great job!!

    Saturday, April 23, 2011 at 10:04 pm #
  21. Behrouz wrote:

    Perfect :D

    Tuesday, April 26, 2011 at 11:58 pm #
  22. radu wrote:

    This is like the Kinect

    Friday, May 6, 2011 at 9:52 am #
  23. alf wrote:

    Zip files and links to didierbrun.com not work

    Thursday, May 24, 2012 at 3:23 pm #
  24. Thibault Imbert wrote:

    Hi alf,

    Sorry, links fixed!


    Friday, May 25, 2012 at 10:38 am #
  25. sikeda wrote:

    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??

    Wednesday, November 28, 2012 at 8:43 pm #
  26. Matt wrote:

    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

    Thursday, June 26, 2014 at 8:14 pm #

Trackbacks/Pingbacks (6)

  1. Daily Digest April 15th on Friday, April 15, 2011 at 8:23 pm

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

  2. [...] Et le lien : http://www.bytearray.org/?p=3027 [...]

  3. RGB Wheel Tracker | howdoflash.com on Monday, April 18, 2011 at 10:54 am

    [...] detail you can read at  http://www.bytearray.org/?p=3027 you can try download sample and sourcecode. This entry was posted in Uncategorized. Bookmark the [...]

  4. ByteArray.org : RGB Wheel Tracker 분석 | Lovelyredsky on Monday, April 18, 2011 at 6:28 pm

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

  5. Erik Eide on Sunday, May 19, 2013 at 9:26 pm

    [...] 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. [...]

  6. branch_ | Erik Eide on Friday, June 7, 2013 at 10:20 pm

    [...] 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 [...]