It might be fairly straight forwards to do, if you've written a nice particle class, but slightly more difficult if you're just using arrays.
If you want to have a fixed set of particles (320x240 of them) and update them based on the webcam, then it should be easy, and would go something like:
Code:myParticleClass Particles=new myParticleClass[320*240];
//in setup()
for(int i=0;i<Particles.length;i++)
{
Particles[i]=new Particle(i%320,i/320,0);
// assuming you've got arguments of x position, y position, colour
}
//in draw
webCamImage.loadPixels();
for(int i=0;i<webCamImage.pixels.length;i++)
{
//update the colour of the particle that
// represents this pixel
Particles[i].colour=webCamImage.pixels[i];
}
If you're just using a bunch of arrays to store them it's slightly more complex setup, but the update is almost the same:
Code:float[] particlesX=new float[320*240];
float[] particlesY=new float[320*240];
color[] particlesColor=new color[320*240];
//in setup
for(int i=0;i<320*240;i++)
{
particlesX[i]=i%320;
particlesY[i]=i/320;
particlesColor[i]=0; // start off black since no image yet
}
//in draw
webCamImage.loadPixels();
for(int i=0;i<webCamImage.pixels.length;i++)
{
particlesColor[i]=webCamImage.pixels[i];
}
Of course you'll have to do any movement code for yourself, but this should at least let you assign the colours to the particles for whatever use you want.