Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PImage myImage;
- color col;
- float sw, br, incr;
- PVector ray;
- void setup() {
- background(0);
- colorMode(HSB, 100);
- myImage = loadImage("http://media-cache-ak0.pinimg.com/736x/d2/49/ac/d249ac18b4a86e9a6383e5c2909eabf1.jpg");
- size(myImage.width, myImage.height);
- myImage.loadPixels();
- incr = 5;
- image(myImage, 0, 0);
- ray = new PVector(random(1,2), random(1,2));
- ray.normalize();
- ray.mult(int(random(10,150)));
- for (int x = 0; x<width; x += incr) {
- for (int y = 0; y < height; y += incr) {
- col = myImage.pixels[y*width+x];
- sw = map(brightness(myImage.get(x, y)), 0, 100, 20, 40) ;
- br = brightness(myImage.get(x, y));
- println(ray);
- if (br>50) {
- stroke(myImage.get(x, y), random(255));
- strokeWeight(1);
- line(x, y,x+ray.x,y-ray.y);
- }
- }
- }
- }
- void draw() {
- }
- void keyPressed() {
- save(random(123)+".png");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement