Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import processing.video.*;
- Capture cam;
- void setup() {
- size(480,480);
- initVideo();
- }
- void draw() {
- PImage img = captureImage();
- for (int i=0; i<2000; i++) {
- float x = random(width);
- float y = random(height);
- color col = img.get(int(x), int(y));
- float sz = random(5, 15);
- colorMode(HSB,360,100,100);
- float h = hue(col);
- float b = brightness(col);
- fill(h,0,b,150);
- noStroke();
- ellipse(width-x, y, sz, sz);
- }
- //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