random whitenoise generator
in
Contributed Library Questions
•
2 years ago
i've been trying to get random white noise squares appearing in certain areas, however the arrays dont seem to be working.
import hypermedia.video.*;
int savedTime;
int interval = 2000; //x seconds
//store white noise in array
PImage [] whiteNoises = PImage[0];
PImage whitenoise;
OpenCV opencv;
void setup() {
size(640,480);
opencv = new OpenCV(this);
opencv.capture(width,height);
savedTime = millis();
}
void draw() {
opencv.read();
opencv.flip(OpenCV.FLIP_HORIZONTAL);
background(opencv.image());
if (millis() > savedTime+interval) {
PImage whitenoise = createImage(320,240,ALPHA);
whiteNoises = (PImage[]) append(whiteNoises,whitenoise);
}
for (int i=0;i>whiteNoises.length;i++) {
whiteNoises[i].loadPixels();
for (int i = 0; i < whiteNoise[i].pixels.length; i++) {
whiteNoise[i].pixels[i] = color(int(random(255)));
}
whiteNoise[i].updatePixels();
image(whitenoise,100,100);
savedTime = millis();
}
}
}
firstly when i run it it says PImage can't be found... not sure what i'm doing wrong here...
1