processing+opencv调用摄像头不报错,运行后画面是全黑的没有画面
用的是电脑自带摄像头,windows系统
`在运行程序时安全软件(火绒)提示了有应用使用摄像头
其他软件使用摄像头是正常的
这是代码
`
import gab.opencv.;
import processing.video.;
import java.awt.*;
Capture video;
OpenCV opencv;
PFont f1;
String s1;
char ss;
void setup() {
size(640, 480);
video = new Capture(this, width, height,“pipeline:autovideosrc”,30);
opencv = new OpenCV(this, 640, 480);
opencv.loadCascade(OpenCV.CASCADE_FRONTALFACE);
f1 = loadFont(“CourierNewPS-BoldItalicMT-48.vlw”);
s1 = “PIG!”;
video.start();
}
void draw () {
opencv.loadImage(video);
image(video,0,0);
noFill();
stroke(0,255,0);
strokeWeight(3);
Rectangle []faces = opencv.detect();
println(faces.length);
textFont(f1);
fill(200,200,0);
for(int i=0; 1< faces.length;i++){
println(faces.x +“,”+faces .y);
text(s1,faces.x,faces.y,faces.width,faces.height);
}
}