【发布时间】:2017-10-24 09:12:54
【问题描述】:
这是我的代码:
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 错误:在 cv::resize、文件中断言失败 (ssize.area() > 0) C:\builds\master_PackSlaveAddon-win32-vc12-static\opencv\modules\imgproc\src\imgwarp.cpp, 线程“AWT-EventQueue-0”CvException 中的第 3229 行异常 [org.opencv.core.CvException: cv::Exception: C:\builds\master_PackSlaveAddon-win32-vc12-static\opencv\modules\imgproc\src\imgwarp.cpp:3229: 错误:(-215) ssize.area() > 0 in function cv::resize]
【问题讨论】:
-
这是 java 错误还是 c++ 错误?
-
java 错误;当我尝试在 java 上使用 opencv 播放视频时,显示此错误...我的 IDE 是 netbeans 8