0
votes

This is my code:

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);

    }
});

It results in this error:

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
is this a java error or a c++ error? - ΦXocę 웃 Пepeúpa ツ
java error ; when i tried to play a video using opencv on java this error is showing... my IDE is netbeans 8 - Minto Thomas

1 Answers

0
votes

I think you are using the wrong resize method (there are different methods with the same name). Try Imgproc.resize(...) instead. Please also show your imports.