BackgroundSubtractorMOG
カメラキャプチャからの顔検出を改善しようとCascadeClassifier
しているので、顔検出プロセスの前に画像から背景を削除したほうがよいと思いましたlbpcascade_frontalface
。
私の質問は、顔検出への入力として使用するために前景画像を取得するにはどうすればよいですか? これは私がこれまでに持っているものです:
while (true) {
capture.retrieve(image);
mog.apply(image, fgMaskMOG, training?LEARNING_RATE:0);
if (counter++ > LEARNING_LIMIT) {
training = false;
}
// I think something should be done HERE to 'apply' the foreground mask
// to the original image before passing it to the classifier..
MatOfRect faces = new MatOfRect();
classifier.detectMultiScale(image, faces);
// draw faces rect
for (Rect rect : faces.toArray()) {
Core.rectangle(image, new Point(rect.x, rect.y), new Point(rect.x + rect.width, rect.y + rect.height), new Scalar(255, 0, 0));
}
// show capture in JFrame
frame.update(image);
frameFg.update(fgMaskMOG);
Thread.sleep(1000 / FPS);
}
ありがとう