//Alcys_Convolutions //credit: Edge Detection by REAS // http://www.dunwich.org/batiste/sic/ecms/ecfrfull.html // et un certain A.Warhol BImage a; BImage[] tampon; int w, h, coefficient1, coefficient2,nuro; int[] cc, dd; float za, zb,cza,czb, angle, incangle; void setup() { a= loadImage("acc.jpg"); w= a.width; h= a.height; //size(3*w, 2*h); size(465,430); za= 1.00051f;cza=0.0005f; zb= -3;czb=0.01f;nuro=0; angle= 0.2f; incangle= 0.14f; cc= new int[] { 0x339999, 0x120000, 0x000001, 0x887979, 0x1c1c1c, 0x000101}; dd= new int[] { 0xf01130, 0xf0f0f0, 0x606060, 0xc0b4b3, 0xd4d4d4, 0xf0f0f0 }; tampon= new BImage[6]; for (int i= 0; i < 6; i++) { tampon[i]= new BImage(w, h); } } // °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° void loop() { clear(); angle += incangle; za= 1.0f - cza * sin(angle); zb= -3.0f - czb* cos(angle); calculerTampon(); for(int i=0;i<3;i++){ for(int j=0;j<2;j++){ tampon[nuro].alpha(tampon[i]); set( i*w,j*h,tampon[i+3*j ]); }} } // °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° void calculerTampon() { for (int i= 0; i < 6; i++) { coefficient1= cc[i]; coefficient2= dd[i]; for (int y= 0; y < a.height; y++) { for (int x= 0; x < a.width; x++) { float somme= zb * filtre(x, y) + za * (filtre(x - 1, y) + filtre( x + 1, y) + filtre( x, y - 1) + filtre( x, y + 1)); tampon[i].pixels[x + w * y]= Math.round(somme); } } } } //°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° float filtre(int x, int y) { x= (x < 0) ? 0 : x; x= (x >= a.width - 1) ? a.width - 1 : x; y= (y < 0) ? 0 : y; y= (y >= a.height - 1) ? a.height - 1 : y; return (coefficient1 | (coefficient2 & a.get(x, y))); } //°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° void mouseReleased() { czb=cos( mouseX / width); cza=sin( mouseY / height); nuro=int(mouseX/170)+3*(mouseY/240);println(nuro); } // °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° //°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°