这是我的代码:
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:\建立\ master_PackSlaveAddon-Win32的VC12静电\的OpenCV \模块\ imgproc \ SRC \ imgwarp.cpp, 第3229行中的异常" AWT-EventQueue-0" CvException [org.opencv.core.CvException:cv :: Exception: C:\建立\ master_PackSlaveAddon-Win32的VC12静电\的OpenCV \模块\ imgproc \ SRC \ imgwarp.cpp:3229: 错误:( - 1515)ssize.area()>函数cv :: resize中的0
答案 0 :(得分:0)
我认为您使用的是错误的resize方法(有不同的方法具有相同的名称)。请尝试使用Imgproc.resize(...)
。还请显示您的进口。