We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Detect bunch of colors
Page Index Toggle Pages: 1
Detect bunch of colors (Read 491 times)
Detect bunch of colors
Apr 16th, 2009, 1:36am
 
Hi,

I want to use colored paper on a wall and read there x and y coördinates. To do this I will use a webcam.

...

I was only wondering if someone has tips of how to detect a bunch of colors. I know in the processing book there is a script for detecting the brightest pixel, I could change it to search for a hue value but it has to detect more then 1 pixel.
Re: Detect bunch of colors
Reply #1 - Apr 16th, 2009, 1:58am
 
Hi there,

Welcome to the world of blob detection. You are going to bump into some problems along the way:

  • Webcams have small lenses, so you get quite a bit of noise depending on the lighting conditions. To reduce noise, a good (and fast) algorithm is a median filter. Do a google search for it. You will find lots of code examples.
  • Another problem is that webcams are often not very stable on colour, so you might not find your 'yellow box', because it might be slightly red or green. You have to create some kind of algorithm to detect things that are 'reddish' or 'yellowish' by comparing red/green/blue values.
  • Detecting boxes: For detecting boxes or objects in general, best way is to use a blob-detection algorithm. You can either use an existing processing library or write your own. A good point to get you started is the article by Eric van Kempen. Do a google search for "Blob detection V: growing regions algorithm"

Creating interactive pieces with webcams can be painful, but very rewarding! I've used webcam as input on several pieces, and they have always been very succesful!
If you are curious about these examples, try a google search for youtube "One vs 20,000" or youtube "I, Ball".

Good luck with it,

Marcus.
Re: Detect bunch of colors
Reply #2 - Apr 16th, 2009, 2:46am
 
whaha those movies are nice, for who's intrested:

1 vs 20.000
http://www.youtube.com/watch?v=53FuBPUy8xY

I'ball
http://www.youtube.com/watch?v=ptRsUJU7Q7c&feature=related

thx for the article I will read it asap.
Page Index Toggle Pages: 1