## Color Tracking Algorithm

Hi,

@Dj_Sures 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, Prenil

Elevate your robot's capabilities to the next level with Synthiam ARC Pro, unlocking a world of possibilities in robot programming.

#1

Here is a great place to learn about computer (and robot) object (and color) recognition.

Alan

PRO
Synthiam
#2

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.

#3

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

#4

Not free (but there is a trial), but another application to explore object detection with is Roborealm http://www.roborealm.com/

d.cochran uses it in his EZ-AI and other projects because it can communicate to ARC and gives more accurate recognition of complex objects.

This thread gives a good description of how he is using it without getting into all the complex details of the EZ-AI thread: https://synthiam.com/Community/Questions/7220

Alan

#5

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

##### Posting community content is currently offline as we upgrade our servers!

ðŸš€ Get ready for exciting new features with ARCx! From July 28th to August 3rd 2024, content posting is on a brief vacation, but you can still read existing posts.