2012-12-05 2 views
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 
+0

Netbeans에서 실행될 때만 나타나는 것으로 나타났습니다. JAR을 실행하면 100 % 성공합니다. 그래서 문제는 netbeans이 실행하는 프로그램을 랩하는 방식에 달려 있다고 생각합니다. 누구나 디버깅을 훨씬 쉽게 할 수 있으므로이를 치료하는 방법을 알고 있습니다. 감사 – user845854

답변

1

입니다. 당신이 0.3.10-RC6 (나는이 대답을 쓰고 있어요 때 시간)입니다 최신 버전을 사용하는 것에 대한 #128,

#30 내가 해결책을 생각 : 자세한 내용은 당신은 Webcam Capture Github project 페이지에서 사용할 수있는이 티켓을 확인할 수 있습니다. 개발에 사용 된 IDE (또는 CLI)와 관계없이 작동해야합니다.