纠正import语句中的错误

时间:2013-12-24 12:43:18

标签: java

如何从 import com.googlecode.javacv.cpp.opencv_core.IplImage 中删除错误?

在这里,我试图访问我的网络摄像头拍摄一些快照,我在某个地方找到了代码但是导入错误该怎么办,因为我不知道这些导入的api。

import com.googlecode.javacv.CanvasFrame;

import com.googlecode.javacv.FrameGrabber;

import com.googlecode.javacv.VideoInputFrameGrabber;

import com.googlecode.javacv.cpp.opencv_core.IplImage;

public class Wbcm implements Runnable {


IplImage image;

CanvasFrame canvas = new CanvasFrame("Web Cam");

public Wbcm() {

    canvas.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);

}

@Override

public void run() {

    FrameGrabber grabber = new VideoInputFrameGrabber(0); 

    int i=0;

    try {

        grabber.start();

        IplImage img;

        while (true) {

            img = grabber.grab();

            if (img != null) {


                cvFlip(img, img, 1);// l-r = 90_degrees_steps_anti_clockwise

                cvSaveImage((i++)+"-capture.jpg", img);

                // show image on window
                canvas.showImage(img);

            }

             //Thread.sleep(INTERVAL);
        }

    } catch (Exception e) {

    }

}

}

1 个答案:

答案 0 :(得分:2)

您收到此错误因为您的程序找不到所需的jar文件。 你必须下载jar然后设置类路径 click here to download jar