Pixel Sampling of video

There is a particular effect I am trying to simulate

It involves first

1 sampling the brightness of pixels and then

2 creating particles whose behaviour is determined from #1

So I am focusing on the first step for now. Using OF how would you sample pixels in an efficient manner from a live webcam stream?

Check out particles from color examples code, plenty available online.

To sample pixel brightness, see these examples, among others

particles!: GPU particle System with multitexturing and optical flow


thanks. much appreciated

If it is your webcam, you could write something like:

ofVideoGrabber cam;
ofPixels pixels;
cam.initGrabber(1200, 750);

the camera already has a pixels internally so you don’t need to readback from the texture which is really slow, you can cal:


cool, I didn’t know it