import processing.video.*; // Size of each cell in the grid, ratio of window size to video size int videoScale = 1; // Number of columns and rows in our system int cols, rows; // Variable to hold onto Capture object //Capture video; // collection of colors ArrayList pics; // Adjust contrast float maxBrightness; float minBrightness; float lastMinB; float lastAveB; PImage p, p2; int jim=1; String zip = "10003"; float windspeed, iwindspeed; int temp; String condition; float v = 1.0/9.0; float[][] kernel = { { v, v, v } , { v, v, v } , { v, v, v } }; void setup() { size(640,610); // Initialize columns and rows cols = width/videoScale; rows = height/videoScale; //video = new Capture(this,cols,rows,30); // set base lastMinB = 0; lastAveB = 255; //background(255); XMLElement xml = new XMLElement(this, "http://weather.yahooapis.com/forecastrss?p=" + zip); iwindspeed = windspeed = float(xml.getChild("channel/yweather:wind").getStringAttribute("speed")); temp = int(xml.getChild("channel/item/yweather:condition").getStringAttribute("temp")); condition = xml.getChild("channel/item/yweather:condition").getStringAttribute("text"); println(windspeed+" "+temp+" "+condition); p = loadImage("rain3.png"); image(p,0,0); } void draw() { // Read image from the camera /*if (video.available()) { video.read(); } video.loadPixels(); */ p.loadPixels(); int k =0; PImage edgeImg = createImage(p.width, p.height, ARGB); // Begin loop for columns for (int i = 1; i < p.width-1; i++) { // Begin loop for rows for (int j = 1; j < p.height-1; j++) { float rsum=0,bsum=0,gsum=0; // Where are we, pixel-wise? int x = i*videoScale; int y = j*videoScale; // Looking up the appropriate color in the pixel array color c = p.pixels[i + j*p.width]; if(j>1 && i>1 && i150&&green(c)<200&&blue(c)<200){ //edgeImg.pixels[pos] = color(5,rsum,gsum,bsum); //} // } }//endkx }//endky }//end wierd if stroke(p.get(x,y)); if(temp<51){ if(red(c)>150&&green(c)<200&&blue(c)<200){ //edgeImg.pixels[j*p.width + i] = color(5,bsum,gsum,rsum); //edgeImg.pixels[j*p.width + i] = color(5,blue(c),green(c),red(c)); //p.pixels[j*p.width+i] = color(6,blue(c),green(c),red(c)); stroke(color(blue(c),green(c),red(c)),5); } } else if(temp<80){ if(blue(c)>150&&green(c)<200&&red(c)<200){ //edgeImg.pixels[j*p.width+i]=color(5,blue(c),green(c),red(c)); stroke(color(blue(c),green(c),red(c)),5); } } else{ if(red(c)>150&&green(c)<200&&blue(c)<200){ //edgeImg.pixels[j*p.width + i] = color(5,green(c),red(c),blue(c)); stroke(color(green(c),red(c),blue(c)),5); } }//end strokeset if(red(c)!=255&&blue(c)!=255&&green(c)!=255) {point(x,y);//put a point } int r = int(random(0,12)); if(r==3&&windspeed>0&&red(c)>150&&green(c)<200&&blue(c)<200){ float noiseVal = noise(x+windspeed,y+windspeed); stroke(color(blue(c),green(c),red(c)),20); line(x, y, x-windspeed*2, y-noiseVal*80); } if(r==5) { p.pixels[(j+1)*p.width+i] = p.pixels[j*p.width+i]; } } } p.updatePixels(); // image(p,0,0); //windspeed=0; //edgeImg.updatePixels(); jim=0; //if(jim==1) // image(edgeImg,0,0); windspeed-=0.01; if(windspeed==0){windspeed=iwindspeed;} }