我希望我的Cam视频能够处理草图。
我有一个Surface Book 2,其中2个凸轮位于前面(显示屏),另一个位于后面。
我尝试使用网站上的指南和代码:
import processing.video.*;
Capture cam;
void setup() {
size(640, 480);
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[0]);
cam.start();
}
}
void draw() {
if (cam.available() == true) {
cam.read();
}
image(cam, 0, 0);
// The following does the same, and is faster when just drawing the image
// without any additional resizing, transformations, or tint.
//set(0, 0, cam);
}
但是后来我只得到了一些带有绿色色调的奇怪帧。当我通过USB连接另一个Cam时,它工作得很好,在我查看Capture.list()并编辑数字到相应的源(USB相机)。
如果我对其他列表做同样的事情,我总会得到同样的问题。 我发现的是,在背面凸轮上,灯光持续亮起。
也许有人知道如何使用这两个凸轮来解决我的问题,然后只使用前面的那个。
感谢您帮助我:D
编辑:另一件事是,如果我照顾cam.available(),它几乎总是假的。 然后只有一个循环在绘制它的真实,然后有几秒只有假再次。我不明白为什么我的Cam没有USB相机,这个问题根本不存在。