/*Drew Cogbill Image 4.1 [computation08]*/ //This program loads an image and uses filter()s to alter it //To look at the different filters, hold down numbers 1-7 PImage bottles; PFont font; void setup() { size(500 ,375); bottles = loadImage("bottles.jpg"); font = loadFont("arialblack.vlw"); textFont(font); fill(240, 5, 5); } void draw() { image(bottles, 0, 0); if ((keyPressed == true) && (key == '1')) { image(bottles, 0, 0); filter(BLUR, 4); text("BLUR", 20, 250); } else if ((keyPressed == true) && (key == '2')) { image(bottles, 0, 0); filter(POSTERIZE, 4); //Posterize limits each channel to a number of colors text("POSTERIZE", 20, 250); } else if ((keyPressed == true) && (key == '3')) { image(bottles, 0, 0); filter(THRESHOLD, 0.5); //Threshold converts to black and white depending if a pixel is //above or below a certain level text("THRESHOLD", 20, 250); } else if ((keyPressed == true) && (key == '4')) { image(bottles, 0, 0); filter(INVERT); text("INVERT", 20, 250); } else if ((keyPressed == true) && (key == '5')) { image(bottles, 0, 0); filter(GRAY); text("GRAY", 20, 250); } else if ((keyPressed == true) && (key == '6')) { image(bottles, 0, 0); filter(ERODE); //Erode reduces the light areas text("ERODE", 20, 250); } else if ((keyPressed == true) && (key == '7')) { image(bottles, 0, 0); filter(DILATE); //Dilate increase the light areas text("DILATE", 20, 250); } }