import processing.video.*;
Capture cam;
Capture cam1;
PGraphics pg1;
PGraphics pg2;
PImage img;
PImage img1;
void setup() {
size(950, 650, JAVA2D); // JAVA2D by default
pg1 = createGraphics(width/2, height/2, JAVA2D);
pg2 = createGraphics(width/2, height/2, JAVA2D);
img = createImage(width/2, height/2, RGB);
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]);
}
cam = new Capture(this, cameras[0]);
print(cam.width +" "+cam.height);
cam.start();
cam1 = new Capture(this, cameras[1]);
print(cam1.width +" "+cam1.height);
cam1.start();
}
}
void draw() {
background(255);
if (cam.available() == true) {
cam.read();
}
if (cam1.available() == true) {
cam1.read();
}
img = cam.copy();
img1 = cam1.copy();
pg1.beginDraw();
pg1.image(img, 0, 0); // < Or this
pg1.textAlign(CENTER, CENTER);
pg1.textSize(96);
pg1.fill(255,0,0);
pg1.text("TEST", pg1.width/2, pg1.height/2);
pg1.endDraw();
image(pg1, 0, 0);
pg2.beginDraw();
pg2.image(img1, 0, 0); // < Or this
pg2.textAlign(CENTER, CENTER);
pg2.textSize(96);
pg2.fill(255,255,0);
pg2.text("HELLO", pg1.width/2, pg1.height/2);
pg2.endDraw();
image(pg2, width/2, 0);
}
I am trying to get video inputs from both the built-in web cam and my smartphone camera. I get the following error:
FaceTime HD Camera (Built-in)
Camo Camera
640 480 640 480
** (Processing core video:1726): CRITICAL **: 15:42:15.432:
gst_video_frame_map_id: assertion 'info->width <= meta->width' failed
MacOS 10.14.6, Processing 4, Processing video library using GStreamer 1.16.2,
Android 10 (MIUI Global), USB connection,
Camo 0.9.10.