|
Author |
Topic: Highest color in a video feed? (Read 487 times) |
|
cereals
|
Highest color in a video feed?
« on: May 13th, 2004, 1:34am » |
|
I was wondering if there was a really quick way to find the highest color in a video feed? I would of thought this might work, but I am doing something wrong.. anychance of any pointers? Code: BImage img; color bright=color(0, 0, 0); void setup() { size(320, 240); background(0); ellipseMode(CENTER_DIAMETER); noStroke(); img = loadImage("pipes.gif"); delay(20); } void loop() { image(img, 0, 0); for(int i=0; i<width; i++){ for(int z=0; z<height; z++){ color col = pixels[(i*width)+z]; // if(red(col)>=red(bright) && green(col)>=green(bright) && blue(col)>=blue(bright)){ bright = col; } } } // do something here } |
|
|
|
|
|
Robert in a bus Guest
|
Re: Highest color in a video feed?
« Reply #1 on: May 13th, 2004, 7:12pm » |
|
Have you tried using 'brightness'? Instead of checking each pixel for red, blue, and green values, just check the brightness.. http://processing.org/reference/brightness_.html -r
|
|
|
|
Robert in a bus Guest
|
Re: Highest color in a video feed?
« Reply #2 on: May 13th, 2004, 7:38pm » |
|
Oh, I think I see the problem. Right now, your 'i' variable represents the number of columns you have scanned so you need to multiply i * height instead of width to get the proper pixel. (i think... haven't had nearly enough coffee yet today.) -r
|
|
|
|
kevinP
|
[OT comment] Was: Highest color in a video feed?
« Reply #3 on: May 13th, 2004, 7:51pm » |
|
Robert in a bus writes: [...] Those wireless WLAN cards are becoming more powerful every day.
|
Kevin Pfeiffer
|
|
|
flight404
|
Re: Highest color in a video feed?
« Reply #4 on: May 13th, 2004, 10:53pm » |
|
Heh... the beauty of the Limoliner to and from NYC. Wireless internet rulz!!!!
|
|
|
|
|