Sunday, February 16, 2014

Convolution Algorithm

The leftmost images are the convoluted images with the rights being the originals.

 
PImage img;
int a, b;

void setup() {
  size(900, 900);
  img = loadImage("sun.png");
  a = 8;
  b = 30;
  imageMode(CENTER);
  noStroke();
  background(255);
}

void draw() { 
  float pixel = map(25, 0, width, a, b);
  int x = int(random(img.width));
  int y = int(random(img.height));
  color pix = img.get(x, y);
  fill(pix, 128);
  rect(x, y, pixel, pixel);
}
These two images were creating using the above image convolution algorithm written
in processing.

No comments:

Post a Comment