ICM midterm
Not what I was going for at all, but below are images from my video capture. Here is the code and the rest of the applet.
Here are some shots:
It’s a stable background, when you move about, you wipe away the background with a video of you, that fades away over time.
What I thought I wanted to work on is a fiery background with you as the water blob in the foreground. or something – or at least a manipulatable background.
For the final…
Here is the code:
float angle = 0;
import processing.video.*;
import blobDetection.*;
float col=random(0,255);
Capture cam;
Shape [] myShapes = new Shape[100];
//Bauble[] baubles;
BlobDetection theBlobDetection;
PImage img;
PImage fireIMG;
boolean newFrame=false;
EdgeVertex eA,eB;
Blob b;
int radius;int blurVar;
int blurChanger=5;PImage myImage;
PImage buffer;void setup()
{
// Size of applet
size(640, 480, P3D);
// Capturecam = new Capture(this, width, height, 15);
buffer = createImage(cam.width, cam.height, ARGB);
myImage = loadImage(“drops.jpg”);
fireIMG = loadImage(“firephoto10.JPG”);// BlobDetection
// img which will be sent to detection (a smaller copy of the cam frame);
img = new PImage(80,60);theBlobDetection = new BlobDetection(img.width, img.height);
theBlobDetection.setPosDiscrimination(true);
theBlobDetection.setThreshold(0.2f); // will detect bright areas whose luminosity > 0.2f;if (eA !=null && eB !=null) {
for (int i = 0;i=5 || blurVar<=0) //{blurChanger*=-1; //} //myImage.filter(BLUR,1); //myImage.filter(DILATE); } void fastblur(PImage img,int radius) { if (radius<1) { return; } int w=img.width; int h=img.height; int wm=w-1; int hm=h-1; int wh=w*h; int div=radius+radius+1; int r[]=new int[wh]; int g[]=new int[wh]; int b[]=new int[wh]; int rsum,gsum,bsum,x,y,i,p,p1,p2,yp,yi,yw; int vmin[] = new int[max(w,h)]; int vmax[] = new int[max(w,h)]; int[] pix=img.pixels; int dv[]=new int[256*div]; for (i=0;i<256*div;i++) { dv[i]=(i/div); } yw=yi=0; for (y=0;y >16;
gsum+=(p & 0x00ff00)>>8;
bsum+= p & 0x0000ff;
}
for (x=0;x>16;
gsum+=((p1 & 0x00ff00)-(p2 & 0x00ff00))>>8;
bsum+= (p1 & 0x0000ff)-(p2 & 0x0000ff);
yi++;
}
yw+=w;
}for (x=0;x
300&&distance<400)) { color c = color(r * colorfactor, g*colorfactor, b*colorfactor*2, 200); buffer.pixels[location] = c; // if(distance<400) // // {tint(0,0,255,50); // image(myImage,0,0,width,height); //// myImage=loadImage("drops.jpg"); //// myImage.loadPixels(); // // } //makeTurbulence(mouseX, mouseY); } else { float rb = red (buffer.pixels[location]); float gb = green (buffer.pixels[location]); float bb = blue (buffer.pixels[location]); float ab = alpha (buffer.pixels[location]); float amod = ab - 4; if (amod < 0) { amod = 0; } //float rbMod = 1; //rb=rb+rbMod; color c = color(rb*2, gb, bb, amod); buffer.pixels[location] = c; } } } } buffer.updatePixels(); //buffer.filter(BLUR,10); buffer.filter(ERODE); //buffer.filter(POSTERIZE,100); // buffer.filter(ERODE); tint(255,255,255,255); image(buffer,0,0); } //FLIP THE IMAGE //make the rects move //put in dropp effect etc void drawRect() { float xx = eA.x*width+random(-2,2); float yy = eB.y*height+random(-2,2); noStroke(); // fill(0,0,0,100); tint(255,255,255,100); image(myImage,xx,yy, 40,40); //HOW DTO MAKE IT ExpANd??? must i put a delay? xx = xx+1; yy=yy+1; } void drawShape(){ if (eA !=null && eB !=null) { for (int j = 0; j (width – 1) – radius ? (width – 1) – cx : radius;
int top = cy < radius ? -cy + 1 : -radius; int bottom = cy > (height – 1) – radius ? (height – 1) – cy : radius;for (int x= right;x>left;x–){
int xsqr = x * x;for (int y=bottom;y>top;y–){
if ((xsqr) + (y * y) < r) heightMap[page ^ 1][cx + x][cy + y] += turbulenceMap[radius + x][radius + y]; // water.set(x,y,turbulenceMap[radius + x][radius + y]); //<<<-- kick do not update water here } } }*/ class Shape { float xPos; float yPos; float rectSize; float myColor; Shape(float _xPos, float _yPos, float _rectSize, float _myColor){ xPos = _xPos; yPos = _yPos; rectSize = _rectSize; myColor=_myColor; } void drawShape() {noStroke(); fill(255,255,255, 150); ellipse(xPos, yPos, rectSize*2, rectSize*2); } void moveShape() { xPos = xPos-1; yPos = yPos-1; } }