color detection through webcam that makes video play.


I am a total newbie and have a question for you guys.

I'm working on a project with processing.

Its an sort of input-output project. What I'm planning to do is the following: Color detection through the webcam (macbook pro) - the webcam detects the most prominent color. That should be connected to a database I created with videos in it, the names of the video have got names of a certain color.

so for example: When the webcam detects mostly red, the video with with named 'red' should pop-up and start to play..

Is this possible in any way? and can someone help me with a code for this?

thanks big time!


  • @fountain2:: you can do that; as for trying begin with some image (not capture); the way to achieve what you want would be the same but you can more easily verify (using images created by yourself and mainly red or green or blue). Then you have to decide what is your color table (3 colors, six colors...) and precise the conditions: "orange" is when red is more than, and green is less than and blue is more or less than...For that (which is arbitrary except in the case of pure red or pure green or pure blue) you can refer to the color selector. Then you loadPixels() from this image, and extract red() & green & blue values (rgb mode): so you can easily construct a (very) simple histogram and see wether the image is "more red" or "more green" or "more blue" or more orange or pink!

Sign In or Register to comment.