This is part of a Processing project I’m currently working on. This sketch allows the user to select colours from webcam input. The input is then analysed and a rectangle is drawn around all pixels close to the chosen colour. Up to 2 colours can be used for this sketch. This is similar to the getColorBoundsRect() method in the BitmapData class in Flash.
Click here to see the video on Vimeo
You can download the source code below:
colour_detection.pde, CoordsCalc.pde
Be aware though that in order to use it you should be in a well lit room with a good quality webcam. You might also need to fine tune your webcam settings. To select a colour, place your object in the red box in the bottom right hand corner of the frame and press 1 or 2.
Keys:
p to view the rectangles
1 to select the first colour
2 to select the second colour
0 to reset colours




Brilliant as usual. Love it.
I love it. Imagine a photo app where you can “swim” through your photos. Or going to NYT.com and being able to flip through articles, sorted and “stacked” by their importance and categories.
A bit like this – http://uk.youtube.com/watch?v=7CoJGrtVs4c – you mean. It would be fun to have it as an option although I imagine you arms would suffer as a result
Using colour isn’t the way to achieve this though as environmental differences (lighting/colour) would cause problems. Infrared is the way forward if considering this sort of interaction. Hopefully I should be looking into this area using a Wiimote at some stage.
What is the license for this code?
Been looking for something like this, thanks
Feel free to use it at your leisure Mike. Credit would be nice but don’t feel pressured
I’d be interested to see what you make with it
beautifull
hey how to build the source ??
thnks
Thanks kvnxp. You need to use Processing – http://processing.org/download/