PImage myPhoto; int myPhotoWidth, myPhotoHeight; void setup() { size(500,750); //Thanks for http://gahag.net/004881-high-school-girl/ myPhoto = loadImage("Test.jpg"); myPhotoWidth = myPhoto.width; myPhotoHeight = myPhoto.height; noStroke(); smooth(); background(0); myPhoto.loadPixels(); } void draw() { background(0,0,100); int x; int y; for(x=0;x<myPhoto.width;x+=5){ for(y=0;y<myPhoto.height;y+=5){ strokeWeight(random(1,3)); float f=random(0.5,1); stroke(red(myPhoto.pixels[y*width + x])*f,green(myPhoto.pixels[y*width + x])*f,blue(myPhoto.pixels[y*width + x])*f); float r0=random(5, 15); float r1=random(5, 15); float th0=random(0, 2*PI); float th1=random(0, 2*PI); float dx=random(-5, 5); float dy=random(-5, 5); line(r0*cos(th0)+x+dx, r0*sin(th0)+y+dy, r1*cos(th1)+x+dx, r1*sin(th1)+y+dy); }} }
2017年5月2日火曜日
画像データの値を取得
こちらを参考に作成。面白い。
登録:
投稿 (Atom)