Welcome to Synthiam!

The easiest way to program the most powerful robots. Use technologies by leading industry experts. ARC is a free-to-use robot programming software that makes servo automation, computer vision, autonomous navigation, and artificial intelligence easy.

Get Started
South Africa
Asked — Edited

Color Tracking Algorithm


First, I've been playing around with my JD revolution and I've really enjoyed the camera tracking functions (thank you !).
Out of an interest in understanding how these things actually work, I was wondering how exactly the color recognition is done? Is it a clustering algorithm or is a different method used? Would be able to recommend any source from which I could learn more about robot perception and color recognition?

Thank you,


Upgrade to ARC Pro

Unleash your creativity with the power of easy robot programming using Synthiam ARC Pro

My color tracking method comes in two fashion. The first is single color, where you specify red green or blue. The second type is multi color, where I filter on color range and brightness etc.

With the first one, i loop through the data of an image starting at the memory address pointer. I loop for the number of pixels based on image size (width x height), and the pixel width - which is the number of colors. For example, we use argb32 format. Meaning each pixel is 32 bits (4 bytes) and the first byte is alpha channel, red, green and finally blue, respectively.

If red is selected to look for, I scan and extract only the red pixels within the range. I know if its red because the red value is higher than green and blue - also there's a slider to specify "how much greater".

Once I have a collection of only the red pixels, I now use the aforge blob function - which is the reason aforge library is used. I would have written my own blob, but theirs is great and why not give them some props for their great work.

The blob function looks through a data set and extracts information about blobs within it. A slider lets you choose the minimum size of a blob

I then sort the blobs by size of largest to smallest

Now I have a list of locations where there are chunks of red on the image.
Thank you very much @DJ! Your approach seems much more elegant than some of those I've read through. Also, I'm looking at their blob function right now and it does look very well done

@thetechguru this website is really good, I can't believe I hadn't stumbled upon it already, thank you:)

P.S. my user name has changed a little because I was having problems with my email
@Alan: thank you for that, roborealm is some really awesome software and the interface with ARC makes it even better!

@DJ_Sures: Do you, by any chance, know if AForge uses differential methods or extrema to detect their blobs?