JavaCV: How to connect USB cam to system and capture? [closed]

asked 2015-06-24 06:54:15 -0600

Neil gravatar image

Using the code posted below I've attempted to connect my Android device to my system. In hopes that I can execute this code and capture from there.

 public static void main(String[] args) {
    captureFrame();
}
    private static void captureFrame() {
    final OpenCVFrameGrabber grabber = new OpenCVFrameGrabber(CV_CAP_ANDROID_BACK);
    try {
        grabber.start();
        IplImage img = grabber.grab();
        if (img != null) {
            cvSaveImage("capture.jpg", img);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

This gives me the error of:

com.googlecode.javacv.FrameGrabber$Exception: cvCreateCameraCapture() Error: Could not create camera capture.
    at com.googlecode.javacv.OpenCVFrameGrabber.start(OpenCVFrameGrabber.java:176)
    at javacv.demos.JavaCVDemos.captureFrame(JavaCVDemos.java:22)
    at javacv.demos.JavaCVDemos.main(JavaCVDemos.java:17)
BUILD SUCCESSFUL (total time: 1 second)
edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant by berak
close date 2015-06-24 07:18:36.166541

Comments

though we would be glad to help you with general opencv problems, please understand, that unofficial 3rd party apis like javacv are off-topic here.

berak gravatar imageberak ( 2015-06-24 07:18:27 -0600 )edit