Playing around with webcam input again. No matter how far I stray, I always make my way back to Processing with vim and vigor.
This started out as an exploration into compression theory and blah blah, of course I got caught up on a tangent. So here is what is going on.
It is just a basic difference algorithm. But I am going about it in a different way than I used to. I bring in a webcam image and make a tiny copy of it. I analyze the copy pixel by pixel and store the red, gree, blue, hue and saturation data for each pixel. Every frame, I compare this data with the previous frame and see how much of a difference has occured between frames. If the difference is large enough, I take the position of the pixel being analyzed, scale it up back to the proportions of the original webcam image, and then copy over that portion of the original image to an image that is drawn onto the screen every frame.
The end result is a bit messy, especially if the thresholds are set really high, and you end up with phantom squares. I wanted to see which of my thresholds were being hit the most (I have a suspicion its hue combined with a r, g, or b value) so I added some colored squares.
Of course this ended up distracting me from my original goal. I got mesmerized by the purty purty lights.
I will get back to the original point eventually.