0
"가끔은"작동하는 Windows에서 간단한 웹캠 프로그램을 사용하지만 기본 드라이버를 찾으려고 할 때 대부분 멈 춥니 다. 나는이 웹캠 캡처 API 코드에서 발견 된 교착 상태 문제 중 하나였다 올바른 해요 경우웹캠 캡처 가끔만 작동합니다.
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
Netbeans에서 실행될 때만 나타나는 것으로 나타났습니다. JAR을 실행하면 100 % 성공합니다. 그래서 문제는 netbeans이 실행하는 프로그램을 랩하는 방식에 달려 있다고 생각합니다. 누구나 디버깅을 훨씬 쉽게 할 수 있으므로이를 치료하는 방법을 알고 있습니다. 감사 – user845854