有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

尝试播放视频时java断言失败(ssize.area()>0)错误

这是我的代码:

loadButton = new JButton("Open a video", createImageIcon("resources/Open16.gif"));

JFileChooser fc = new JFileChooser();
FileNameExtensionFilter filter = new FileNameExtensionFilter("Video Files", "avi", "mp4", "mpg", "mov");
fc.setFileFilter(filter);
fc.setCurrentDirectory(new File(System.getProperty("user.home"), "Desktop"));
fc.setAcceptAllFileFilterUsed(false);

loadButton.addActionListener(event -> {
    int returnVal = fc.showOpenDialog(null);

    if (returnVal == JFileChooser.APPROVE_OPTION) {
        File file = fc.getSelectedFile();

        videoPath = file.getPath();
        field.setText(videoPath);
        capture = new VideoCapture(videoPath);
        capture.read(currentImage);
        videoFPS = capture.get(Videoio.CAP_PROP_FPS);
        resize(currentImage, currentImage, new Size(640, 360));
        updateView(currentImage);

    }
});

它会导致以下错误:

OpenCV Error: Assertion failed (ssize.area() > 0) in cv::resize, file C:\builds\master_PackSlaveAddon-win32-vc12-static\opencv\modules\imgproc\src\imgwarp.cpp, line 3229 Exception in thread "AWT-EventQueue-0" CvException [org.opencv.core.CvException: cv::Exception: C:\builds\master_PackSlaveAddon-win32-vc12-static\opencv\modules\imgproc\src\imgwarp.cpp:3229: error: (-215) ssize.area() > 0 in function cv::resize ]


共 (1) 个答案

  1. # 1 楼答案

    我认为您使用了错误的调整大小方法(有相同名称的不同方法)。试试Imgproc.resize(...)。请同时出示您的进口商品