「時折」動作する単純なウェブカメラ プログラムを Windows で使用していますが、ほとんどの場合、デフォルト ドライバを見つけようとしてハングします。
public class JavaApplication54 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException {
Webcam webcam = Webcam.getWebcams().get(0);
webcam.open();
BufferedImage image = webcam.getImage();
ImageIO.write(image, "PNG", new File("test.png"));
image = null;
webcam.close();
}
私が得る出力は
13:22:08.910 [main] INFO c.g.sarxos.webcam.WebcamDriverUtils -
Searching driver com.github.sarxos.webcam.ds.openimaj.OpenImajDriver
13:22:08.915 [main] DEBUG c.g.sarxos.webcam.WebcamDriverUtils -
Driver com.github.sarxos.webcam.ds.openimaj.OpenImajDriver not found
13:22:08.915 [main] INFO c.g.sarxos.webcam.WebcamDriverUtils -
Searching driver com.github.sarxos.webcam.ds.civil.LtiCivilDriver
13:22:08.915 [main] DEBUG c.g.sarxos.webcam.WebcamDriverUtils -
Driver com.github.sarxos.webcam.ds.civil.LtiCivilDriver not found
13:22:08.915 [main] INFO c.g.sarxos.webcam.WebcamDriverUtils -
Searching driver com.github.sarxos.webcam.ds.jmf.JmfDriver
13:22:08.916 [main] DEBUG c.g.sarxos.webcam.WebcamDriverUtils -
Driver com.github.sarxos.webcam.ds.jmf.JmfDriver not found
13:22:08.916 [main] INFO com.github.sarxos.webcam.Webcam - Webcam
driver has not been found, default one will be used! 13:22:08.925
[main] DEBUG c.g.s.w.d.b.WebcamDefaultDriver - Searching devices