Java Code Examples for org.opencv.highgui.VideoCapture#release()

The following examples show how to use org.opencv.highgui.VideoCapture#release() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VideoReaderTest.java    From HadoopCV with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
	
	System.out.println(System.getProperty("java.class.path"));
 System.out.println(System.getProperty("java.library.path"));
 
 
	System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
	VideoCapture camera = new VideoCapture("data/bike.avi");
	MatOfByte frame = new MatOfByte();
	int i = 0;
	
 
	while(true){
        if (camera.read(frame)){
            System.out.println("Frame Obtained");
            System.out.println("Captured Frame Width " +
            frame.width() + " Height " + frame.height());
            System.out.println(frame.dump());
            Highgui.imwrite("tmp\\image\\camera"+(i++)+".jpg", frame);
            //Highgui.imencode(ext, img, buf)
        }else{
        	break;
        }
    }
	camera.release();
	
}
 
Example 2
Source File: CaptureVideo.java    From opencv-fun with GNU Affero General Public License v3.0 5 votes vote down vote up
public static void main (String[] args) {
	CVLoader.load();
	
	VideoCapture video = new VideoCapture(0);

	ImgWindow window = ImgWindow.newWindow();
	if (video.isOpened()) {
		Mat mat = new Mat();
		while (!window.closed) {
			loop(mat, window, video);
		}
	}
	video.release();
}
 
Example 3
Source File: MotionDetectionTest.java    From opencv-fun with GNU Affero General Public License v3.0 5 votes vote down vote up
public static void main (String[] args) {
	CVLoader.load();
	
	VideoCapture video = new VideoCapture(0);

	ImgWindow window = ImgWindow.newWindow();
	if (video.isOpened()) {
		Mat mat = new Mat();
		while (!window.closed) {
			loop(mat, window, video);
		}
	}
	video.release();
}
 
Example 4
Source File: FaceDetectionTest.java    From opencv-fun with GNU Affero General Public License v3.0 5 votes vote down vote up
public static void main (String[] args) {
	CVLoader.load();
	VideoCapture video = new VideoCapture(0);

	CascadeClassifier classifier = new CascadeClassifier("data/haarcascade_frontalface_alt.xml");
	ImgWindow window = ImgWindow.newWindow();
	if (video.isOpened()) {
	 	Mat mat = new Mat();
		while (!window.closed) {
			loop(classifier, mat, window, video);
		}
	}
	video.release();
}