Skip to content

Instantly share code, notes, and snippets.

@todocono
Last active December 1, 2022 06:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save todocono/784868a1c941a10a30d767c9434afc48 to your computer and use it in GitHub Desktop.
Save todocono/784868a1c941a10a30d767c9434afc48 to your computer and use it in GitHub Desktop.
import processing.video.*;
String[] cameras = Capture.list();
Capture liveFeed;
float angle =0;
void setup() {
size(1280, 960);
printArray(cameras);
liveFeed = new Capture(this, "pipeline:autovideosrc");
liveFeed.start();
noStroke();
}
void draw() {
if (liveFeed.available()) {
liveFeed.read();
}
//webcam feed top left
push();
imageMode(CENTER);
translate(450, 350);
scale(1);
rotate(radians(-angle));
tint(255, 0, 255);
image(liveFeed, 0, 0);
tint(255, 255, 255);
pop();
push();
imageMode(CENTER);
translate(200, 300);
scale(0.75);
rotate(radians(-angle));
tint(0, 255, 0);
image(liveFeed, 0, 0);
tint(255, 255, 255);
pop();
push();
scale(0.5);
imageMode(CENTER);
translate(320, 240);
rotate(radians(angle++));
tint(255, 0, 0);
image(liveFeed, 0, 0);
tint(255, 255, 255);
pop();
//webcam feed top right
//image(liveFeed, 640, 0);
for (int i=0; i<10000; i++) {
int x = floor(random(liveFeed.width));
int y = floor(random(liveFeed.height));
color c = liveFeed.get(x, y);
fill(c);
circle(640+x, y, random(5));
}
//webcam feed bottom left
tint(255, 0, 255);
image(liveFeed, 0, 480);
tint(255, 255, 0);
float size = map(mouseX, 0, width, 1, 100);
for (int w=0; w<liveFeed.width; w+=size) {
for (int h=0; h<liveFeed.height; h+=size) {
color r = liveFeed.get(w, h);
fill(r);
rect(w, 480+h, size, size);
}
}
//webcam feed bottom right
push();
tint(255);
translate(640, 0);
scale(-1, 1);
image(liveFeed, -640, 480);
pop();
// rect((width/10), (height/2), 100, 100);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment