Skip to content

Instantly share code, notes, and snippets.

@b-oern
Last active December 17, 2015 16:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save b-oern/5637673 to your computer and use it in GitHub Desktop.
Save b-oern/5637673 to your computer and use it in GitHub Desktop.
public static void main(String[] args) {
System.out.println("Welcome to OpenCV " + Core.VERSION);
System.loadLibrary("libs/x64-" + Core.NATIVE_LIBRARY_NAME);
VideoCapture vc = new VideoCapture(0); // Funktioniert auch wenn man die NUmmer einer nicht vorhanden Webcam eingibt!
if (!vc.isOpened()) {
System.out.println("Auf Webcam konnte nicht zugeriffen werden");
System.exit(1);
}
Mat mat = new Mat();
if (!vc.retrieve(mat)) {
System.out.println("Keinen Frame bekommen");
System.exit(1);
}
System.out.println("Frame erhalten");
Highgui.imwrite("frame.jpg", mat);
System.out.println("Bye");
System.exit(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment