We are about to switch to a new forum software. Until then we have removed the registration on this forum.
import codeanticode.tablet.*;
import processing.video.*;
Tablet tablet;
int x = 0;
int y = 0;
Capture cam;
PGraphics pg;
void setup() {
size(1280, 720);
pg = createGraphics(1280, 720);
tablet = new Tablet(this);
String[] cameras = Capture.list();
if (cameras.length == 0) {
println("There are no cameras available for capture.");
exit();
} else {
println("Available cameras:");
for (int i = 0; i < cameras.length; i++) {
println(cameras[i]);
}
// The camera can be initialized directly using an
// element from the array returned by list():
cam = new Capture(this, cameras[1]);
cam.start();
}
}
void captureEvent (Capture cam) {
cam.read();
}
void draw() {
image(cam, 0, 0);
pg.beginDraw();
//pg.background(0, 0, 0, 0);
if (mousePressed) {
pg.strokeWeight(30 * tablet.getPressure());
pg.line(mouseX, mouseY, pmouseX, pmouseY);
}
if (keyPressed) {
/*if (key == 'n') {
image(cam, 0, 0);
} */
if (key == 'R') {
pg.stroke(255, 36, 36);
}
if (key == 'r') {
pg.stroke(255,144,144);
}
if (key == 'O') {
pg.stroke(255, 111, 0);
}
if (key == 'o') {
pg.stroke(255,168,100);
}
if (key == 'y') {
pg.stroke(255, 247, 0);
}
if (key == 'Y') {
pg.stroke(250,230,0);
}
if (key == 'G') {
pg.stroke(22, 210, 10);
}
if(key == 'g'){
pg.stroke(127,247,12);
}
if (key == 'B') {
pg.stroke(2, 102, 222);
}
if (key == 'b') {
pg.stroke(49, 226, 255);
}
if (key == 'v') {
pg.stroke(192, 2, 222);
}
if (key == 'V') {
pg.stroke(109,47,118);
}
if (key == 'P') {
pg.stroke(255, 49, 231);
}
if (key == 'p') {
pg.stroke(255,170,231);
}
if (key == 'a') {
pg.stroke(49, 255, 236);
}
if (key == 'e') {
pg.stroke(255, 255, 255);
}
if (key == ' ') {
pg.stroke(0);
}
if (key == 'c') {
pg.stroke(149, 78, 45);
}
if (key == 'm') {
pg.stroke(180,180,171);
}
}
pg.endDraw();
image(pg, 0, 0);
if (keyPressed) {
if (key == 'n') {
image(cam, 0, 0);
}
}
}
Hello guys, I´ve used your Search function but did not find anything about output on Hdmi. My Project is about getting a live video via Webcam in Processing. With that i want to draw on it with an mouse or graphic tablet. So far everything is working. My Problem is that i want to give that output of the drawing without the live video on the Hdmi output. Is that possible? First i want to try that on my Mac/Windows and then on an Raspberry. Hope you can Help me.
Thanks a lot.