/** * Experiments with edge detection, D. Parson, May 2017. * See https://processing.org/examples/edgedetection.html, * https://processing.org/reference/filter_.html **/ //<>// PImage img, mask, bkgrnd ; void setup() { size(1500, 1000, P2D); frameRate(16); // fullScreen(P2D); background(0); } void draw() { if (img == null) { img = loadImage("Mud.jpg"); // Load the original image bkgrnd = loadImage("Hex306090B.png"); mask = loadImage("Pattern.jpg"); img.resize(width, height); mask.resize(width, height); mask.filter(GRAY); //mask.filter(THRESHOLD,0.5); // mask.filter(BLUR,2); // mask.filter(POSTERIZE,8); img.mask(mask); // img.filter(INVERT); } // FILTERING HERE CHANGES THE ACTUAL PImage img.filter(POSTERIZE, (frameCount % 18)+2); //if ((frameCount % 16) <= 7) { // img.filter(ERODE); //} else { // img.filter(DILATE); //} image(bkgrnd, 0, 0, width, height); image(img, 0, 0, width, height); // filter(BLUR, constrain(16 - abs(32-pframenum), 0, 16)); //filter(POSTERIZE, (frameCount % 18)+2); // filter() here filters the entire display so far // filter(GRAY); //filter(THRESHOLD, 0.75); // filter(ERODE); // Just one application of ERODE or DILATE don't make much change. // But if you apply them repeatedly to the PImage, change is incremental // filter(INVERT); // filter(BLUR,10); println("frameRate = " + frameRate); }