load a file video from path

asked 2014-03-04 03:27:03 -0600

updated 2014-03-04 03:34:14 -0600

berak gravatar image

Hello,I have a problem: load a file video from path with openCV; with webcam all right..with path bad ...don't work ;( this is my code: help me... premetto che con lacquisizione video non ho nessun problema, il problema si pone quando devo caricare un video da locale...ecco il codice

import org.opencv.core.*;
import org.opencv.highgui.Highgui; 
import org.opencv.highgui.VideoCapture; 

public class VideoCaptureFile {

public static void main (String args[]){

 System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
 VideoCapture camera = new VideoCapture("C://video.avi");

if(!camera.isOpened()){
   System.out.println("Error");
  } 

  Mat frame = new Mat();
  while(true){
    if (camera.read(frame)){ 
       System.out.println("Frame Obtained");
       System.out.println("Captured Frame Width " + 
       frame.width() + " Height " + frame.height());
       Highgui.imwrite("camera.jpg", frame);    
       System.out.println("OK");
       break;
      } 
    } 
 camera.release();
   }
  }

OUTPUT :error

edit retag flag offensive close merge delete