Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import processing.video.*;
- Capture cam;
- color col = #ffffff;
- void setup() {
- size(480, 480);
- initVideo();
- background(255);
- }
- void draw() {
- PImage img = captureImage();
- for (int i=0; i<2000; i++) {
- float x = random(width);
- float y = random(height);
- if (x>width/2) {
- col = img.get(int(x), int(y));
- float sz = random(5, 15);
- float h = hue(col);
- float b = brightness(col);
- float s = saturation(col);
- b = b>40?200:0;
- colorMode(HSB, 360, 100, 100);
- fill(h, s, b, 150);
- noStroke();
- ellipse(x, y, sz, sz);
- ellipse(width-x, y, sz, sz);
- }
- }
- filter(DILATE);
- //saveFrame("image-###.gif");
- }
- void initVideo() {
- cam = new Capture(this, 640, 480, 30);
- cam.start();
- }
- PImage captureImage() {
- if (cam.available()) {
- cam.read();
- }
- return cam;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement