Advertisement
xeromino

split

Jan 5th, 2015
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. import processing.video.*;
  2.  
  3. Capture cam;
  4. color col = #ffffff;
  5.  
  6. void setup() {
  7. size(480, 480);
  8. initVideo();
  9. background(255);
  10. }
  11.  
  12. void draw() {
  13. PImage img = captureImage();
  14. for (int i=0; i<2000; i++) {
  15. float x = random(width);
  16. float y = random(height);
  17. if (x>width/2) {
  18. col = img.get(int(x), int(y));
  19. float sz = random(5, 15);
  20. float h = hue(col);
  21. float b = brightness(col);
  22. float s = saturation(col);
  23. b = b>40?200:0;
  24. colorMode(HSB, 360, 100, 100);
  25. fill(h, s, b, 150);
  26. noStroke();
  27. ellipse(x, y, sz, sz);
  28. ellipse(width-x, y, sz, sz);
  29. }
  30. }
  31. filter(DILATE);
  32. //saveFrame("image-###.gif");
  33. }
  34.  
  35. void initVideo() {
  36. cam = new Capture(this, 640, 480, 30);
  37. cam.start();
  38. }
  39.  
  40. PImage captureImage() {
  41. if (cam.available()) {
  42. cam.read();
  43. }
  44. return cam;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement