最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

java - Why wont imshow() method work in OpenCV when i try to use it in intellij - Stack Overflow

programmeradmin1浏览0评论

I am not able to use OpenCV's imshow() method . Can someone please help me with this . I will post a screenshot of the errors im facing . i would also appreciate some help in configuring intellij for OpenCV . This is the error im facing

Exception in thread "main" java.lang.RuntimeException: Unknown exception.
    at .bytedeco.opencv.global.opencv_highgui.imshow(Native Method)
    at .example.Main.main(Main.java:35)
public class Main {

    public static void main(String[] args) {
        Loader.load(opencv_core.class);


        VideoCapture capture = new VideoCapture(0);

        if (!capture.isOpened()){
            System.out.println("error eerror");
            return;
        }

        Mat frame = new Mat();

        while (true){
            if (capture.read(frame)){
                opencv_highgui.imshow("camera" , frame);

            }

            if (opencv_highgui.waitKey(1) == 27 ){
                break;
            }
            else {
                System.out.println("Unable to capture frame");
                break;
            }
        }

        capture.release();
        opencv_highgui.destroyAllWindows();
    }
}

this is what i wanted to try . The camera is turned on for a second and then this error pops up . Any help is appreciated . Thank you.

发布评论

评论列表(0)

  1. 暂无评论