CvCreateFileCapture in Java
How can I use CvCreateFileCapture
/ CvQueryFrame
in Java using Java wrapper?
Whether you working on desktop or Android? Are you going to read from file or from camera?
On Android you can only read from camera, and you should use the same VideoCapture
class: http://docs.opencv.org/java/org/opencv/highgui/VideoCapture.html . Video IO is not available. Unfortunately I don't know the current status on desktop Java, but you can try to use the same class.
Your code should be like this.
public class CapturingExample{ CvCapture capture; IplImage frame; public void Capturing() { capture = cvCreateCameraCapture(-1); if(capture!=null) { while(true) { frame = cvQueryFrame(capture); cvShowImage("heloo", frame.asCvMat()); cvSaveImage("hi.jpg", frame.asCvMat());//just saving image.. } } else System.out.println("errro"); } public static void main(final String[] args) { CapturingExample example = new CapturingExample(); example.Capturing(); } }
Here you can get some hints for converting opencv to javacv. Hints for Converting OpenCV C/C++ code to JavaCV
Asked: 2013-07-12 12:13:25 -0600
Seen: 2,104 times
Last updated: Jul 17 '13